id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_41654
static void do_video_stats(AVFormatContext *os, OutputStream *ost, int frame_size) { AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); exit_program(1); } } enc = ost->st->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->frame_number; fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); if (enc->flags&CODEC_FLAG_PSNR) fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); fprintf(vstats_file,"f_size= %6d ", frame_size); ti1 = ost->sync_opts * av_q2d(enc->time_base); if (ti1 < 0.01) ti1 = 0.01; bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)video_size / 1024, ti1, bitrate, avg_bitrate); fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); } } avconv.c:1474: error: Null Dereference pointer `vstats_file` last assigned on line 1464 could be null and is dereferenced by call to `fprintf()` at line 1474, column 9. avconv.c:1455:1: start of procedure do_video_stats() 1453. } 1454. 1455. static void do_video_stats(AVFormatContext *os, OutputStream *ost, ^ 1456. int frame_size) 1457. { avconv.c:1463:10: Taking true branch 1461. 1462. /* this is executed just the first time do_video_stats is called */ 1463. if (!vstats_file) { ^ 1464. vstats_file = fopen(vstats_filename, "w"); 1465. if (!vstats_file) { avconv.c:1464:9: 1462. /* this is executed just the first time do_video_stats is called */ 1463. if (!vstats_file) { 1464. vstats_file = fopen(vstats_filename, "w"); ^ 1465. if (!vstats_file) { 1466. perror("fopen"); avconv.c:1465:14: Taking true branch 1463. if (!vstats_file) { 1464. vstats_file = fopen(vstats_filename, "w"); 1465. if (!vstats_file) { ^ 1466. perror("fopen"); 1467. exit_program(1); avconv.c:1466:13: 1464. vstats_file = fopen(vstats_filename, "w"); 1465. if (!vstats_file) { 1466. perror("fopen"); ^ 1467. exit_program(1); 1468. } avconv.c:1467:13: Skipping exit_program(): empty list of specs 1465. if (!vstats_file) { 1466. perror("fopen"); 1467. exit_program(1); ^ 1468. } 1469. } avconv.c:1471:5: 1469. } 1470. 1471. enc = ost->st->codec; ^ 1472. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1473. frame_number = ost->frame_number; avconv.c:1472:9: Taking true branch 1470. 1471. enc = ost->st->codec; 1472. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { ^ 1473. frame_number = ost->frame_number; 1474. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); avconv.c:1473:9: 1471. enc = ost->st->codec; 1472. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1473. frame_number = ost->frame_number; ^ 1474. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); 1475. if (enc->flags&CODEC_FLAG_PSNR) avconv.c:1474:9: 1472. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1473. frame_number = ost->frame_number; 1474. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); ^ 1475. if (enc->flags&CODEC_FLAG_PSNR) 1476. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0)));
https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avconv.c/#L1474
d2a_code_trace_data_41655
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1229: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 14 steps of the trace test/bntest.c:1198:1: Parameter `ctx->stack.depth` 1196. } 1197. 1198. > int test_exp(BIO *bp, BN_CTX *ctx) 1199. { 1200. BIGNUM *a, *b, *d, *e, *one; test/bntest.c:1214:13: Call 1212. BN_bntest_rand(b, 2 + i, 0, 0); 1213. 1214. if (BN_exp(d, a, b, ctx) <= 0) ^ 1215. return (0); 1216. crypto/bn/bn_exp.c:41:1: Parameter `ctx->stack.depth` 39. 40. /* this one works - simple but works */ 41. > int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 42. { 43. int i, bits, ret = 0; test/bntest.c:1229:13: Call 1227. BN_one(e); 1228. for (; !BN_is_zero(b); BN_sub(b, b, one)) 1229. BN_mul(e, e, a, ctx); ^ 1230. BN_sub(e, e, d); 1231. if (!BN_is_zero(e)) { crypto/bn/bn_mul.c:854:5: Call 852. top = al + bl; 853. 854. BN_CTX_start(ctx); ^ 855. if ((r == a) || (r == b)) { 856. if ((rr = BN_CTX_get(ctx)) == NULL) 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_mul.c:979:5: Call 977. err: 978. bn_check_top(r); 979. BN_CTX_end(ctx); ^ 980. return (ret); 981. } 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_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/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_41656
DECLAREcpFunc(cpContig2SeparateByRow) { tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in)); tdata_t outbuf = _TIFFmalloc(TIFFScanlineSize(out)); register uint8 *inp, *outp; register uint32 n; uint32 row; tsample_t s; for (s = 0; s < spp; s++) { for (row = 0; row < imagelength; row++) { if (TIFFReadScanline(in, inbuf, row, 0) < 0 && !ignore) { TIFFError(TIFFFileName(in), "Error, can't read scanline %lu", (unsigned long) row); goto bad; } inp = ((uint8*)inbuf) + s; outp = (uint8*)outbuf; for (n = imagewidth; n-- > 0;) { *outp++ = *inp; inp += spp; } if (TIFFWriteScanline(out, outbuf, row, s) < 0) { TIFFError(TIFFFileName(out), "Error, can't write scanline %lu", (unsigned long) row); goto bad; } } } if (inbuf) _TIFFfree(inbuf); if (outbuf) _TIFFfree(outbuf); return 1; bad: if (inbuf) _TIFFfree(inbuf); if (outbuf) _TIFFfree(outbuf); return 0; } tools/tiffcp.c:1001: error: Integer Overflow L2 ([0, `imagewidth`] - 1):unsigned32. tools/tiffcp.c:980:1: <LHS trace> 978. * Contig -> separate by row. 979. */ 980. DECLAREcpFunc(cpContig2SeparateByRow) ^ 981. { 982. tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in)); tools/tiffcp.c:980:1: Parameter `imagewidth` 978. * Contig -> separate by row. 979. */ 980. DECLAREcpFunc(cpContig2SeparateByRow) ^ 981. { 982. tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in)); tools/tiffcp.c:1001:9: Assignment 999. inp = ((uint8*)inbuf) + s; 1000. outp = (uint8*)outbuf; 1001. for (n = imagewidth; n-- > 0;) { ^ 1002. *outp++ = *inp; 1003. inp += spp; tools/tiffcp.c:1001:25: Binary operation: ([0, imagewidth] - 1):unsigned32 999. inp = ((uint8*)inbuf) + s; 1000. outp = (uint8*)outbuf; 1001. for (n = imagewidth; n-- > 0;) { ^ 1002. *outp++ = *inp; 1003. inp += spp;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiffcp.c/#L1001
d2a_code_trace_data_41657
static int opt_vstats(void *optctx, const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(NULL, opt, filename); } avconv_opt.c:1889: error: Null Dereference pointer `today` last assigned on line 1887 could be null and is dereferenced at line 1889, column 69. avconv_opt.c:1883:1: start of procedure opt_vstats() 1881. } 1882. 1883. static int opt_vstats(void *optctx, const char *opt, const char *arg) ^ 1884. { 1885. char filename[40]; avconv_opt.c:1886:5: 1884. { 1885. char filename[40]; 1886. time_t today2 = time(NULL); ^ 1887. struct tm *today = localtime(&today2); 1888. avconv_opt.c:1887:5: 1885. char filename[40]; 1886. time_t today2 = time(NULL); 1887. struct tm *today = localtime(&today2); ^ 1888. 1889. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv_opt.c:1889:5: 1887. struct tm *today = localtime(&today2); 1888. 1889. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 1890. today->tm_sec); 1891. return opt_vstats_file(NULL, opt, filename);
https://github.com/libav/libav/blob/a0ce85ac7de098d3f9b53b51b77a09bad700a011/avconv_opt.c/#L1889
d2a_code_trace_data_41658
static int mpegts_read_header(AVFormatContext *s, AVFormatParameters *ap) { MpegTSContext *ts = s->priv_data; ByteIOContext *pb = s->pb; uint8_t buf[1024]; int len; int64_t pos; if (ap) { ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; if(ap->mpeg2ts_raw){ av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n"); return -1; } } pos = url_ftell(pb); len = get_buffer(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); if (ts->raw_packet_size <= 0) goto fail; ts->stream = s; ts->auto_guess = 0; if (s->iformat == &mpegts_demuxer) { url_fseek(pb, pos, SEEK_SET); mpegts_scan_sdt(ts); mpegts_set_service(ts); handle_packets(ts, s->probesize); ts->auto_guess = 1; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "tuning done\n"); #endif s->ctx_flags |= AVFMTCTX_NOHEADER; } else { AVStream *st; int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l; int64_t pcrs[2], pcr_h; int packet_count[2]; uint8_t packet[TS_PACKET_SIZE]; st = av_new_stream(s, 0); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); st->codec->codec_type = CODEC_TYPE_DATA; st->codec->codec_id = CODEC_ID_MPEG2TS; pcr_pid = -1; nb_pcrs = 0; nb_packets = 0; for(;;) { ret = read_packet(s->pb, packet, ts->raw_packet_size); if (ret < 0) return -1; pid = AV_RB16(packet + 1) & 0x1fff; if ((pcr_pid == -1 || pcr_pid == pid) && parse_pcr(&pcr_h, &pcr_l, packet) == 0) { pcr_pid = pid; packet_count[nb_pcrs] = nb_packets; pcrs[nb_pcrs] = pcr_h * 300 + pcr_l; nb_pcrs++; if (nb_pcrs >= 2) break; } nb_packets++; } ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; #if 0 av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n", st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); #endif } url_fseek(pb, pos, SEEK_SET); return 0; fail: return -1; } libavformat/mpegts.c:1292: error: Uninitialized Value The value read from pcrs[_] was never initialized. libavformat/mpegts.c:1292:9: 1290. /* NOTE1: the bitrate is computed without the FEC */ 1291. /* NOTE2: it is only the bitrate of the start of the stream */ 1292. ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); ^ 1293. ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; 1294. s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegts.c/#L1292
d2a_code_trace_data_41659
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } crypto/evp/e_chacha20_poly1305.c:303: error: INTEGER_OVERFLOW_L2 (16 - [1, 42+max(1, `ctx->cipher_data->num`)]):unsigned64 by call to `Poly1305_Update`. Showing all 6 steps of the trace crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `ctx->cipher_data->num` 231. } 232. 233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 234. const unsigned char *in, size_t len) 235. { crypto/evp/e_chacha20_poly1305.c:303:13: Call 301. 302. if ((rem = (size_t)actx->len.text % POLY1305_BLOCK_SIZE)) 303. Poly1305_Update(POLY1305_ctx(actx), zero, ^ 304. POLY1305_BLOCK_SIZE - rem); 305. crypto/poly1305/poly1305.c:466:1: <RHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `ctx->num` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:479:10: Assignment 477. size_t rem, num; 478. 479. if ((num = ctx->num)) { ^ 480. rem = POLY1305_BLOCK_SIZE - num; 481. if (len >= rem) { crypto/poly1305/poly1305.c:480:9: Binary operation: (16 - [1, 42+max(1, ctx->cipher_data->num)]):unsigned64 by call to `Poly1305_Update` 478. 479. if ((num = ctx->num)) { 480. rem = POLY1305_BLOCK_SIZE - num; ^ 481. if (len >= rem) { 482. memcpy(ctx->data + num, inp, rem);
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L480
d2a_code_trace_data_41660
int dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num, 0); if (frag == NULL) return 0; memcpy(frag->fragment, s->init_buf->data, s->init_num); if (is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); memset(seq64be, 0, sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs) >> 8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if (item == NULL) { dtls1_hm_fragment_free(frag); return 0; } pqueue_insert(s->d1->sent_messages, item); return 1; } ssl/statem/statem_dtls.c:1108: error: NULL_DEREFERENCE pointer `frag->fragment` last assigned on line 1104 could be null and is dereferenced by call to `memcpy()` at line 1108, column 5. Showing all 26 steps of the trace ssl/statem/statem_dtls.c:1092:1: start of procedure dtls1_buffer_message() 1090. } 1091. 1092. > int dtls1_buffer_message(SSL *s, int is_ccs) 1093. { 1094. pitem *item; ssl/statem/statem_dtls.c:1102:5: Condition is true 1100. * serialized 1101. */ 1102. OPENSSL_assert(s->init_off == 0); ^ 1103. 1104. frag = dtls1_hm_fragment_new(s->init_num, 0); ssl/statem/statem_dtls.c:1104:5: 1102. OPENSSL_assert(s->init_off == 0); 1103. 1104. > frag = dtls1_hm_fragment_new(s->init_num, 0); 1105. if (frag == NULL) 1106. return 0; ssl/statem/statem_dtls.c:163:1: start of procedure dtls1_hm_fragment_new() 161. static int dtls_get_reassembled_message(SSL *s, long *len); 162. 163. > static hm_fragment *dtls1_hm_fragment_new(unsigned long frag_len, 164. int reassembly) 165. { ssl/statem/statem_dtls.c:166:5: 164. int reassembly) 165. { 166. > hm_fragment *frag = NULL; 167. unsigned char *buf = NULL; 168. unsigned char *bitmask = NULL; ssl/statem/statem_dtls.c:167:5: 165. { 166. hm_fragment *frag = NULL; 167. > unsigned char *buf = NULL; 168. unsigned char *bitmask = NULL; 169. ssl/statem/statem_dtls.c:168:5: 166. hm_fragment *frag = NULL; 167. unsigned char *buf = NULL; 168. > unsigned char *bitmask = NULL; 169. 170. frag = OPENSSL_malloc(sizeof(*frag)); ssl/statem/statem_dtls.c:170:5: 168. unsigned char *bitmask = NULL; 169. 170. > frag = OPENSSL_malloc(sizeof(*frag)); 171. if (frag == NULL) 172. return NULL; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/statem/statem_dtls.c:171:9: Taking false branch 169. 170. frag = OPENSSL_malloc(sizeof(*frag)); 171. if (frag == NULL) ^ 172. return NULL; 173. ssl/statem/statem_dtls.c:174:9: Taking false branch 172. return NULL; 173. 174. if (frag_len) { ^ 175. buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { ssl/statem/statem_dtls.c:183:5: 181. 182. /* zero length fragment gets zero frag->fragment */ 183. > frag->fragment = buf; 184. 185. /* Initialize reassembly bitmask if necessary */ ssl/statem/statem_dtls.c:186:9: Taking false branch 184. 185. /* Initialize reassembly bitmask if necessary */ 186. if (reassembly) { ^ 187. bitmask = OPENSSL_zalloc(RSMBLY_BITMASK_SIZE(frag_len)); 188. if (bitmask == NULL) { ssl/statem/statem_dtls.c:195:5: 193. } 194. 195. > frag->reassembly = bitmask; 196. 197. return frag; ssl/statem/statem_dtls.c:197:5: 195. frag->reassembly = bitmask; 196. 197. > return frag; 198. } 199. ssl/statem/statem_dtls.c:198:1: return from a call to dtls1_hm_fragment_new 196. 197. return frag; 198. > } 199. 200. void dtls1_hm_fragment_free(hm_fragment *frag) ssl/statem/statem_dtls.c:1105:9: Taking false branch 1103. 1104. frag = dtls1_hm_fragment_new(s->init_num, 0); 1105. if (frag == NULL) ^ 1106. return 0; 1107. ssl/statem/statem_dtls.c:1108:5: 1106. return 0; 1107. 1108. > memcpy(frag->fragment, s->init_buf->data, s->init_num); 1109. 1110. if (is_ccs) {
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/statem/statem_dtls.c/#L1108
d2a_code_trace_data_41661
static void vc1_decode_i_blocks(VC1Context *v) { int k, j; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; int mb_pos; switch(v->y_ac_table_index){ case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: v->codingset = CS_HIGH_MOT_INTRA; break; case 2: v->codingset = CS_MID_RATE_INTRA; break; } switch(v->c_ac_table_index){ case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: v->codingset2 = CS_HIGH_MOT_INTER; break; case 2: v->codingset2 = CS_MID_RATE_INTER; break; } s->y_dc_scale = s->y_dc_scale_table[v->pq]; s->c_dc_scale = s->c_dc_scale_table[v->pq]; s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) { ff_init_block_index(s); ff_update_block_index(s); s->dsp.clear_blocks(s->block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_width; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; s->current_picture.qscale_table[mb_pos] = v->pq; s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); v->s.ac_pred = get_bits1(&v->s.gb); for(k = 0; k < 6; k++) { val = ((cbp >> (5 - k)) & 1); if (k < 4) { int pred = vc1_coded_block_pred(&v->s, k, &coded_val); val = val ^ pred; *coded_val = val; } cbp |= val << (5 - k); vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); s->dsp.vc1_inv_trans_8x8(s->block[k]); if(v->pq >= 9 && v->overlap) { for(j = 0; j < 64; j++) s->block[k][j] += 128; } } vc1_put_block(v, s->block); if(v->pq >= 9 && v->overlap) { if(s->mb_x) { s->dsp.vc1_h_overlap(s->dest[0], s->linesize); s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { s->dsp.vc1_v_overlap(s->dest[0], s->linesize); s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); return; } } ff_draw_horiz_band(s, s->mb_y * 16, 16); s->first_slice_line = 0; } ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); } libavcodec/vc1.c:3455: error: Buffer Overrun L2 Offset: [0, 63] Size: 2. libavcodec/vc1.c:3455:25: <Offset trace> 3453. s->dsp.vc1_inv_trans_8x8(s->block[k]); 3454. if(v->pq >= 9 && v->overlap) { 3455. for(j = 0; j < 64; j++) s->block[k][j] += 128; ^ 3456. } 3457. } libavcodec/vc1.c:3455:25: Assignment 3453. s->dsp.vc1_inv_trans_8x8(s->block[k]); 3454. if(v->pq >= 9 && v->overlap) { 3455. for(j = 0; j < 64; j++) s->block[k][j] += 128; ^ 3456. } 3457. } libavcodec/vc1.c:3451:17: <Length trace> 3449. cbp |= val << (5 - k); 3450. 3451. vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); ^ 3452. 3453. s->dsp.vc1_inv_trans_8x8(s->block[k]); libavcodec/vc1.c:3451:17: Call 3449. cbp |= val << (5 - k); 3450. 3451. vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); ^ 3452. 3453. s->dsp.vc1_inv_trans_8x8(s->block[k]); libavcodec/vc1.c:2331:1: Parameter `*block` 2329. * @param codingset set of VLC to decode data 2330. */ 2331. static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset) ^ 2332. { 2333. GetBitContext *gb = &v->s.gb; libavcodec/vc1.c:3455:45: Array access: Offset: [0, 63] Size: 2 3453. s->dsp.vc1_inv_trans_8x8(s->block[k]); 3454. if(v->pq >= 9 && v->overlap) { 3455. for(j = 0; j < 64; j++) s->block[k][j] += 128; ^ 3456. } 3457. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3455
d2a_code_trace_data_41662
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/t1_lib.c:1077: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 27]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_lib.c:1076:21: Call 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) ^ 1077. || !WPACKET_start_sub_packet_u8(pkt) 1078. /* login must not be zero...internal error if so */ ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/t1_lib.c:1077:21: Call 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) 1077. || !WPACKET_start_sub_packet_u8(pkt) ^ 1078. /* login must not be zero...internal error if so */ 1079. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_NON_ZERO_LENGTH) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->tlsext_hostname->strlen + 27]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_41663
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:5797: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:5756:10: Call 5754. } 5755. 5756. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 5757. NULL, NULL)) 5758. || !TEST_true(create_ssl_connection(serverssl, clientssl, test/ssltestlib.c:669:15: Call 667. if (*sssl != NULL) 668. serverssl = *sssl; 669. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 670. goto error; 671. if (*cssl != NULL) ssl/ssl_lib.c:671:1: Parameter `ctx->sessions->num_items` 669. } 670. 671. > SSL *SSL_new(SSL_CTX *ctx) 672. { 673. SSL *s; test/sslapitest.c:5797:5: Call 5795. 5796. end: 5797. SSL_free(serverssl); ^ 5798. SSL_free(clientssl); 5799. SSL_CTX_free(sctx); ssl/ssl_lib.c:1133:1: Parameter `s->session_ctx->sessions->num_items` 1131. } 1132. 1133. > void SSL_free(SSL *s) 1134. { 1135. int i; ssl/ssl_lib.c:1164:9: Call 1162. /* Make the next call work :-) */ 1163. if (s->session != NULL) { 1164. ssl_clear_bad_session(s); ^ 1165. SSL_SESSION_free(s->session); 1166. } ssl/ssl_sess.c:1124:1: Parameter `s->session_ctx->sessions->num_items` 1122. } 1123. 1124. > int ssl_clear_bad_session(SSL *s) 1125. { 1126. if ((s->session != NULL) && ssl/ssl_sess.c:1129:9: Call 1127. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1128. !(SSL_in_init(s) || SSL_in_before(s))) { 1129. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1130. return 1; 1131. } else ssl/ssl_sess.c:742:1: Parameter `ctx->sessions->num_items` 740. } 741. 742. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 743. { 744. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:744:12: Call 742. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 743. { 744. return remove_session_lock(ctx, c, 1); ^ 745. } 746. ssl/ssl_sess.c:747:1: Parameter `ctx->sessions->num_items` 745. } 746. 747. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 748. { 749. SSL_SESSION *r; ssl/ssl_sess.c:757:17: Call 755. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) { 756. ret = 1; 757. r = lh_SSL_SESSION_delete(ctx->sessions, r); ^ 758. SSL_SESSION_list_remove(ctx, r); 759. } 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:128:1: <LHS trace> 126. } 127. 128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 129. { 130. unsigned long hash; crypto/lhash/lhash.c:128:1: Parameter `lh->num_items` 126. } 127. 128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 129. { 130. unsigned long hash; crypto/lhash/lhash.c:148:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 146. } 147. 148. lh->num_items--; ^ 149. if ((lh->num_nodes > MIN_NODES) && 150. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/6e68dae85a8f91944370125561c7ec0d5da46c20/crypto/lhash/lhash.c/#L148
d2a_code_trace_data_41664
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:277: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:277:3: 275. *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); 276. *(ptr++)=(inbuffer[2]>>12)&7; 277. *(ptr++)=(inbuffer[2]>>10)&3; ^ 278. *(ptr++)=(inbuffer[2]>>5)&0x1f; 279. *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L277
d2a_code_trace_data_41665
static int escape130_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Escape130Context *s = avctx->priv_data; AVFrame *pic = data; GetBitContext gb; int ret; uint8_t *old_y, *old_cb, *old_cr, *new_y, *new_cb, *new_cr; uint8_t *dstY, *dstU, *dstV; unsigned old_y_stride, old_cb_stride, old_cr_stride, new_y_stride, new_cb_stride, new_cr_stride; unsigned total_blocks = avctx->width * avctx->height / 4, block_index, block_x = 0; unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10; int skip = -1, y_avg = 0, i, j; uint8_t *ya = s->old_y_avg; if (buf_size <= 16) { av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\n"); return AVERROR_INVALIDDATA; } if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; init_get_bits(&gb, buf + 16, (buf_size - 16) * 8); new_y = s->new_y; new_cb = s->new_u; new_cr = s->new_v; new_y_stride = s->linesize[0]; new_cb_stride = s->linesize[1]; new_cr_stride = s->linesize[2]; old_y = s->old_y; old_cb = s->old_u; old_cr = s->old_v; old_y_stride = s->linesize[0]; old_cb_stride = s->linesize[1]; old_cr_stride = s->linesize[2]; for (block_index = 0; block_index < total_blocks; block_index++) { if (skip == -1) skip = decode_skip_count(&gb); if (skip == -1) { av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\n"); return AVERROR_INVALIDDATA; } if (skip) { y[0] = old_y[0]; y[1] = old_y[1]; y[2] = old_y[old_y_stride]; y[3] = old_y[old_y_stride + 1]; y_avg = ya[0]; cb = old_cb[0]; cr = old_cr[0]; } else { if (get_bits1(&gb)) { unsigned sign_selector = get_bits(&gb, 6); unsigned difference_selector = get_bits(&gb, 2); y_avg = 2 * get_bits(&gb, 5); for (i = 0; i < 4; i++) { y[i] = av_clip(y_avg + offset_table[difference_selector] * sign_table[sign_selector][i], 0, 63); } } else if (get_bits1(&gb)) { if (get_bits1(&gb)) { y_avg = get_bits(&gb, 6); } else { unsigned adjust_index = get_bits(&gb, 3); y_avg = (y_avg + luma_adjust[adjust_index]) & 63; } for (i = 0; i < 4; i++) y[i] = y_avg; } if (get_bits1(&gb)) { if (get_bits1(&gb)) { cb = get_bits(&gb, 5); cr = get_bits(&gb, 5); } else { unsigned adjust_index = get_bits(&gb, 3); cb = (cb + chroma_adjust[0][adjust_index]) & 31; cr = (cr + chroma_adjust[1][adjust_index]) & 31; } } } *ya++ = y_avg; new_y[0] = y[0]; new_y[1] = y[1]; new_y[new_y_stride] = y[2]; new_y[new_y_stride + 1] = y[3]; *new_cb = cb; *new_cr = cr; old_y += 2; old_cb++; old_cr++; new_y += 2; new_cb++; new_cr++; block_x++; if (block_x * 2 == avctx->width) { block_x = 0; old_y += old_y_stride * 2 - avctx->width; old_cb += old_cb_stride - avctx->width / 2; old_cr += old_cr_stride - avctx->width / 2; new_y += new_y_stride * 2 - avctx->width; new_cb += new_cb_stride - avctx->width / 2; new_cr += new_cr_stride - avctx->width / 2; } skip--; } new_y = s->new_y; new_cb = s->new_u; new_cr = s->new_v; dstY = pic->data[0]; dstU = pic->data[1]; dstV = pic->data[2]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) dstY[i] = new_y[i] << 2; dstY += pic->linesize[0]; new_y += new_y_stride; } for (j = 0; j < avctx->height / 2; j++) { for (i = 0; i < avctx->width / 2; i++) { dstU[i] = chroma_vals[new_cb[i]]; dstV[i] = chroma_vals[new_cr[i]]; } dstU += pic->linesize[1]; dstV += pic->linesize[2]; new_cb += new_cb_stride; new_cr += new_cr_stride; } av_dlog(avctx, "Frame data: provided %d bytes, used %d bytes\n", buf_size, get_bits_count(&gb) >> 3); FFSWAP(uint8_t*, s->old_y, s->new_y); FFSWAP(uint8_t*, s->old_u, s->new_u); FFSWAP(uint8_t*, s->old_v, s->new_v); *got_frame = 1; return buf_size; } libavcodec/escape130.c:237: error: Null Dereference pointer `&gb->buffer` last assigned on line 218 could be null and is dereferenced by call to `decode_skip_count()` at line 237, column 20. libavcodec/escape130.c:188:1: start of procedure escape130_decode_frame() 186. } 187. 188. static int escape130_decode_frame(AVCodecContext *avctx, void *data, ^ 189. int *got_frame, AVPacket *avpkt) 190. { libavcodec/escape130.c:191:5: 189. int *got_frame, AVPacket *avpkt) 190. { 191. const uint8_t *buf = avpkt->data; ^ 192. int buf_size = avpkt->size; 193. Escape130Context *s = avctx->priv_data; libavcodec/escape130.c:192:5: 190. { 191. const uint8_t *buf = avpkt->data; 192. int buf_size = avpkt->size; ^ 193. Escape130Context *s = avctx->priv_data; 194. AVFrame *pic = data; libavcodec/escape130.c:193:5: 191. const uint8_t *buf = avpkt->data; 192. int buf_size = avpkt->size; 193. Escape130Context *s = avctx->priv_data; ^ 194. AVFrame *pic = data; 195. GetBitContext gb; libavcodec/escape130.c:194:5: 192. int buf_size = avpkt->size; 193. Escape130Context *s = avctx->priv_data; 194. AVFrame *pic = data; ^ 195. GetBitContext gb; 196. int ret; libavcodec/escape130.c:203:5: 201. unsigned old_y_stride, old_cb_stride, old_cr_stride, 202. new_y_stride, new_cb_stride, new_cr_stride; 203. unsigned total_blocks = avctx->width * avctx->height / 4, ^ 204. block_index, block_x = 0; 205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10; libavcodec/escape130.c:205:5: 203. unsigned total_blocks = avctx->width * avctx->height / 4, 204. block_index, block_x = 0; 205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10; ^ 206. int skip = -1, y_avg = 0, i, j; 207. uint8_t *ya = s->old_y_avg; libavcodec/escape130.c:206:5: 204. block_index, block_x = 0; 205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10; 206. int skip = -1, y_avg = 0, i, j; ^ 207. uint8_t *ya = s->old_y_avg; 208. libavcodec/escape130.c:207:5: 205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10; 206. int skip = -1, y_avg = 0, i, j; 207. uint8_t *ya = s->old_y_avg; ^ 208. 209. // first 16 bytes are header; no useful information in here libavcodec/escape130.c:210:9: Taking false branch 208. 209. // first 16 bytes are header; no useful information in here 210. if (buf_size <= 16) { ^ 211. av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\n"); 212. return AVERROR_INVALIDDATA; libavcodec/escape130.c:215:9: Taking false branch 213. } 214. 215. if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) ^ 216. return ret; 217. libavcodec/escape130.c:218:5: 216. return ret; 217. 218. init_get_bits(&gb, buf + 16, (buf_size - 16) * 8); ^ 219. 220. new_y = s->new_y; libavcodec/get_bits.h:375:1: start of procedure init_get_bits() 373. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 374. */ 375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 376. int bit_size) 377. { libavcodec/get_bits.h:379:5: 377. { 378. int buffer_size; 379. int ret = 0; ^ 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:381:9: Taking true branch 379. int ret = 0; 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 382. buffer_size = bit_size = 0; 383. buffer = NULL; libavcodec/get_bits.h:382:9: 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; ^ 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:383:9: 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; 383. buffer = NULL; ^ 384. ret = AVERROR_INVALIDDATA; 385. } libavcodec/get_bits.h:384:9: 382. buffer_size = bit_size = 0; 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; ^ 385. } 386. libavcodec/get_bits.h:387:5: 385. } 386. 387. buffer_size = (bit_size + 7) >> 3; ^ 388. 389. s->buffer = buffer; libavcodec/get_bits.h:389:5: 387. buffer_size = (bit_size + 7) >> 3; 388. 389. s->buffer = buffer; ^ 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:390:5: 388. 389. s->buffer = buffer; 390. s->size_in_bits = bit_size; ^ 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:392:5: 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; ^ 393. #endif 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:394:5: 392. s->size_in_bits_plus8 = bit_size + 8; 393. #endif 394. s->buffer_end = buffer + buffer_size; ^ 395. s->index = 0; 396. libavcodec/get_bits.h:395:5: 393. #endif 394. s->buffer_end = buffer + buffer_size; 395. s->index = 0; ^ 396. 397. return ret; libavcodec/get_bits.h:397:5: 395. s->index = 0; 396. 397. return ret; ^ 398. } 399. libavcodec/get_bits.h:398:1: return from a call to init_get_bits 396. 397. return ret; 398. } ^ 399. 400. /** libavcodec/escape130.c:220:5: 218. init_get_bits(&gb, buf + 16, (buf_size - 16) * 8); 219. 220. new_y = s->new_y; ^ 221. new_cb = s->new_u; 222. new_cr = s->new_v; libavcodec/escape130.c:221:5: 219. 220. new_y = s->new_y; 221. new_cb = s->new_u; ^ 222. new_cr = s->new_v; 223. new_y_stride = s->linesize[0]; libavcodec/escape130.c:222:5: 220. new_y = s->new_y; 221. new_cb = s->new_u; 222. new_cr = s->new_v; ^ 223. new_y_stride = s->linesize[0]; 224. new_cb_stride = s->linesize[1]; libavcodec/escape130.c:223:5: 221. new_cb = s->new_u; 222. new_cr = s->new_v; 223. new_y_stride = s->linesize[0]; ^ 224. new_cb_stride = s->linesize[1]; 225. new_cr_stride = s->linesize[2]; libavcodec/escape130.c:224:5: 222. new_cr = s->new_v; 223. new_y_stride = s->linesize[0]; 224. new_cb_stride = s->linesize[1]; ^ 225. new_cr_stride = s->linesize[2]; 226. old_y = s->old_y; libavcodec/escape130.c:225:5: 223. new_y_stride = s->linesize[0]; 224. new_cb_stride = s->linesize[1]; 225. new_cr_stride = s->linesize[2]; ^ 226. old_y = s->old_y; 227. old_cb = s->old_u; libavcodec/escape130.c:226:5: 224. new_cb_stride = s->linesize[1]; 225. new_cr_stride = s->linesize[2]; 226. old_y = s->old_y; ^ 227. old_cb = s->old_u; 228. old_cr = s->old_v; libavcodec/escape130.c:227:5: 225. new_cr_stride = s->linesize[2]; 226. old_y = s->old_y; 227. old_cb = s->old_u; ^ 228. old_cr = s->old_v; 229. old_y_stride = s->linesize[0]; libavcodec/escape130.c:228:5: 226. old_y = s->old_y; 227. old_cb = s->old_u; 228. old_cr = s->old_v; ^ 229. old_y_stride = s->linesize[0]; 230. old_cb_stride = s->linesize[1]; libavcodec/escape130.c:229:5: 227. old_cb = s->old_u; 228. old_cr = s->old_v; 229. old_y_stride = s->linesize[0]; ^ 230. old_cb_stride = s->linesize[1]; 231. old_cr_stride = s->linesize[2]; libavcodec/escape130.c:230:5: 228. old_cr = s->old_v; 229. old_y_stride = s->linesize[0]; 230. old_cb_stride = s->linesize[1]; ^ 231. old_cr_stride = s->linesize[2]; 232. libavcodec/escape130.c:231:5: 229. old_y_stride = s->linesize[0]; 230. old_cb_stride = s->linesize[1]; 231. old_cr_stride = s->linesize[2]; ^ 232. 233. for (block_index = 0; block_index < total_blocks; block_index++) { libavcodec/escape130.c:233:10: 231. old_cr_stride = s->linesize[2]; 232. 233. for (block_index = 0; block_index < total_blocks; block_index++) { ^ 234. // Note that this call will make us skip the rest of the blocks 235. // if the frame ends prematurely. libavcodec/escape130.c:233:27: Loop condition is true. Entering loop body 231. old_cr_stride = s->linesize[2]; 232. 233. for (block_index = 0; block_index < total_blocks; block_index++) { ^ 234. // Note that this call will make us skip the rest of the blocks 235. // if the frame ends prematurely. libavcodec/escape130.c:236:13: Taking true branch 234. // Note that this call will make us skip the rest of the blocks 235. // if the frame ends prematurely. 236. if (skip == -1) ^ 237. skip = decode_skip_count(&gb); 238. if (skip == -1) { libavcodec/escape130.c:237:13: 235. // if the frame ends prematurely. 236. if (skip == -1) 237. skip = decode_skip_count(&gb); ^ 238. if (skip == -1) { 239. av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\n"); libavcodec/escape130.c:165:1: start of procedure decode_skip_count() 163. } 164. 165. static int decode_skip_count(GetBitContext* gb) ^ 166. { 167. int value; libavcodec/escape130.c:169:5: 167. int value; 168. 169. value = get_bits1(gb); ^ 170. if (value) 171. return 0; libavcodec/get_bits.h:271:1: start of procedure get_bits1() 269. } 270. 271. static inline unsigned int get_bits1(GetBitContext *s) ^ 272. { 273. unsigned int index = s->index; libavcodec/get_bits.h:273:5: 271. static inline unsigned int get_bits1(GetBitContext *s) 272. { 273. unsigned int index = s->index; ^ 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:274:5: 272. { 273. unsigned int index = s->index; 274. uint8_t result = s->buffer[index >> 3]; ^ 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7;
https://github.com/libav/libav/blob/ed50673066956d6f2201a57c3254569f2ab08d9d/libavcodec/escape130.c/#L237
d2a_code_trace_data_41666
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:494: error: Integer Overflow L2 ([1, +oo] - 8):unsigned32 by call to `bitstream_read`. libavcodec/wavpack.c:494:27: Call 492. S = bitstream_read(&s->bc_extra_bits, 23); 493. if (s->float_max_exp >= 25) 494. exp = bitstream_read(&s->bc_extra_bits, 8); ^ 495. sign = bitstream_read_bit(&s->bc_extra_bits); 496. } else { 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] - 8):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_41667
static int JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) { if (data->bufferbytesleft==0) { uint32 m; if (data->filebytesleft==0) return(0); if (!data->filepositioned) { TIFFSeekFile(data->tif,data->fileoffset,SEEK_SET); data->filepositioned=1; } m=data->buffersize; if ((uint64)m>data->filebytesleft) m=(uint32)data->filebytesleft; assert(m<0x80000000UL); if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) return(0); data->buffercurrentbyte=data->buffer; data->bufferbytesleft=m; data->fileoffset+=m; data->filebytesleft-=m; } *result=*data->buffercurrentbyte; data->buffercurrentbyte++; data->bufferbytesleft--; return(1); } libtiff/tif_jpeg.c:881: error: Integer Overflow L2 ([0, max(2147483647, `data->bufferbytesleft`)] - 1):unsigned32. libtiff/tif_jpeg.c:855:1: <LHS trace> 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:855:1: Parameter `data->bufferbytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:881:2: Binary operation: ([0, max(2147483647, data->bufferbytesleft)] - 1):unsigned32 879. *result=*data->buffercurrentbyte; 880. data->buffercurrentbyte++; 881. data->bufferbytesleft--; ^ 882. return(1); 883. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L881
d2a_code_trace_data_41668
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/ssl_cert.c:754: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 3]):unsigned64 by call to `WPACKET_sub_allocate_bytes__`. Showing all 12 steps of the trace ssl/ssl_cert.c:744:1: Parameter `pkt->written` 742. 743. /* Add a certificate to the WPACKET */ 744. > static int ssl_add_cert_to_buf(WPACKET *pkt, X509 *x) 745. { 746. int len; ssl/ssl_cert.c:754:10: Call 752. return 0; 753. } 754. if (!WPACKET_sub_allocate_bytes_u24(pkt, len, &outbytes) ^ 755. || i2d_X509(x, &outbytes) != len) { 756. SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_INTERNAL_ERROR); ssl/packet.c:28:10: Call 26. unsigned char **allocbytes, size_t lenbytes) 27. { 28. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 29. || !WPACKET_allocate_bytes(pkt, len, allocbytes) 30. || !WPACKET_close(pkt)) ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:29:17: Call 27. { 28. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 29. || !WPACKET_allocate_bytes(pkt, len, allocbytes) ^ 30. || !WPACKET_close(pkt)) 31. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 3]):unsigned64 by call to `WPACKET_sub_allocate_bytes__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_41669
int opt_verify(int opt, X509_VERIFY_PARAM *vpm) { int i; ossl_intmax_t t = 0; ASN1_OBJECT *otmp; X509_PURPOSE *xptmp; const X509_VERIFY_PARAM *vtmp; assert(vpm != NULL); assert(opt > OPT_V__FIRST); assert(opt < OPT_V__LAST); switch ((enum range)opt) { case OPT_V__FIRST: case OPT_V__LAST: return 0; case OPT_V_POLICY: otmp = OBJ_txt2obj(opt_arg(), 0); if (otmp == NULL) { BIO_printf(bio_err, "%s: Invalid Policy %s\n", prog, opt_arg()); return 0; } X509_VERIFY_PARAM_add0_policy(vpm, otmp); break; case OPT_V_PURPOSE: i = X509_PURPOSE_get_by_sname(opt_arg()); if (i < 0) { BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); return 0; } xptmp = X509_PURPOSE_get0(i); i = X509_PURPOSE_get_id(xptmp); if (!X509_VERIFY_PARAM_set_purpose(vpm, i)) { BIO_printf(bio_err, "%s: Internal error setting purpose %s\n", prog, opt_arg()); return 0; } break; case OPT_V_VERIFY_NAME: vtmp = X509_VERIFY_PARAM_lookup(opt_arg()); if (vtmp == NULL) { BIO_printf(bio_err, "%s: Invalid verify name %s\n", prog, opt_arg()); return 0; } X509_VERIFY_PARAM_set1(vpm, vtmp); break; case OPT_V_VERIFY_DEPTH: i = atoi(opt_arg()); if (i >= 0) X509_VERIFY_PARAM_set_depth(vpm, i); break; case OPT_V_ATTIME: if (!opt_imax(opt_arg(), &t)) return 0; if (t != (time_t)t) { BIO_printf(bio_err, "%s: epoch time out of range %s\n", prog, opt_arg()); return 0; } X509_VERIFY_PARAM_set_time(vpm, (time_t)t); break; case OPT_V_VERIFY_HOSTNAME: if (!X509_VERIFY_PARAM_set1_host(vpm, opt_arg(), 0)) return 0; break; case OPT_V_VERIFY_EMAIL: if (!X509_VERIFY_PARAM_set1_email(vpm, opt_arg(), 0)) return 0; break; case OPT_V_VERIFY_IP: if (!X509_VERIFY_PARAM_set1_ip_asc(vpm, opt_arg())) return 0; break; case OPT_V_IGNORE_CRITICAL: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_IGNORE_CRITICAL); break; case OPT_V_ISSUER_CHECKS: break; case OPT_V_CRL_CHECK: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CRL_CHECK); break; case OPT_V_CRL_CHECK_ALL: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); break; case OPT_V_POLICY_CHECK: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_POLICY_CHECK); break; case OPT_V_EXPLICIT_POLICY: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_EXPLICIT_POLICY); break; case OPT_V_INHIBIT_ANY: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_INHIBIT_ANY); break; case OPT_V_INHIBIT_MAP: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_INHIBIT_MAP); break; case OPT_V_X509_STRICT: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_X509_STRICT); break; case OPT_V_EXTENDED_CRL: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_EXTENDED_CRL_SUPPORT); break; case OPT_V_USE_DELTAS: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_DELTAS); break; case OPT_V_POLICY_PRINT: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NOTIFY_POLICY); break; case OPT_V_CHECK_SS_SIG: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CHECK_SS_SIGNATURE); break; case OPT_V_TRUSTED_FIRST: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_TRUSTED_FIRST); break; case OPT_V_SUITEB_128_ONLY: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_128_LOS_ONLY); break; case OPT_V_SUITEB_128: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_128_LOS); break; case OPT_V_SUITEB_192: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_192_LOS); break; case OPT_V_PARTIAL_CHAIN: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_PARTIAL_CHAIN); break; case OPT_V_NO_ALT_CHAINS: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_ALT_CHAINS); break; case OPT_V_NO_CHECK_TIME: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_CHECK_TIME); break; } return 1; } apps/opt.c:506: error: NULL_DEREFERENCE pointer `xptmp` last assigned on line 503 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 506, column 13. Showing all 31 steps of the trace apps/opt.c:470:1: start of procedure opt_verify() 468. enum range { OPT_V_ENUM }; 469. 470. > int opt_verify(int opt, X509_VERIFY_PARAM *vpm) 471. { 472. int i; apps/opt.c:473:5: 471. { 472. int i; 473. > ossl_intmax_t t = 0; 474. ASN1_OBJECT *otmp; 475. X509_PURPOSE *xptmp; apps/opt.c:478:5: Condition is true 476. const X509_VERIFY_PARAM *vtmp; 477. 478. assert(vpm != NULL); ^ 479. assert(opt > OPT_V__FIRST); 480. assert(opt < OPT_V__LAST); apps/opt.c:479:5: Condition is true 477. 478. assert(vpm != NULL); 479. assert(opt > OPT_V__FIRST); ^ 480. assert(opt < OPT_V__LAST); 481. apps/opt.c:480:5: Condition is true 478. assert(vpm != NULL); 479. assert(opt > OPT_V__FIRST); 480. assert(opt < OPT_V__LAST); ^ 481. 482. switch ((enum range)opt) { apps/opt.c:482:5: 480. assert(opt < OPT_V__LAST); 481. 482. > switch ((enum range)opt) { 483. case OPT_V__FIRST: 484. case OPT_V__LAST: apps/opt.c:483:5: Switch condition is false. Skipping switch case 481. 482. switch ((enum range)opt) { 483. case OPT_V__FIRST: ^ 484. case OPT_V__LAST: 485. return 0; apps/opt.c:484:5: Switch condition is false. Skipping switch case 482. switch ((enum range)opt) { 483. case OPT_V__FIRST: 484. case OPT_V__LAST: ^ 485. return 0; 486. case OPT_V_POLICY: apps/opt.c:486:5: Switch condition is false. Skipping switch case 484. case OPT_V__LAST: 485. return 0; 486. case OPT_V_POLICY: ^ 487. otmp = OBJ_txt2obj(opt_arg(), 0); 488. if (otmp == NULL) { apps/opt.c:494:5: Switch condition is true. Entering switch case 492. X509_VERIFY_PARAM_add0_policy(vpm, otmp); 493. break; 494. case OPT_V_PURPOSE: ^ 495. /* purpose name -> purpose index */ 496. i = X509_PURPOSE_get_by_sname(opt_arg()); apps/opt.c:496:9: 494. case OPT_V_PURPOSE: 495. /* purpose name -> purpose index */ 496. > i = X509_PURPOSE_get_by_sname(opt_arg()); 497. if (i < 0) { 498. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); apps/opt.c:775:1: start of procedure opt_arg() 773. 774. /* Return the most recent flag parameter. */ 775. > char *opt_arg(void) 776. { 777. return arg; apps/opt.c:777:5: 775. char *opt_arg(void) 776. { 777. > return arg; 778. } 779. apps/opt.c:778:1: return from a call to opt_arg 776. { 777. return arg; 778. > } 779. 780. /* Return the most recent flag. */ apps/opt.c:496:9: Skipping X509_PURPOSE_get_by_sname(): empty list of specs 494. case OPT_V_PURPOSE: 495. /* purpose name -> purpose index */ 496. i = X509_PURPOSE_get_by_sname(opt_arg()); ^ 497. if (i < 0) { 498. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); apps/opt.c:497:13: Taking false branch 495. /* purpose name -> purpose index */ 496. i = X509_PURPOSE_get_by_sname(opt_arg()); 497. if (i < 0) { ^ 498. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); 499. return 0; apps/opt.c:503:9: 501. 502. /* purpose index -> purpose object */ 503. > xptmp = X509_PURPOSE_get0(i); 504. 505. /* purpose object -> purpose value */ crypto/x509v3/v3_purp.c:162:1: start of procedure X509_PURPOSE_get0() 160. } 161. 162. > X509_PURPOSE *X509_PURPOSE_get0(int idx) 163. { 164. if (idx < 0) crypto/x509v3/v3_purp.c:164:9: Taking false branch 162. X509_PURPOSE *X509_PURPOSE_get0(int idx) 163. { 164. if (idx < 0) ^ 165. return NULL; 166. if (idx < (int)X509_PURPOSE_COUNT) crypto/x509v3/v3_purp.c:166:9: Taking false branch 164. if (idx < 0) 165. return NULL; 166. if (idx < (int)X509_PURPOSE_COUNT) ^ 167. return xstandard + idx; 168. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); crypto/x509v3/v3_purp.c:168:5: 166. if (idx < (int)X509_PURPOSE_COUNT) 167. return xstandard + idx; 168. > return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); 169. } 170. include/openssl/x509v3.h:499:1: start of procedure sk_X509_PURPOSE_value() 497. # define X509V3_ADD_SILENT 0x10 498. 499. > DEFINE_STACK_OF(X509_PURPOSE) 500. 501. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) crypto/stack/stack.c:323:1: start of procedure sk_value() 321. } 322. 323. > void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:325:10: Taking true branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:326:9: 324. { 325. if (!st || (i < 0) || (i >= st->num)) 326. > return NULL; 327. return st->data[i]; 328. } crypto/stack/stack.c:328:1: return from a call to sk_value 326. return NULL; 327. return st->data[i]; 328. > } 329. 330. void *sk_set(_STACK *st, int i, void *value) include/openssl/x509v3.h:499:1: return from a call to sk_X509_PURPOSE_value 497. # define X509V3_ADD_SILENT 0x10 498. 499. > DEFINE_STACK_OF(X509_PURPOSE) 500. 501. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) crypto/x509v3/v3_purp.c:169:1: return from a call to X509_PURPOSE_get0 167. return xstandard + idx; 168. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); 169. > } 170. 171. int X509_PURPOSE_get_by_sname(char *sname) apps/opt.c:506:9: 504. 505. /* purpose object -> purpose value */ 506. > i = X509_PURPOSE_get_id(xptmp); 507. 508. if (!X509_VERIFY_PARAM_set_purpose(vpm, i)) { crypto/x509v3/v3_purp.c:281:1: start of procedure X509_PURPOSE_get_id() 279. } 280. 281. > int X509_PURPOSE_get_id(X509_PURPOSE *xp) 282. { 283. return xp->purpose; crypto/x509v3/v3_purp.c:283:5: 281. int X509_PURPOSE_get_id(X509_PURPOSE *xp) 282. { 283. > return xp->purpose; 284. } 285.
https://github.com/openssl/openssl/blob/507c7c0ed6cbecbe16114dbbbb9fecc5ce5863a4/apps/opt.c/#L506
d2a_code_trace_data_41670
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) { int len = strlen(dst); va_list vl; va_start(vl, fmt); len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); va_end(vl); return len; } ffserver.c:2666: error: Integer Overflow R2 ([0, +oo] + [0, +oo]):signed32 by call to `avf_sdp_create`. ffserver.c:2657:18: Unknown value from: inet_ntoa 2655. if (stream->is_multicast) { 2656. snprintf(avc->filename, 1024, "rtp://%s:%d?multicast=1?ttl=%d", 2657. inet_ntoa(stream->multicast_ip), ^ 2658. stream->multicast_port, stream->multicast_ttl); 2659. } ffserver.c:2666:5: Call 2664. } 2665. *pbuffer = av_mallocz(2048); 2666. avf_sdp_create(&avc, 1, *pbuffer, 2048); ^ 2667. av_free(avc); 2668. libavformat/sdp.c:277:1: Parameter `buff->strlen` 275. } 276. 277. int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) ^ 278. { 279. struct sdp_session_level s; libavformat/sdp.c:298:5: Call 296. } 297. } 298. sdp_write_header(buff, size, &s); ^ 299. 300. dst[0] = 0; libavformat/sdp.c:56:1: Parameter `buff->strlen` 54. } 55. 56. static void sdp_write_header(char *buff, int size, struct sdp_session_level *s) ^ 57. { 58. av_strlcatf(buff, size, "v=%d\r\n" libavformat/sdp.c:67:5: Call 65. s->start_time, s->end_time, 66. s->name[0] ? s->name : "No Name"); 67. dest_write(buff, size, s->dst_addr, s->ttl); ^ 68. } 69. libavformat/sdp.c:45:1: Parameter `buff->strlen` 43. }; 44. 45. static void dest_write(char *buff, int size, const char *dest_addr, int ttl) ^ 46. { 47. if (dest_addr) { libavformat/sdp.c:49:13: Call 47. if (dest_addr) { 48. if (ttl > 0) { 49. av_strlcatf(buff, size, "c=IN IP4 %s/%d\r\n", dest_addr, ttl); ^ 50. } else { 51. av_strlcatf(buff, size, "c=IN IP4 %s\r\n", dest_addr); libavutil/string.c:68:1: <LHS trace> 66. } 67. 68. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 69. { 70. int len = strlen(dst); libavutil/string.c:68:1: Parameter `size` 66. } 67. 68. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 69. { 70. int len = strlen(dst); libavutil/string.c:74:12: <RHS trace> 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76. libavutil/string.c:74:12: Risky value from: vsnprintf 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76. libavutil/string.c:74:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `avf_sdp_create` 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavutil/string.c/#L74
d2a_code_trace_data_41671
int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), int (*cmp_func) (const char *, const char *), void (*free_func) (const char *, int, const char *)) { int ret; int i; NAME_FUNCS *name_funcs; if (name_funcs_stack == NULL) { CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); name_funcs_stack = sk_NAME_FUNCS_new_null(); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); } if (name_funcs_stack == NULL) { return (0); } ret = names_type_num; names_type_num++; for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); if (name_funcs == NULL) { OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); return (0); } name_funcs->hash_func = lh_strhash; name_funcs->cmp_func = OPENSSL_strcmp; CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); } name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); if (hash_func != NULL) name_funcs->hash_func = hash_func; if (cmp_func != NULL) name_funcs->cmp_func = cmp_func; if (free_func != NULL) name_funcs->free_func = free_func; return (ret); } crypto/objects/o_names.c:99: error: NULL_DEREFERENCE pointer `name_funcs` last assigned on line 97 could be null and is dereferenced at line 99, column 9. Showing all 181 steps of the trace crypto/objects/o_names.c:64:1: start of procedure OBJ_NAME_new_index() 62. } 63. 64. > int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), 65. int (*cmp_func) (const char *, const char *), 66. void (*free_func) (const char *, int, const char *)) crypto/objects/o_names.c:72:9: Taking true branch 70. NAME_FUNCS *name_funcs; 71. 72. if (name_funcs_stack == NULL) { ^ 73. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 74. name_funcs_stack = sk_NAME_FUNCS_new_null(); crypto/objects/o_names.c:73:9: 71. 72. if (name_funcs_stack == NULL) { 73. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 74. name_funcs_stack = sk_NAME_FUNCS_new_null(); 75. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:74:9: 72. if (name_funcs_stack == NULL) { 73. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 74. > name_funcs_stack = sk_NAME_FUNCS_new_null(); 75. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 76. } crypto/objects/o_names.h:4:1: start of procedure sk_NAME_FUNCS_new_null() 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) crypto/objects/o_names.h:4:1: return from a call to sk_NAME_FUNCS_new_null 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/objects/o_names.c:75:9: 73. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 74. name_funcs_stack = sk_NAME_FUNCS_new_null(); 75. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 76. } 77. if (name_funcs_stack == NULL) { crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:77:9: Taking false branch 75. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 76. } 77. if (name_funcs_stack == NULL) { ^ 78. /* ERROR */ 79. return (0); crypto/objects/o_names.c:81:5: 79. return (0); 80. } 81. > ret = names_type_num; 82. names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { crypto/objects/o_names.c:82:5: 80. } 81. ret = names_type_num; 82. > names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); crypto/objects/o_names.c:83:10: 81. ret = names_type_num; 82. names_type_num++; 83. > for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); crypto/objects/o_names.h:4:1: start of procedure sk_NAME_FUNCS_num() 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) 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/objects/o_names.h:4:1: return from a call to sk_NAME_FUNCS_num 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/objects/o_names.c:83:51: Loop condition is true. Entering loop body 81. ret = names_type_num; 82. names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { ^ 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); crypto/objects/o_names.c:84:9: 82. names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:85:9: 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. > name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 87. if (name_funcs == 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/objects/o_names.c:86:9: 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 87. if (name_funcs == NULL) { 88. OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:87:13: Taking false branch 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 87. if (name_funcs == NULL) { ^ 88. OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); 89. return (0); crypto/objects/o_names.c:91:9: 89. return (0); 90. } 91. > name_funcs->hash_func = lh_strhash; 92. name_funcs->cmp_func = OPENSSL_strcmp; 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); crypto/objects/o_names.c:92:9: 90. } 91. name_funcs->hash_func = lh_strhash; 92. > name_funcs->cmp_func = OPENSSL_strcmp; 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); crypto/objects/o_names.c:93:9: 91. name_funcs->hash_func = lh_strhash; 92. name_funcs->cmp_func = OPENSSL_strcmp; 93. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); 95. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:94:9: 92. name_funcs->cmp_func = OPENSSL_strcmp; 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. > sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); 95. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 96. } crypto/objects/o_names.h:4:1: start of procedure sk_NAME_FUNCS_push() 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/stack/stack.c:259:1: start of procedure sk_push() 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:5: 259. int sk_push(_STACK *st, void *data) 260. { 261. > return (sk_insert(st, data, st->num)); 262. } 263. crypto/stack/stack.c:167:1: start of procedure sk_insert() 165. } 166. 167. > int sk_insert(_STACK *st, void *data, int loc) 168. { 169. char **s; crypto/stack/stack.c:171:9: Taking false branch 169. char **s; 170. 171. if (st == NULL) ^ 172. return 0; 173. if (st->num_alloc <= st->num + 1) { crypto/stack/stack.c:173:9: Taking false branch 171. if (st == NULL) 172. return 0; 173. if (st->num_alloc <= st->num + 1) { ^ 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); crypto/stack/stack.c:181:10: Taking true branch 179. st->num_alloc *= 2; 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) ^ 182. st->data[st->num] = data; 183. else { crypto/stack/stack.c:182:9: 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) 182. > st->data[st->num] = data; 183. else { 184. memmove(&(st->data[loc + 1]), crypto/stack/stack.c:188:5: 186. st->data[loc] = data; 187. } 188. > st->num++; 189. st->sorted = 0; 190. return (st->num); crypto/stack/stack.c:189:5: 187. } 188. st->num++; 189. > st->sorted = 0; 190. return (st->num); 191. } crypto/stack/stack.c:190:5: 188. st->num++; 189. st->sorted = 0; 190. > return (st->num); 191. } 192. crypto/stack/stack.c:191:1: return from a call to sk_insert 189. st->sorted = 0; 190. return (st->num); 191. > } 192. 193. void *sk_delete_ptr(_STACK *st, void *p) crypto/stack/stack.c:262:1: return from a call to sk_push 260. { 261. return (sk_insert(st, data, st->num)); 262. > } 263. 264. int sk_unshift(_STACK *st, void *data) crypto/objects/o_names.h:4:1: return from a call to sk_NAME_FUNCS_push 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/objects/o_names.c:95:9: 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); 95. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 96. } 97. name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:83:71: 81. ret = names_type_num; 82. names_type_num++; 83. > for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); crypto/objects/o_names.c:83:51: Loop condition is true. Entering loop body 81. ret = names_type_num; 82. names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { ^ 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); crypto/objects/o_names.c:84:9: 82. names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:85:9: 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. > name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 87. if (name_funcs == 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/objects/o_names.c:86:9: 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 87. if (name_funcs == NULL) { 88. OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:87:13: Taking false branch 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); 86. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 87. if (name_funcs == NULL) { ^ 88. OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); 89. return (0); crypto/objects/o_names.c:91:9: 89. return (0); 90. } 91. > name_funcs->hash_func = lh_strhash; 92. name_funcs->cmp_func = OPENSSL_strcmp; 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); crypto/objects/o_names.c:92:9: 90. } 91. name_funcs->hash_func = lh_strhash; 92. > name_funcs->cmp_func = OPENSSL_strcmp; 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); crypto/objects/o_names.c:93:9: 91. name_funcs->hash_func = lh_strhash; 92. name_funcs->cmp_func = OPENSSL_strcmp; 93. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); 95. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:94:9: 92. name_funcs->cmp_func = OPENSSL_strcmp; 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. > sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); 95. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 96. } crypto/objects/o_names.h:4:1: start of procedure sk_NAME_FUNCS_push() 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/stack/stack.c:259:1: start of procedure sk_push() 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:5: 259. int sk_push(_STACK *st, void *data) 260. { 261. > return (sk_insert(st, data, st->num)); 262. } 263. crypto/stack/stack.c:167:1: start of procedure sk_insert() 165. } 166. 167. > int sk_insert(_STACK *st, void *data, int loc) 168. { 169. char **s; crypto/stack/stack.c:171:9: Taking false branch 169. char **s; 170. 171. if (st == NULL) ^ 172. return 0; 173. if (st->num_alloc <= st->num + 1) { crypto/stack/stack.c:173:9: Taking false branch 171. if (st == NULL) 172. return 0; 173. if (st->num_alloc <= st->num + 1) { ^ 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); crypto/stack/stack.c:181:10: Taking true branch 179. st->num_alloc *= 2; 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) ^ 182. st->data[st->num] = data; 183. else { crypto/stack/stack.c:182:9: 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) 182. > st->data[st->num] = data; 183. else { 184. memmove(&(st->data[loc + 1]), crypto/stack/stack.c:188:5: 186. st->data[loc] = data; 187. } 188. > st->num++; 189. st->sorted = 0; 190. return (st->num); crypto/stack/stack.c:189:5: 187. } 188. st->num++; 189. > st->sorted = 0; 190. return (st->num); 191. } crypto/stack/stack.c:190:5: 188. st->num++; 189. st->sorted = 0; 190. > return (st->num); 191. } 192. crypto/stack/stack.c:191:1: return from a call to sk_insert 189. st->sorted = 0; 190. return (st->num); 191. > } 192. 193. void *sk_delete_ptr(_STACK *st, void *p) crypto/stack/stack.c:262:1: return from a call to sk_push 260. { 261. return (sk_insert(st, data, st->num)); 262. > } 263. 264. int sk_unshift(_STACK *st, void *data) crypto/objects/o_names.h:4:1: return from a call to sk_NAME_FUNCS_push 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/objects/o_names.c:95:9: 93. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 94. sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); 95. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 96. } 97. name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); crypto/mem_dbg.c:206:1: start of procedure CRYPTO_mem_ctrl() 204. #endif 205. 206. > int CRYPTO_mem_ctrl(int mode) 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:209:5: 207. { 208. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 209. > return mode - mode; 210. #else 211. int ret = mh_mode; crypto/mem_dbg.c:275:1: return from a call to CRYPTO_mem_ctrl 273. return (ret); 274. #endif 275. > } 276. 277. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/objects/o_names.c:83:71: 81. ret = names_type_num; 82. names_type_num++; 83. > for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); crypto/objects/o_names.c:83:51: Loop condition is false. Leaving loop 81. ret = names_type_num; 82. names_type_num++; 83. for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) { ^ 84. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 85. name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); crypto/objects/o_names.c:97:5: 95. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); 96. } 97. > name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); 98. if (hash_func != NULL) 99. name_funcs->hash_func = hash_func; crypto/objects/o_names.h:4:1: start of procedure sk_NAME_FUNCS_value() 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/stack/stack.c:324:1: start of procedure sk_value() 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:326:10: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:17: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:28: Taking true branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:327:9: 325. { 326. if (!st || (i < 0) || (i >= st->num)) 327. > return NULL; 328. return st->data[i]; 329. } crypto/stack/stack.c:329:1: return from a call to sk_value 327. return NULL; 328. return st->data[i]; 329. > } 330. 331. void *sk_set(_STACK *st, int i, void *value) crypto/objects/o_names.h:4:1: return from a call to sk_NAME_FUNCS_value 2. 3. typedef struct name_funcs_st NAME_FUNCS; 4. > DEFINE_STACK_OF(NAME_FUNCS) crypto/objects/o_names.c:98:9: Taking true branch 96. } 97. name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); 98. if (hash_func != NULL) ^ 99. name_funcs->hash_func = hash_func; 100. if (cmp_func != NULL) crypto/objects/o_names.c:99:9: 97. name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); 98. if (hash_func != NULL) 99. > name_funcs->hash_func = hash_func; 100. if (cmp_func != NULL) 101. name_funcs->cmp_func = cmp_func;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/objects/o_names.c/#L99
d2a_code_trace_data_41672
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/apps.c:257: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/apps.c:257:9: Call 255. char *p; 256. 257. p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0); ^ 258. BIO_puts(out, "subject="); 259. BIO_puts(out, p); crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:104:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_41673
static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; if (!ff_network_init()) return AVERROR(EIO); content = av_malloc(SDP_MAX_SIZE); size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; err = ff_sdp_parse(s, content); av_free(content); if (err) goto fail; for (i = 0; i < rt->nb_rtsp_streams; i++) { char namebuf[50]; rtsp_st = rt->rtsp_streams[i]; getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: ff_rtsp_close_streams(s); ff_network_close(); return err; } libavformat/rtsp.c:1797: error: Null Dereference pointer `content` last assigned on line 1791 could be null and is dereferenced at line 1797, column 5. libavformat/rtsp.c:1778:1: start of procedure sdp_read_header() 1776. } 1777. 1778. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) ^ 1779. { 1780. RTSPState *rt = s->priv_data; libavformat/rtsp.c:1780:5: 1778. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) 1779. { 1780. RTSPState *rt = s->priv_data; ^ 1781. RTSPStream *rtsp_st; 1782. int size, i, err; libavformat/rtsp.c:1786:10: 1784. char url[1024]; 1785. 1786. if (!ff_network_init()) ^ 1787. return AVERROR(EIO); 1788. libavformat/network.h:49:1: start of procedure ff_network_init() 47. int ff_socket_nonblock(int socket, int enable); 48. 49. static inline int ff_network_init(void) ^ 50. { 51. #if HAVE_WINSOCK2_H libavformat/network.h:56:5: 54. return 0; 55. #endif 56. return 1; ^ 57. } 58. libavformat/network.h:57:1: return from a call to ff_network_init 55. #endif 56. return 1; 57. } ^ 58. 59. static inline void ff_network_close(void) libavformat/rtsp.c:1786:10: Taking false branch 1784. char url[1024]; 1785. 1786. if (!ff_network_init()) ^ 1787. return AVERROR(EIO); 1788. libavformat/rtsp.c:1791:5: 1789. /* read the whole sdp file */ 1790. /* XXX: better loading */ 1791. content = av_malloc(SDP_MAX_SIZE); ^ 1792. size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); 1793. if (size <= 0) { 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 true 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:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(16,size); 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/rtsp.c:1792:5: Skipping get_buffer(): empty list of specs 1790. /* XXX: better loading */ 1791. content = av_malloc(SDP_MAX_SIZE); 1792. size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); ^ 1793. if (size <= 0) { 1794. av_free(content); libavformat/rtsp.c:1793:9: Taking false branch 1791. content = av_malloc(SDP_MAX_SIZE); 1792. size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); 1793. if (size <= 0) { ^ 1794. av_free(content); 1795. return AVERROR_INVALIDDATA; libavformat/rtsp.c:1797:5: 1795. return AVERROR_INVALIDDATA; 1796. } 1797. content[size] ='\0'; ^ 1798. 1799. err = ff_sdp_parse(s, content);
https://github.com/libav/libav/blob/87e4d9b252bc6fa3b982f7050013069c9dc3e05b/libavformat/rtsp.c/#L1797
d2a_code_trace_data_41674
static int get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **chain) { X509_STORE_CTX *store_ctx = NULL; STACK_OF(X509) *chn = NULL; int i = 0; store_ctx = X509_STORE_CTX_new(); if (store_ctx == NULL) { i = X509_V_ERR_UNSPECIFIED; goto end; } if (!X509_STORE_CTX_init(store_ctx, store, cert, NULL)) { i = X509_V_ERR_UNSPECIFIED; goto end; } if (X509_verify_cert(store_ctx) > 0) chn = X509_STORE_CTX_get1_chain(store_ctx); else if ((i = X509_STORE_CTX_get_error(store_ctx)) == 0) i = X509_V_ERR_UNSPECIFIED; end: X509_STORE_CTX_free(store_ctx); *chain = chn; return i; } apps/pkcs12.c:766: error: MEMORY_LEAK memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 749, column 17 is not reachable after line 766, column 5. Showing all 76 steps of the trace apps/pkcs12.c:742:1: start of procedure get_cert_chain() 740. /* Given a single certificate return a verified chain or NULL if error */ 741. 742. > static int get_cert_chain(X509 *cert, X509_STORE *store, 743. STACK_OF(X509) **chain) 744. { apps/pkcs12.c:745:5: 743. STACK_OF(X509) **chain) 744. { 745. > X509_STORE_CTX *store_ctx = NULL; 746. STACK_OF(X509) *chn = NULL; 747. int i = 0; apps/pkcs12.c:746:5: 744. { 745. X509_STORE_CTX *store_ctx = NULL; 746. > STACK_OF(X509) *chn = NULL; 747. int i = 0; 748. apps/pkcs12.c:747:5: 745. X509_STORE_CTX *store_ctx = NULL; 746. STACK_OF(X509) *chn = NULL; 747. > int i = 0; 748. 749. store_ctx = X509_STORE_CTX_new(); apps/pkcs12.c:749:5: 747. int i = 0; 748. 749. > store_ctx = X509_STORE_CTX_new(); 750. if (store_ctx == NULL) { 751. i = X509_V_ERR_UNSPECIFIED; crypto/x509/x509_vfy.c:2151:1: start of procedure X509_STORE_CTX_new() 2149. } 2150. 2151. > X509_STORE_CTX *X509_STORE_CTX_new(void) 2152. { 2153. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); crypto/x509/x509_vfy.c:2153:5: 2151. X509_STORE_CTX *X509_STORE_CTX_new(void) 2152. { 2153. > X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2154. 2155. if (ctx == NULL) { crypto/mem.c:221:1: start of procedure CRYPTO_zalloc() 219. } 220. 221. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 222. { 223. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:223:5: 221. void *CRYPTO_zalloc(size_t num, const char *file, int line) 222. { 223. > void *ret = CRYPTO_malloc(num, file, line); 224. 225. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:5: 202. 203. FAILTEST(); 204. > allow_customize = 0; 205. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 206. if (call_malloc_debug) { crypto/mem.c:214:5: 212. } 213. #else 214. > (void)(file); (void)(line); 215. ret = malloc(num); 216. #endif crypto/mem.c:214:19: 212. } 213. #else 214. > (void)(file); (void)(line); 215. ret = malloc(num); 216. #endif crypto/mem.c:215:5: 213. #else 214. (void)(file); (void)(line); 215. > ret = malloc(num); 216. #endif 217. crypto/mem.c:218:5: 216. #endif 217. 218. > return ret; 219. } 220. crypto/mem.c:219:1: return from a call to CRYPTO_malloc 217. 218. return ret; 219. > } 220. 221. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:226:9: Taking true branch 224. 225. FAILTEST(); 226. if (ret != NULL) ^ 227. memset(ret, 0, num); 228. return ret; crypto/mem.c:227:9: 225. FAILTEST(); 226. if (ret != NULL) 227. > memset(ret, 0, num); 228. return ret; 229. } crypto/mem.c:228:5: 226. if (ret != NULL) 227. memset(ret, 0, num); 228. > return ret; 229. } 230. crypto/mem.c:229:1: return from a call to CRYPTO_zalloc 227. memset(ret, 0, num); 228. return ret; 229. > } 230. 231. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2155:9: Taking false branch 2153. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2154. 2155. if (ctx == NULL) { ^ 2156. X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE); 2157. return NULL; crypto/x509/x509_vfy.c:2159:5: 2157. return NULL; 2158. } 2159. > return ctx; 2160. } 2161. crypto/x509/x509_vfy.c:2160:1: return from a call to X509_STORE_CTX_new 2158. } 2159. return ctx; 2160. > } 2161. 2162. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) apps/pkcs12.c:750:9: Taking false branch 748. 749. store_ctx = X509_STORE_CTX_new(); 750. if (store_ctx == NULL) { ^ 751. i = X509_V_ERR_UNSPECIFIED; 752. goto end; apps/pkcs12.c:754:10: Taking false branch 752. goto end; 753. } 754. if (!X509_STORE_CTX_init(store_ctx, store, cert, NULL)) { ^ 755. i = X509_V_ERR_UNSPECIFIED; 756. goto end; apps/pkcs12.c:760:9: 758. 759. 760. > if (X509_verify_cert(store_ctx) > 0) 761. chn = X509_STORE_CTX_get1_chain(store_ctx); 762. else if ((i = X509_STORE_CTX_get_error(store_ctx)) == 0) crypto/x509/x509_vfy.c:253:1: start of procedure X509_verify_cert() 251. } 252. 253. > int X509_verify_cert(X509_STORE_CTX *ctx) 254. { 255. SSL_DANE *dane = ctx->dane; crypto/x509/x509_vfy.c:255:5: 253. int X509_verify_cert(X509_STORE_CTX *ctx) 254. { 255. > SSL_DANE *dane = ctx->dane; 256. int ret; 257. crypto/x509/x509_vfy.c:258:9: Taking false branch 256. int ret; 257. 258. if (ctx->cert == NULL) { ^ 259. X509err(X509_F_X509_VERIFY_CERT, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY); 260. ctx->error = X509_V_ERR_INVALID_CALL; crypto/x509/x509_vfy.c:264:9: Taking false branch 262. } 263. 264. if (ctx->chain != NULL) { ^ 265. /* 266. * This X509_STORE_CTX has already been used to verify a cert. We crypto/x509/x509_vfy.c:278:10: 276. * the first entry is in place 277. */ 278. > if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); include/openssl/x509.h:99:1: start of procedure sk_X509_new_null() 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:112:1: start of procedure OPENSSL_sk_new_null() 110. } 111. 112. > OPENSSL_STACK *OPENSSL_sk_new_null(void) 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); crypto/stack/stack.c:114:5: Skipping OPENSSL_sk_new_reserve(): empty list of specs 112. OPENSSL_STACK *OPENSSL_sk_new_null(void) 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); ^ 115. } 116. crypto/stack/stack.c:115:1: return from a call to OPENSSL_sk_new_null 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); 115. > } 116. 117. OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c) include/openssl/x509.h:99:1: return from a call to sk_X509_new_null 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:278:10: Taking false branch 276. * the first entry is in place 277. */ 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || ^ 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); crypto/x509/x509_vfy.c:279:11: 277. */ 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. > (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. ctx->error = X509_V_ERR_OUT_OF_MEM; include/openssl/x509.h:99:1: start of procedure sk_X509_push() 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:321:1: start of procedure OPENSSL_sk_push() 319. } 320. 321. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) 322. { 323. if (st == NULL) crypto/stack/stack.c:323:9: Taking false branch 321. int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) 322. { 323. if (st == NULL) ^ 324. return -1; 325. return OPENSSL_sk_insert(st, data, st->num); crypto/stack/stack.c:325:5: 323. if (st == NULL) 324. return -1; 325. > return OPENSSL_sk_insert(st, data, st->num); 326. } 327. crypto/stack/stack.c:232:1: start of procedure OPENSSL_sk_insert() 230. } 231. 232. > int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) 233. { 234. if (st == NULL || st->num == max_nodes) crypto/stack/stack.c:234:9: Taking false branch 232. int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) 233. { 234. if (st == NULL || st->num == max_nodes) ^ 235. return 0; 236. crypto/stack/stack.c:234:23: Taking true branch 232. int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) 233. { 234. if (st == NULL || st->num == max_nodes) ^ 235. return 0; 236. crypto/stack/stack.c:235:9: 233. { 234. if (st == NULL || st->num == max_nodes) 235. > return 0; 236. 237. if (!sk_reserve(st, 1, 0)) crypto/stack/stack.c:250:1: return from a call to OPENSSL_sk_insert 248. st->sorted = 0; 249. return st->num; 250. > } 251. 252. static ossl_inline void *internal_delete(OPENSSL_STACK *st, int loc) crypto/stack/stack.c:326:1: return from a call to OPENSSL_sk_push 324. return -1; 325. return OPENSSL_sk_insert(st, data, st->num); 326. > } 327. 328. int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data) include/openssl/x509.h:99:1: return from a call to sk_X509_push 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:279:11: Taking true branch 277. */ 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. (!sk_X509_push(ctx->chain, ctx->cert))) { ^ 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. ctx->error = X509_V_ERR_OUT_OF_MEM; crypto/x509/x509_vfy.c:280:9: Skipping ERR_put_error(): empty list of specs 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); ^ 281. ctx->error = X509_V_ERR_OUT_OF_MEM; 282. return -1; crypto/x509/x509_vfy.c:281:9: 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. > ctx->error = X509_V_ERR_OUT_OF_MEM; 282. return -1; 283. } crypto/x509/x509_vfy.c:282:9: 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. ctx->error = X509_V_ERR_OUT_OF_MEM; 282. > return -1; 283. } 284. X509_up_ref(ctx->cert); crypto/x509/x509_vfy.c:305:1: return from a call to X509_verify_cert 303. ctx->error = X509_V_ERR_UNSPECIFIED; 304. return ret; 305. > } 306. 307. /* apps/pkcs12.c:760:9: Taking false branch 758. 759. 760. if (X509_verify_cert(store_ctx) > 0) ^ 761. chn = X509_STORE_CTX_get1_chain(store_ctx); 762. else if ((i = X509_STORE_CTX_get_error(store_ctx)) == 0) apps/pkcs12.c:762:14: 760. if (X509_verify_cert(store_ctx) > 0) 761. chn = X509_STORE_CTX_get1_chain(store_ctx); 762. > else if ((i = X509_STORE_CTX_get_error(store_ctx)) == 0) 763. i = X509_V_ERR_UNSPECIFIED; 764. crypto/x509/x509_vfy.c:2003:1: start of procedure X509_STORE_CTX_get_error() 2001. } 2002. 2003. > int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) 2004. { 2005. return ctx->error; crypto/x509/x509_vfy.c:2005:5: 2003. int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) 2004. { 2005. > return ctx->error; 2006. } 2007. crypto/x509/x509_vfy.c:2006:1: return from a call to X509_STORE_CTX_get_error 2004. { 2005. return ctx->error; 2006. > } 2007. 2008. void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int err) apps/pkcs12.c:762:14: Taking false branch 760. if (X509_verify_cert(store_ctx) > 0) 761. chn = X509_STORE_CTX_get1_chain(store_ctx); 762. else if ((i = X509_STORE_CTX_get_error(store_ctx)) == 0) ^ 763. i = X509_V_ERR_UNSPECIFIED; 764. apps/pkcs12.c:765:1: 763. i = X509_V_ERR_UNSPECIFIED; 764. 765. > end: 766. X509_STORE_CTX_free(store_ctx); 767. *chain = chn; apps/pkcs12.c:766:5: 764. 765. end: 766. > X509_STORE_CTX_free(store_ctx); 767. *chain = chn; 768. return i; crypto/x509/x509_vfy.c:2162:1: start of procedure X509_STORE_CTX_free() 2160. } 2161. 2162. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2163. { 2164. if (ctx == NULL) crypto/x509/x509_vfy.c:2164:9: Taking false branch 2162. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2163. { 2164. if (ctx == NULL) ^ 2165. return; 2166. crypto/x509/x509_vfy.c:2167:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs 2165. return; 2166. 2167. X509_STORE_CTX_cleanup(ctx); ^ 2168. OPENSSL_free(ctx); 2169. } crypto/x509/x509_vfy.c:2168:5: 2166. 2167. X509_STORE_CTX_cleanup(ctx); 2168. > OPENSSL_free(ctx); 2169. } 2170. crypto/mem.c:289:1: start of procedure CRYPTO_free() 287. } 288. 289. > void CRYPTO_free(void *str, const char *file, int line) 290. { 291. INCREMENT(free_count); crypto/mem.c:292:9: Taking true branch 290. { 291. INCREMENT(free_count); 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 293. free_impl(str, file, line); 294. return; crypto/mem.c:292:30: Taking true branch 290. { 291. INCREMENT(free_count); 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 293. free_impl(str, file, line); 294. return; crypto/mem.c:293:9: Skipping __function_pointer__(): unresolved function pointer 291. INCREMENT(free_count); 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { 293. free_impl(str, file, line); ^ 294. return; 295. } crypto/mem.c:294:9: 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { 293. free_impl(str, file, line); 294. > return; 295. } 296. crypto/mem.c:308:1: return from a call to CRYPTO_free 306. free(str); 307. #endif 308. > } 309. 310. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2169:1: return from a call to X509_STORE_CTX_free 2167. X509_STORE_CTX_cleanup(ctx); 2168. OPENSSL_free(ctx); 2169. > } 2170. 2171. int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
https://github.com/openssl/openssl/blob/dab2cd68e7cc304c9b1a4e7cee18a98711771a53/apps/pkcs12.c/#L766
d2a_code_trace_data_41675
TXT_DB *TXT_DB_read(BIO *in, int num) { TXT_DB *ret = NULL; int esc = 0; long ln = 0; int i, add, n; int size = BUFSIZE; int offset = 0; char *p, *f; OPENSSL_STRING *pp; BUF_MEM *buf = NULL; if ((buf = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(buf, size)) goto err; if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) goto err; ret->num_fields = num; ret->index = NULL; ret->qual = NULL; if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL) goto err; if ((ret->index = OPENSSL_malloc(sizeof(*ret->index) * num)) == NULL) goto err; if ((ret->qual = OPENSSL_malloc(sizeof(*(ret->qual)) * num)) == NULL) goto err; for (i = 0; i < num; i++) { ret->index[i] = NULL; ret->qual[i] = NULL; } add = (num + 1) * sizeof(char *); buf->data[size - 1] = '\0'; offset = 0; for (;;) { if (offset != 0) { size += BUFSIZE; if (!BUF_MEM_grow_clean(buf, size)) goto err; } buf->data[offset] = '\0'; BIO_gets(in, &(buf->data[offset]), size - offset); ln++; if (buf->data[offset] == '\0') break; if ((offset == 0) && (buf->data[0] == '#')) continue; i = strlen(&(buf->data[offset])); offset += i; if (buf->data[offset - 1] != '\n') continue; else { buf->data[offset - 1] = '\0'; if ((p = OPENSSL_malloc(add + offset)) == NULL) goto err; offset = 0; } pp = (char **)p; p += add; n = 0; pp[n++] = p; i = 0; f = buf->data; esc = 0; for (;;) { if (*f == '\0') break; if (*f == '\t') { if (esc) p--; else { *(p++) = '\0'; f++; if (n >= num) break; pp[n++] = p; continue; } } esc = (*f == '\\'); *(p++) = *(f++); } *(p++) = '\0'; if ((n != num) || (*f != '\0')) { OPENSSL_free(pp); ret->error = DB_ERROR_WRONG_NUM_FIELDS; goto err; } pp[n] = p; if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) { OPENSSL_free(pp); goto err; } } BUF_MEM_free(buf); return ret; err: BUF_MEM_free(buf); if (ret != NULL) { sk_OPENSSL_PSTRING_free(ret->data); OPENSSL_free(ret->index); OPENSSL_free(ret->qual); OPENSSL_free(ret); } return (NULL); } crypto/srp/srp_vfy.c:368: error: BUFFER_OVERRUN_L3 Offset: 6 Size: [1, +oo] by call to `TXT_DB_read`. Showing all 11 steps of the trace crypto/srp/srp_vfy.c:368:18: Call 366. error_code = SRP_ERR_VBASE_INCOMPLETE_FILE; 367. 368. if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL) ^ 369. goto err; 370. crypto/txt_db/txt_db.c:20:1: <Offset trace> 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: Parameter `num` 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: <Length trace> 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: Parameter `num` 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:53:5: Assignment 51. } 52. 53. add = (num + 1) * sizeof(char *); ^ 54. buf->data[size - 1] = '\0'; 55. offset = 0; crypto/txt_db/txt_db.c:75:22: Call 73. else { 74. buf->data[offset - 1] = '\0'; /* blat the '\n' */ 75. if ((p = OPENSSL_malloc(add + offset)) == NULL) ^ 76. goto err; 77. offset = 0; crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/txt_db/txt_db.c:75:18: Assignment 73. else { 74. buf->data[offset - 1] = '\0'; /* blat the '\n' */ 75. if ((p = OPENSSL_malloc(add + offset)) == NULL) ^ 76. goto err; 77. offset = 0; crypto/txt_db/txt_db.c:79:9: Assignment 77. offset = 0; 78. } 79. pp = (char **)p; ^ 80. p += add; 81. n = 0; crypto/txt_db/txt_db.c:111:9: Array access: Offset: 6 Size: [1, +oo] by call to `TXT_DB_read` 109. goto err; 110. } 111. pp[n] = p; ^ 112. if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) { 113. OPENSSL_free(pp);
https://github.com/openssl/openssl/blob/1b8f19379a521ec11ce37e12316dd3edc0acfb82/crypto/txt_db/txt_db.c/#L111
d2a_code_trace_data_41676
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) { ssl_clear_hash_ctx(hash); *hash = EVP_MD_CTX_new(); if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { EVP_MD_CTX_free(*hash); *hash = NULL; return NULL; } return *hash; } ssl/ssl_lib.c:4184: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 4181, column 13 is not reachable after line 4184, column 9. Showing all 49 steps of the trace ssl/ssl_lib.c:4178:1: start of procedure ssl_replace_hash() 4176. */ 4177. 4178. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4179. { 4180. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:4180:5: 4178. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4179. { 4180. > ssl_clear_hash_ctx(hash); 4181. *hash = EVP_MD_CTX_new(); 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:4190:1: start of procedure ssl_clear_hash_ctx() 4188. } 4189. 4190. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 4191. { 4192. ssl/ssl_lib.c:4193:5: 4191. { 4192. 4193. > EVP_MD_CTX_free(*hash); 4194. *hash = NULL; 4195. } crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:286:1: start of procedure CRYPTO_free() 284. } 285. 286. > void CRYPTO_free(void *str, const char *file, int line) 287. { 288. INCREMENT(free_count); crypto/mem.c:289:9: Taking false branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:303:5: 301. } 302. #else 303. > free(str); 304. #endif 305. } crypto/mem.c:305:1: return from a call to CRYPTO_free 303. free(str); 304. #endif 305. > } 306. 307. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:4194:5: 4192. 4193. EVP_MD_CTX_free(*hash); 4194. > *hash = NULL; 4195. } 4196. ssl/ssl_lib.c:4195:1: return from a call to ssl_clear_hash_ctx 4193. EVP_MD_CTX_free(*hash); 4194. *hash = NULL; 4195. > } 4196. 4197. /* Retrieve handshake hashes */ ssl/ssl_lib.c:4181:5: 4179. { 4180. ssl_clear_hash_ctx(hash); 4181. > *hash = EVP_MD_CTX_new(); 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4183. EVP_MD_CTX_free(*hash); crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c:218:1: start of procedure CRYPTO_zalloc() 216. } 217. 218. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:220:5: 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. > void *ret = CRYPTO_malloc(num, file, line); 221. 222. FAILTEST(); crypto/mem.c:189:1: start of procedure CRYPTO_malloc() 187. #endif 188. 189. > void *CRYPTO_malloc(size_t num, const char *file, int line) 190. { 191. void *ret = NULL; crypto/mem.c:191:5: 189. void *CRYPTO_malloc(size_t num, const char *file, int line) 190. { 191. > void *ret = NULL; 192. 193. INCREMENT(malloc_count); crypto/mem.c:194:9: Taking false branch 192. 193. INCREMENT(malloc_count); 194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 195. return malloc_impl(num, file, line); 196. crypto/mem.c:197:9: Taking false branch 195. return malloc_impl(num, file, line); 196. 197. if (num == 0) ^ 198. return NULL; 199. crypto/mem.c:201:5: 199. 200. FAILTEST(); 201. > allow_customize = 0; 202. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 203. if (call_malloc_debug) { crypto/mem.c:211:5: 209. } 210. #else 211. > (void)(file); (void)(line); 212. ret = malloc(num); 213. #endif crypto/mem.c:211:19: 209. } 210. #else 211. > (void)(file); (void)(line); 212. ret = malloc(num); 213. #endif crypto/mem.c:212:5: 210. #else 211. (void)(file); (void)(line); 212. > ret = malloc(num); 213. #endif 214. crypto/mem.c:215:5: 213. #endif 214. 215. > return ret; 216. } 217. crypto/mem.c:216:1: return from a call to CRYPTO_malloc 214. 215. return ret; 216. > } 217. 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:223:9: Taking true branch 221. 222. FAILTEST(); 223. if (ret != NULL) ^ 224. memset(ret, 0, num); 225. return ret; crypto/mem.c:224:9: 222. FAILTEST(); 223. if (ret != NULL) 224. > memset(ret, 0, num); 225. return ret; 226. } crypto/mem.c:225:5: 223. if (ret != NULL) 224. memset(ret, 0, num); 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_zalloc 224. memset(ret, 0, num); 225. return ret; 226. > } 227. 228. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/ssl_lib.c:4182:9: Taking false branch 4180. ssl_clear_hash_ctx(hash); 4181. *hash = EVP_MD_CTX_new(); 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4183. EVP_MD_CTX_free(*hash); 4184. *hash = NULL; ssl/ssl_lib.c:4182:27: Taking true branch 4180. ssl_clear_hash_ctx(hash); 4181. *hash = EVP_MD_CTX_new(); 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4183. EVP_MD_CTX_free(*hash); 4184. *hash = NULL; ssl/ssl_lib.c:4182:33: Taking true branch 4180. ssl_clear_hash_ctx(hash); 4181. *hash = EVP_MD_CTX_new(); 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4183. EVP_MD_CTX_free(*hash); 4184. *hash = NULL; ssl/ssl_lib.c:4183:9: 4181. *hash = EVP_MD_CTX_new(); 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4183. > EVP_MD_CTX_free(*hash); 4184. *hash = NULL; 4185. return NULL; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:286:1: start of procedure CRYPTO_free() 284. } 285. 286. > void CRYPTO_free(void *str, const char *file, int line) 287. { 288. INCREMENT(free_count); crypto/mem.c:289:9: Taking true branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:289:30: Taking true branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { 290. free_impl(str, file, line); ^ 291. return; 292. } crypto/mem.c:291:9: 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { 290. free_impl(str, file, line); 291. > return; 292. } 293. crypto/mem.c:305:1: return from a call to CRYPTO_free 303. free(str); 304. #endif 305. > } 306. 307. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:4184:9: 4182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4183. EVP_MD_CTX_free(*hash); 4184. > *hash = NULL; 4185. return NULL; 4186. }
https://github.com/openssl/openssl/blob/066904cceef26bbb5c63c237d20829fb0db82ddc/ssl/ssl_lib.c/#L4184
d2a_code_trace_data_41677
void ERR_add_error_vdata(int num, va_list args) { int i, n, s; char *str, *p, *a; s = 80; str = OPENSSL_malloc(s + 1); if (str == NULL) return; str[0] = '\0'; n = 0; for (i = 0; i < num; i++) { a = va_arg(args, char *); if (a == NULL) a = "<NULL>"; n += strlen(a); if (n > s) { s = n + 20; p = OPENSSL_realloc(str, s + 1); if (p == NULL) { OPENSSL_free(str); return; } str = p; } OPENSSL_strlcat(str, a, (size_t)s + 1); } ERR_set_error_data(str, ERR_TXT_MALLOCED | ERR_TXT_STRING); } crypto/err/err.c:757: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 742, column 11 is not reachable after line 757, column 17. Showing all 37 steps of the trace crypto/err/err.c:736:1: start of procedure ERR_add_error_vdata() 734. } 735. 736. > void ERR_add_error_vdata(int num, va_list args) 737. { 738. int i, n, s; crypto/err/err.c:741:5: 739. char *str, *p, *a; 740. 741. > s = 80; 742. str = OPENSSL_malloc(s + 1); 743. if (str == NULL) crypto/err/err.c:742:5: 740. 741. s = 80; 742. > str = OPENSSL_malloc(s + 1); 743. if (str == NULL) 744. return; crypto/mem.c:189:1: start of procedure CRYPTO_malloc() 187. #endif 188. 189. > void *CRYPTO_malloc(size_t num, const char *file, int line) 190. { 191. void *ret = NULL; crypto/mem.c:191:5: 189. void *CRYPTO_malloc(size_t num, const char *file, int line) 190. { 191. > void *ret = NULL; 192. 193. INCREMENT(malloc_count); crypto/mem.c:194:9: Taking false branch 192. 193. INCREMENT(malloc_count); 194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 195. return malloc_impl(num, file, line); 196. crypto/mem.c:197:9: Taking false branch 195. return malloc_impl(num, file, line); 196. 197. if (num == 0) ^ 198. return NULL; 199. crypto/mem.c:201:5: 199. 200. FAILTEST(); 201. > allow_customize = 0; 202. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 203. if (call_malloc_debug) { crypto/mem.c:211:5: 209. } 210. #else 211. > (void)(file); (void)(line); 212. ret = malloc(num); 213. #endif crypto/mem.c:211:19: 209. } 210. #else 211. > (void)(file); (void)(line); 212. ret = malloc(num); 213. #endif crypto/mem.c:212:5: 210. #else 211. (void)(file); (void)(line); 212. > ret = malloc(num); 213. #endif 214. crypto/mem.c:215:5: 213. #endif 214. 215. > return ret; 216. } 217. crypto/mem.c:216:1: return from a call to CRYPTO_malloc 214. 215. return ret; 216. > } 217. 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/err/err.c:743:9: Taking false branch 741. s = 80; 742. str = OPENSSL_malloc(s + 1); 743. if (str == NULL) ^ 744. return; 745. str[0] = '\0'; crypto/err/err.c:745:5: 743. if (str == NULL) 744. return; 745. > str[0] = '\0'; 746. 747. n = 0; crypto/err/err.c:747:5: 745. str[0] = '\0'; 746. 747. > n = 0; 748. for (i = 0; i < num; i++) { 749. a = va_arg(args, char *); crypto/err/err.c:748:10: 746. 747. n = 0; 748. > for (i = 0; i < num; i++) { 749. a = va_arg(args, char *); 750. if (a == NULL) crypto/err/err.c:748:17: Loop condition is true. Entering loop body 746. 747. n = 0; 748. for (i = 0; i < num; i++) { ^ 749. a = va_arg(args, char *); 750. if (a == NULL) crypto/err/err.c:749:9: 747. n = 0; 748. for (i = 0; i < num; i++) { 749. > a = va_arg(args, char *); 750. if (a == NULL) 751. a = "<NULL>"; crypto/err/err.c:750:13: Taking false branch 748. for (i = 0; i < num; i++) { 749. a = va_arg(args, char *); 750. if (a == NULL) ^ 751. a = "<NULL>"; 752. n += strlen(a); crypto/err/err.c:752:9: 750. if (a == NULL) 751. a = "<NULL>"; 752. > n += strlen(a); 753. if (n > s) { 754. s = n + 20; crypto/err/err.c:753:13: Taking true branch 751. a = "<NULL>"; 752. n += strlen(a); 753. if (n > s) { ^ 754. s = n + 20; 755. p = OPENSSL_realloc(str, s + 1); crypto/err/err.c:754:13: 752. n += strlen(a); 753. if (n > s) { 754. > s = n + 20; 755. p = OPENSSL_realloc(str, s + 1); 756. if (p == NULL) { crypto/err/err.c:755:13: 753. if (n > s) { 754. s = n + 20; 755. > p = OPENSSL_realloc(str, s + 1); 756. if (p == NULL) { 757. OPENSSL_free(str); crypto/mem.c:228:1: start of procedure CRYPTO_realloc() 226. } 227. 228. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 229. { 230. INCREMENT(realloc_count); crypto/mem.c:231:9: Taking true branch 229. { 230. INCREMENT(realloc_count); 231. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc) ^ 232. return realloc_impl(str, num, file, line); 233. crypto/mem.c:231:33: Taking true branch 229. { 230. INCREMENT(realloc_count); 231. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc) ^ 232. return realloc_impl(str, num, file, line); 233. crypto/mem.c:232:9: Skipping __function_pointer__(): unresolved function pointer 230. INCREMENT(realloc_count); 231. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc) 232. return realloc_impl(str, num, file, line); ^ 233. 234. FAILTEST(); crypto/mem.c:257:1: return from a call to CRYPTO_realloc 255. return realloc(str, num); 256. 257. > } 258. 259. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, crypto/err/err.c:756:17: Taking true branch 754. s = n + 20; 755. p = OPENSSL_realloc(str, s + 1); 756. if (p == NULL) { ^ 757. OPENSSL_free(str); 758. return; crypto/err/err.c:757:17: 755. p = OPENSSL_realloc(str, s + 1); 756. if (p == NULL) { 757. > OPENSSL_free(str); 758. return; 759. } crypto/mem.c:286:1: start of procedure CRYPTO_free() 284. } 285. 286. > void CRYPTO_free(void *str, const char *file, int line) 287. { 288. INCREMENT(free_count); crypto/mem.c:289:9: Taking true branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:289:30: Taking true branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { 290. free_impl(str, file, line); ^ 291. return; 292. } crypto/mem.c:291:9: 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { 290. free_impl(str, file, line); 291. > return; 292. } 293. crypto/mem.c:305:1: return from a call to CRYPTO_free 303. free(str); 304. #endif 305. > } 306. 307. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
https://github.com/openssl/openssl/blob/066904cceef26bbb5c63c237d20829fb0db82ddc/crypto/err/err.c/#L757
d2a_code_trace_data_41678
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1339: error: Buffer Overrun L1 Offset: [8, 9] (⇐ [0, 1] + 8) Size: 4 by call to `interlaced_search`. libavcodec/motion_est.c:1339:16: Call 1337. if((s->flags&CODEC_FLAG_INTERLACED_ME) 1338. && !c->skip){ //FIXME varc/d checks 1339. if(interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0) < INT_MAX) ^ 1340. mb_type |= CANDIDATE_MB_TYPE_INTER_I; 1341. } libavcodec/motion_est.c:893:1: Parameter `ref_index` 891. } 892. 893. static int interlaced_search(MpegEncContext *s, int ref_index, ^ 894. int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) 895. { libavcodec/motion_est.c:953:20: Call 951. P_MV1[1]= my / 2; 952. 953. dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1); ^ 954. 955. dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h); libavcodec/motion_est_template.c:1191:1: Parameter `ref_index` 1189. 1190. //try to merge with above FIXME (needs PSNR test) 1191. static int epzs_motion_search2(MpegEncContext * s, ^ 1192. int *mx_ptr, int *my_ptr, int P[10][2], 1193. int src_index, int ref_index, int16_t (*last_mv)[2], libavcodec/motion_est_template.c:1219:9: Call 1217. /* first line */ 1218. if (s->first_slice_line) { 1219. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1220. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1221. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:176:50: Array access: Offset: [8, 9] (⇐ [0, 1] + 8) Size: 4 by call to `interlaced_search` 174. 175. c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); 176. c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); ^ 177. } 178. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L176
d2a_code_trace_data_41679
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; Minima minima[MAX_SAB_SIZE]; const int minima_count= FFABS(c->dia_size); int i, j; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){ uint32_t key= map[i]; key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1)); if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1); minima[j].x-= (1<<(ME_MAP_MV_BITS-1)); minima[j].y-= (1<<(ME_MAP_MV_BITS-1)); if( minima[j].x > xmax || minima[j].x < xmin || minima[j].y > ymax || minima[j].y < ymin) continue; minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor; j++; } qsort(minima, j, sizeof(Minima), minima_cmp); for(; j<minima_count; j++){ minima[j].height=256*256*256*64; minima[j].checked=0; minima[j].x= minima[j].y=0; } for(i=0; i<minima_count; i++){ const int x= minima[i].x; const int y= minima[i].y; int d; if(minima[i].checked) continue; if( x >= xmax || x <= xmin || y >= ymax || y <= ymin) continue; SAB_CHECK_MV(x-1, y) SAB_CHECK_MV(x+1, y) SAB_CHECK_MV(x , y-1) SAB_CHECK_MV(x , y+1) minima[i].checked= 1; } best[0]= minima[0].x; best[1]= minima[0].y; dmin= minima[0].height; if( best[0] < xmax && best[0] > xmin && best[1] < ymax && best[1] > ymin){ int d; CHECK_MV(best[0]-1, best[1]) CHECK_MV(best[0]+1, best[1]) CHECK_MV(best[0], best[1]-1) CHECK_MV(best[0], best[1]+1) } return dmin; } libavcodec/motion_est_template.c:888: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:888:9: 886. int d; 887. //ensure that the refernece samples for hpel refinement are in the map 888. CHECK_MV(best[0]-1, best[1]) ^ 889. CHECK_MV(best[0]+1, best[1]) 890. CHECK_MV(best[0], best[1]-1)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L888
d2a_code_trace_data_41680
static void opt_input_ts_scale(const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); if(stream >= MAX_STREAMS) ffmpeg_exit(1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; } ffmpeg.c:3043: error: Null Dereference pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3042 could be null and is dereferenced at line 3043, column 5. ffmpeg.c:3028:1: start of procedure opt_input_ts_scale() 3026. } 3027. 3028. static void opt_input_ts_scale(const char *arg) ^ 3029. { 3030. unsigned int stream; ffmpeg.c:3034:5: 3032. char *p; 3033. 3034. stream = strtol(arg, &p, 0); ^ 3035. if (*p) 3036. p++; ffmpeg.c:3035:9: Taking true branch 3033. 3034. stream = strtol(arg, &p, 0); 3035. if (*p) ^ 3036. p++; 3037. scale= strtod(p, &p); ffmpeg.c:3036:9: 3034. stream = strtol(arg, &p, 0); 3035. if (*p) 3036. p++; ^ 3037. scale= strtod(p, &p); 3038. ffmpeg.c:3037:5: 3035. if (*p) 3036. p++; 3037. scale= strtod(p, &p); ^ 3038. 3039. if(stream >= MAX_STREAMS) ffmpeg.c:3039:8: Taking true branch 3037. scale= strtod(p, &p); 3038. 3039. if(stream >= MAX_STREAMS) ^ 3040. ffmpeg_exit(1); 3041. ffmpeg.c:3040:9: Skipping ffmpeg_exit(): empty list of specs 3038. 3039. if(stream >= MAX_STREAMS) 3040. ffmpeg_exit(1); ^ 3041. 3042. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ffmpeg.c:3042:5: 3040. ffmpeg_exit(1); 3041. 3042. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ^ 3043. input_files_ts_scale[nb_input_files][stream]= scale; 3044. } ffmpeg.c:517:1: start of procedure grow_array() 515. 516. /* similar to ff_dynarray_add() and av_fast_realloc() */ 517. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 518. { 519. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:519:9: Taking true branch 517. static void *grow_array(void *array, int elem_size, int *size, int new_size) 518. { 519. if (new_size >= INT_MAX / elem_size) { ^ 520. fprintf(stderr, "Array too big.\n"); 521. ffmpeg_exit(1); ffmpeg.c:520:9: 518. { 519. if (new_size >= INT_MAX / elem_size) { 520. fprintf(stderr, "Array too big.\n"); ^ 521. ffmpeg_exit(1); 522. } ffmpeg.c:521:9: Skipping ffmpeg_exit(): empty list of specs 519. if (new_size >= INT_MAX / elem_size) { 520. fprintf(stderr, "Array too big.\n"); 521. ffmpeg_exit(1); ^ 522. } 523. if (*size < new_size) { ffmpeg.c:523:9: Taking true branch 521. ffmpeg_exit(1); 522. } 523. if (*size < new_size) { ^ 524. uint8_t *tmp = av_realloc(array, new_size*elem_size); 525. if (!tmp) { ffmpeg.c:524:9: 522. } 523. if (*size < new_size) { 524. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 525. if (!tmp) { 526. fprintf(stderr, "Could not alloc buffer.\n"); 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:8: Taking false branch 122. 123. /* let's disallow possible ambiguous cases */ 124. if(size > (INT_MAX-16) ) ^ 125. return NULL; 126. libavutil/mem.c:133:5: 131. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 132. #else 133. return realloc(ptr, size); ^ 134. #endif 135. } libavutil/mem.c:135:1: return from a call to av_realloc 133. return realloc(ptr, size); 134. #endif 135. } ^ 136. 137. void av_free(void *ptr) ffmpeg.c:525:14: Taking true branch 523. if (*size < new_size) { 524. uint8_t *tmp = av_realloc(array, new_size*elem_size); 525. if (!tmp) { ^ 526. fprintf(stderr, "Could not alloc buffer.\n"); 527. ffmpeg_exit(1); ffmpeg.c:526:13: 524. uint8_t *tmp = av_realloc(array, new_size*elem_size); 525. if (!tmp) { 526. fprintf(stderr, "Could not alloc buffer.\n"); ^ 527. ffmpeg_exit(1); 528. } ffmpeg.c:527:13: Skipping ffmpeg_exit(): empty list of specs 525. if (!tmp) { 526. fprintf(stderr, "Could not alloc buffer.\n"); 527. ffmpeg_exit(1); ^ 528. } 529. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:529:9: 527. ffmpeg_exit(1); 528. } 529. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 530. *size = new_size; 531. return tmp; ffmpeg.c:530:9: 528. } 529. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 530. *size = new_size; ^ 531. return tmp; 532. } ffmpeg.c:531:9: 529. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 530. *size = new_size; 531. return tmp; ^ 532. } 533. return array; ffmpeg.c:534:1: return from a call to grow_array 532. } 533. return array; 534. } ^ 535. 536. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3043:5: 3041. 3042. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); 3043. input_files_ts_scale[nb_input_files][stream]= scale; ^ 3044. } 3045.
https://github.com/libav/libav/blob/5da116a3fde9013846bd7b385cdde5ce2951869c/ffmpeg.c/#L3043
d2a_code_trace_data_41681
void *lh_delete(LHASH *lh, void *data) { unsigned long hash; LHASH_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/s3_clnt.c:856: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_send_alert`. Showing all 13 steps of the trace ssl/s3_clnt.c:685:1: Parameter `s->ctx->sessions->num_items` 683. } 684. 685. > static int ssl3_get_server_certificate(SSL *s) 686. { 687. int al,i,ok,ret= -1; ssl/s3_clnt.c:696:4: Call 694. int need_cert = 1; /* VRS: 0=> will allow null cert if auth == KRB5 */ 695. 696. n=ssl3_get_message(s, ^ 697. SSL3_ST_CR_CERT_A, 698. SSL3_ST_CR_CERT_B, ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->num_items` 335. * the body is read in state 'stn'. 336. */ 337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 338. { 339. unsigned char *p; ssl/s3_clnt.c:856:3: Call 854. { 855. f_err: 856. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 857. } 858. err: ssl/s3_pkt.c:1149:1: Parameter `s->ctx->sessions->num_items` 1147. } 1148. 1149. > void ssl3_send_alert(SSL *s, int level, int desc) 1150. { 1151. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1156:3: Call 1154. /* If a fatal one, remove from cache */ 1155. if ((level == 2) && (s->session != NULL)) 1156. SSL_CTX_remove_session(s->ctx,s->session); ^ 1157. 1158. s->s3->alert_dispatch=1; ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->num_items` 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->num_items` 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: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_send_alert` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_41682
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); } tools/tiffcrop.c:1015: error: Integer Overflow L2 ([0, `out->tif_dir.td_imagelength`] - 1):unsigned32 by call to `TIFFWriteTile`. tools/tiffcrop.c:981:1: Parameter `out->tif_dir.td_imagelength` 979. } 980. 981. static int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength, ^ 982. uint32 imagewidth, tsample_t spp) 983. { tools/tiffcrop.c:1015:8: Call 1013. cpStripToTile(obuf, bufp + colb, nrow, tilew, 1014. 0, iskew); 1015. if (TIFFWriteTile(out, obuf, col, row, 0, 0) < 0) { ^ 1016. TIFFError(TIFFFileName(out), 1017. "Error, can't write tile at %lu %lu", libtiff/tif_write.c:312:1: Parameter `tif->tif_dir.td_imagelength` 310. * tile is selected by the (x,y,z,s) coordinates. 311. */ 312. tmsize_t ^ 313. TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 314. { libtiff/tif_write.c:315:7: Call 313. TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 314. { 315. if (!TIFFCheckTile(tif, x, y, z, s)) ^ 316. return ((tmsize_t)(-1)); 317. /* 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 `y` 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:113:3: Binary operation: ([0, out->tif_dir.td_imagelength] - 1):unsigned32 by call to `TIFFWriteTile` 111. } 112. if (y >= td->td_imagelength) { 113. TIFFErrorExt(tif->tif_clientdata, tif->tif_name, ^ 114. "%lu: Row out of range, max %lu", 115. (unsigned long) y,
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_tile.c/#L113
d2a_code_trace_data_41683
static void contract(OPENSSL_LHASH *lh) { OPENSSL_LH_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 = OPENSSL_realloc(lh->b, (unsigned int)(sizeof(OPENSSL_LH_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; } } include/openssl/lhash.h:197: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete`. Showing all 10 steps of the trace include/openssl/lhash.h:197:1: Parameter `lh->pmax` 195. LHASH_OF(type) 196. 197. > DEFINE_LHASH_OF(OPENSSL_STRING); 198. # ifdef _MSC_VER 199. /* include/openssl/lhash.h:197:1: Call 195. LHASH_OF(type) 196. 197. > DEFINE_LHASH_OF(OPENSSL_STRING); 198. # ifdef _MSC_VER 199. /* crypto/lhash/lhash.c:103:1: Parameter `lh->pmax` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:126:9: Call 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) 126. contract(lh); ^ 127. 128. return (ret); crypto/lhash/lhash.c:232:1: <Offset trace> 230. } 231. 232. > static void contract(OPENSSL_LHASH *lh) 233. { 234. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:232:1: Parameter `lh->p` 230. } 231. 232. > static void contract(OPENSSL_LHASH *lh) 233. { 234. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:252:9: Assignment 250. lh->b = n; 251. } else 252. lh->p--; ^ 253. 254. lh->num_nodes--; crypto/lhash/lhash.c:232:1: <Length trace> 230. } 231. 232. > static void contract(OPENSSL_LHASH *lh) 233. { 234. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:232:1: Parameter `*lh->b` 230. } 231. 232. > static void contract(OPENSSL_LHASH *lh) 233. { 234. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:257:10: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete` 255. lh->num_contracts++; 256. 257. n1 = lh->b[(int)lh->p]; ^ 258. if (n1 == NULL) 259. lh->b[(int)lh->p] = np;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/lhash/lhash.c/#L257
d2a_code_trace_data_41684
int BN_num_bits_word(BN_ULONG l) { static const unsigned char bits[256] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; #if defined(SIXTY_FOUR_BIT_LONG) if (l & 0xffffffff00000000L) { if (l & 0xffff000000000000L) { if (l & 0xff00000000000000L) { return (bits[(int)(l >> 56)] + 56); } else return (bits[(int)(l >> 48)] + 48); } else { if (l & 0x0000ff0000000000L) { return (bits[(int)(l >> 40)] + 40); } else return (bits[(int)(l >> 32)] + 32); } } else #else # ifdef SIXTY_FOUR_BIT if (l & 0xffffffff00000000LL) { if (l & 0xffff000000000000LL) { if (l & 0xff00000000000000LL) { return (bits[(int)(l >> 56)] + 56); } else return (bits[(int)(l >> 48)] + 48); } else { if (l & 0x0000ff0000000000LL) { return (bits[(int)(l >> 40)] + 40); } else return (bits[(int)(l >> 32)] + 32); } } else # endif #endif { #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) if (l & 0xffff0000L) { if (l & 0xff000000L) return (bits[(int)(l >> 24L)] + 24); else return (bits[(int)(l >> 16L)] + 16); } else #endif { #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) if (l & 0xff00L) return (bits[(int)(l >> 8)] + 8); else #endif return (bits[(int)(l)]); } } } test/bntest.c:1232: error: BUFFER_OVERRUN_L2 Offset: [0, 18446744073709551615] Size: 256 by call to `BN_div_word`. Showing all 14 steps of the trace test/bntest.c:1213:10: Call 1211. goto err; 1212. 1213. if (!BN_div(ret, ret2, a, b, ctx) ^ 1214. || !equalBN("A / B", quotient, ret) 1215. || !equalBN("A % B", remainder, ret2) crypto/bn/bn_div.c:140:1: Parameter `*dv->d` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { test/bntest.c:1225:14: Call 1223. * small enough. 1224. */ 1225. b_word = BN_get_word(b); ^ 1226. if (!BN_is_negative(b) && b_word != (BN_ULONG)-1) { 1227. BN_ULONG remainder_word = BN_get_word(remainder); crypto/bn/bn_lib.c:456:9: Assignment 454. { 455. if (a->top > 1) 456. return BN_MASK2; ^ 457. else if (a->top == 1) 458. return a->d[0]; test/bntest.c:1225:5: Assignment 1223. * small enough. 1224. */ 1225. b_word = BN_get_word(b); ^ 1226. if (!BN_is_negative(b) && b_word != (BN_ULONG)-1) { 1227. BN_ULONG remainder_word = BN_get_word(remainder); test/bntest.c:1232:20: Call 1230. if (!BN_copy(ret, a)) 1231. goto err; 1232. ret_word = BN_div_word(ret, b_word); ^ 1233. if (ret_word != remainder_word) { 1234. #ifdef BN_DEC_FMT1 crypto/bn/bn_word.c:61:1: Parameter `w` 59. } 60. 61. > BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w) 62. { 63. BN_ULONG ret = 0; crypto/bn/bn_word.c:67:5: Assignment 65. 66. bn_check_top(a); 67. w &= BN_MASK2; ^ 68. 69. if (!w) crypto/bn/bn_word.c:76:20: Call 74. 75. /* normalize input (so bn_div_words doesn't complain) */ 76. j = BN_BITS2 - BN_num_bits_word(w); ^ 77. w <<= j; 78. if (!BN_lshift(a, a, j)) crypto/bn/bn_lib.c:89:1: <Offset trace> 87. } 88. 89. > int BN_num_bits_word(BN_ULONG l) 90. { 91. static const unsigned char bits[256] = { crypto/bn/bn_lib.c:89:1: Parameter `l` 87. } 88. 89. > int BN_num_bits_word(BN_ULONG l) 90. { 91. static const unsigned char bits[256] = { crypto/bn/bn_lib.c:91:5: <Length trace> 89. int BN_num_bits_word(BN_ULONG l) 90. { 91. static const unsigned char bits[256] = { ^ 92. 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 93. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, crypto/bn/bn_lib.c:91:5: Array declaration 89. int BN_num_bits_word(BN_ULONG l) 90. { 91. static const unsigned char bits[256] = { ^ 92. 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 93. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, crypto/bn/bn_lib.c:114:25: Array access: Offset: [0, 18446744073709551615] Size: 256 by call to `BN_div_word` 112. if (l & 0xffff000000000000L) { 113. if (l & 0xff00000000000000L) { 114. return (bits[(int)(l >> 56)] + 56); ^ 115. } else 116. return (bits[(int)(l >> 48)] + 48);
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_lib.c/#L114
d2a_code_trace_data_41685
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:278: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 15 steps of the trace test/bntest.c:278:9: Call 276. a->neg = rand_neg(); 277. b->neg = rand_neg(); 278. BN_mod(c, a, b, ctx); ^ 279. BN_div(d, e, a, b, ctx); 280. BN_sub(e, e, c); crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { test/bntest.c:279:9: Call 277. b->neg = rand_neg(); 278. BN_mod(c, a, b, ctx); 279. BN_div(d, e, a, b, ctx); ^ 280. BN_sub(e, e, c); 281. if (!BN_is_zero(e)) { crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { test/bntest.c:278:9: Call 276. a->neg = rand_neg(); 277. b->neg = rand_neg(); 278. BN_mod(c, a, b, ctx); ^ 279. BN_div(d, e, a, b, ctx); 280. BN_sub(e, e, c); 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_div` 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_41686
static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; ByteIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; unsigned char preamble[WC3_PREAMBLE_SIZE]; int ret = 0; int current_palette = 0; int bytes_to_read; int i; unsigned char rotate; wc3->width = WC3_DEFAULT_WIDTH; wc3->height = WC3_DEFAULT_HEIGHT; wc3->palettes = NULL; wc3->palette_count = 0; wc3->pts = 0; wc3->video_stream_index = wc3->audio_stream_index = 0; url_fseek(pb, 12, SEEK_CUR); if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) return AVERROR(EIO); fourcc_tag = AV_RL32(&preamble[0]); size = (AV_RB32(&preamble[4]) + 1) & (~1); do { switch (fourcc_tag) { case SOND_TAG: case INDX_TAG: url_fseek(pb, size, SEEK_CUR); break; case PC__TAG: url_fseek(pb, 8, SEEK_CUR); if ((ret = get_buffer(pb, preamble, 4)) != 4) return AVERROR(EIO); wc3->palette_count = AV_RL32(&preamble[0]); if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){ wc3->palette_count= 0; return -1; } wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE); break; case BNAM_TAG: if ((unsigned)size < 512) bytes_to_read = size; else bytes_to_read = 512; if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read) return AVERROR(EIO); break; case SIZE_TAG: if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) return AVERROR(EIO); wc3->width = AV_RL32(&preamble[0]); wc3->height = AV_RL32(&preamble[4]); break; case PALT_TAG: if ((unsigned)current_palette >= wc3->palette_count) return AVERROR_INVALIDDATA; if ((ret = get_buffer(pb, &wc3->palettes[current_palette * PALETTE_SIZE], PALETTE_SIZE)) != PALETTE_SIZE) return AVERROR(EIO); for (i = current_palette * PALETTE_SIZE; i < (current_palette + 1) * PALETTE_SIZE; i++) { rotate = ((wc3->palettes[i] << 2) & 0xFF) | ((wc3->palettes[i] >> 6) & 0xFF); wc3->palettes[i] = wc3_pal_lookup[rotate]; } current_palette++; break; default: av_log(s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", preamble[0], preamble[1], preamble[2], preamble[3], preamble[0], preamble[1], preamble[2], preamble[3]); return AVERROR_INVALIDDATA; break; } if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) return AVERROR(EIO); fourcc_tag = AV_RL32(&preamble[0]); size = (AV_RB32(&preamble[4]) + 1) & (~1); } while (fourcc_tag != BRCH_TAG); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_XAN_WC3; st->codec->codec_tag = 0; st->codec->width = wc3->width; st->codec->height = wc3->height; st->codec->palctrl = &wc3->palette_control; st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_PCM_S16LE; st->codec->codec_tag = 1; st->codec->channels = WC3_AUDIO_CHANNELS; st->codec->bits_per_sample = WC3_AUDIO_BITS; st->codec->sample_rate = WC3_SAMPLE_RATE; st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_sample; st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; return 0; } libavformat/wc3movie.c:211: error: Integer Overflow L2 ([0, 4294966271] + 1):signed32. libavformat/wc3movie.c:135:5: <LHS trace> 133. unsigned char preamble[WC3_PREAMBLE_SIZE]; 134. int ret = 0; 135. int current_palette = 0; ^ 136. int bytes_to_read; 137. int i; libavformat/wc3movie.c:135:5: Assignment 133. unsigned char preamble[WC3_PREAMBLE_SIZE]; 134. int ret = 0; 135. int current_palette = 0; ^ 136. int bytes_to_read; 137. int i; libavformat/wc3movie.c:211:60: Binary operation: ([0, 4294966271] + 1):signed32 209. /* transform the current palette in place */ 210. for (i = current_palette * PALETTE_SIZE; 211. i < (current_palette + 1) * PALETTE_SIZE; i++) { ^ 212. /* rotate each palette component left by 2 and use the result 213. * as an index into the color component table */
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/wc3movie.c/#L211
d2a_code_trace_data_41687
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/ec2_smpl.c:699: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand`. Showing all 17 steps of the trace crypto/ec/ec2_smpl.c:688:1: Parameter `s->Z->d` 686. * s:= p, r := 2p 687. */ 688. > static 689. int ec_GF2m_simple_ladder_pre(const EC_GROUP *group, 690. EC_POINT *r, EC_POINT *s, crypto/ec/ec2_smpl.c:699:14: Call 697. /* s blinding: make sure lambda (s->Z here) is not zero */ 698. do { 699. if (!BN_priv_rand(s->Z, BN_num_bits(group->field) - 1, ^ 700. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) { 701. ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_PRE, ERR_R_BN_LIB); crypto/bn/bn_rand.c:121:1: Parameter `*rnd->d` 119. } 120. 121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:33:9: Call 31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 32. goto toosmall; 33. BN_zero(rnd); ^ 34. return 1; 35. } crypto/bn/bn_lib.c:361:1: Parameter `*a->d` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand` 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/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_41688
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/statem/statem_clnt.c:2409: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 8]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 12 steps of the trace ssl/statem/statem_clnt.c:2407:10: Call 2405. } 2406. 2407. if (!WPACKET_put_bytes_u8(pkt, V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED) ^ 2408. || (msglen >= 0x80 && !WPACKET_put_bytes_u8(pkt, 0x81)) 2409. || !WPACKET_sub_memcpy_u8(pkt, tmp, msglen)) { ssl/packet.c:238:1: Parameter `pkt->buf->length` 236. } 237. 238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 239. { 240. unsigned char *data; ssl/statem/statem_clnt.c:2409:17: Call 2407. if (!WPACKET_put_bytes_u8(pkt, V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED) 2408. || (msglen >= 0x80 && !WPACKET_put_bytes_u8(pkt, 0x81)) 2409. || !WPACKET_sub_memcpy_u8(pkt, tmp, msglen)) { ^ 2410. *al = SSL_AD_INTERNAL_ERROR; 2411. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_INTERNAL_ERROR); ssl/packet.c:294:1: Parameter `pkt->written` 292. } 293. 294. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 295. size_t lenbytes) 296. { ssl/packet.c:297:10: Call 295. size_t lenbytes) 296. { 297. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 298. || !WPACKET_memcpy(pkt, src, len) 299. || !WPACKET_close(pkt)) ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 8]):unsigned64 by call to `WPACKET_sub_memcpy__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_41689
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:94: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:80:10: Call 78. } 79. 80. if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) { ^ 81. printf("Unable to create SSL objects\n"); 82. 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:94:5: Call 92. end: 93. X509_free(chaincert); 94. SSL_free(serverssl); ^ 95. SSL_free(clientssl); 96. 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/84d5549e692e63a16fa1b11603e4098fc31746e9/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_41690
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [481+min(0, `c->synth_buf_offset[*]`), 496+max(511, `c->synth_buf_offset[*]`)] (⇐ [33+min(0, `c->synth_buf_offset[*]`), 48+max(511, `c->synth_buf_offset[*]`)] + 448) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:906:9: <Length trace> 904. /* we calculate two samples at the same time to avoid one memory 905. access per two sample */ 906. for(j=1;j<16;j++) { ^ 907. sum2 = 0; 908. p = synth_buf + 16 + j; libavcodec/mpegaudiodec.c:906:9: Assignment 904. /* we calculate two samples at the same time to avoid one memory 905. access per two sample */ 906. for(j=1;j<16;j++) { ^ 907. sum2 = 0; 908. p = synth_buf + 16 + j; libavcodec/mpegaudiodec.c:910:9: Assignment 908. p = synth_buf + 16 + j; 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; ^ 911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); 912. libavcodec/mpegaudiodec.c:911:9: Array access: Offset: [481+min(0, c->synth_buf_offset[*]), 496+max(511, c->synth_buf_offset[*])] (⇐ [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] + 448) Size: 2 by call to `ff_mpa_synth_filter` 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; 911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); ^ 912. 913. *samples = round_sample(&sum);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L911
d2a_code_trace_data_41691
YUV2RGBFUNC(yuva2argb_c, uint32_t, 1) LOADCHROMA(0); PUTRGBA(dst_1, py_1, pa_1, 0, 0); PUTRGBA(dst_2, py_2, pa_2, 0, 0); LOADCHROMA(1); PUTRGBA(dst_2, py_2, pa_2, 1, 0); PUTRGBA(dst_1, py_1, pa_1, 1, 0); LOADCHROMA(2); PUTRGBA(dst_1, py_1, pa_1, 2, 0); PUTRGBA(dst_2, py_2, pa_2, 2, 0); LOADCHROMA(3); PUTRGBA(dst_2, py_2, pa_2, 3, 0); PUTRGBA(dst_1, py_1, pa_1, 3, 0); pa_1 += 8; \ pa_2 += 8; \ ENDYUV2RGBLINE(8) LOADCHROMA(0); PUTRGBA(dst_1, py_1, pa_1, 0, 0); PUTRGBA(dst_2, py_2, pa_2, 0, 0); LOADCHROMA(1); PUTRGBA(dst_2, py_2, pa_2, 1, 0); PUTRGBA(dst_1, py_1, pa_1, 1, 0); ENDYUV2RGBFUNC() libswscale/yuv2rgb.c:294: error: Uninitialized Value The value read from pa_2 was never initialized. libswscale/yuv2rgb.c:294:5: 292. PUTRGBA(dst_1, py_1, pa_1, 3, 0); 293. pa_1 += 8; \ 294. pa_2 += 8; \ ^ 295. ENDYUV2RGBLINE(8) 296. LOADCHROMA(0);
https://github.com/libav/libav/blob/0ad522afb3a3b3d22402ecb82dd4609f7655031b/libswscale/yuv2rgb.c/#L294
d2a_code_trace_data_41692
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; } test/bntest.c:327: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, +oo] by call to `BN_div`. Showing all 22 steps of the trace test/bntest.c:320:11: Call 318. goto err; 319. 320. if (!(TEST_true(BN_bntest_rand(a, 1024, 0, 0)))) ^ 321. goto err; 322. for (i = 0; i < NUM0; i++) { crypto/bn/bn_rand.c:111:1: Parameter `*rnd->d` 109. } 110. 111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:113:12: Call 111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); ^ 114. } 115. crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { test/bntest.c:323:15: Call 321. goto err; 322. for (i = 0; i < NUM0; i++) { 323. if (!(TEST_true(BN_bntest_rand(b, 450 + i * 10, 0, 0)))) ^ 324. goto err; 325. BN_set_negative(a, rand_neg()); crypto/bn/bn_rand.c:111:1: Parameter `*rnd->d` 109. } 110. 111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:113:12: Call 111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); ^ 114. } 115. crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { test/bntest.c:327:15: Call 325. BN_set_negative(a, rand_neg()); 326. BN_set_negative(b, rand_neg()); 327. if (!(TEST_true(BN_mod(c, a, b, ctx)) ^ 328. && TEST_true(BN_div(d, e, a, b, ctx)) 329. && TEST_true(BN_sub(e, e, c)) crypto/bn/bn_div.c:209:1: Parameter `*dv->d` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `*dv->d` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:327:10: Call 325. 326. /* Setup quotient */ 327. if (!bn_wexpand(res, loop)) ^ 328. goto err; 329. res->neg = (num->neg ^ divisor->neg); 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: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->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `BN_div` 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/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_41693
void *grow_array(void *array, int elem_size, int *size, int new_size) { if (new_size >= INT_MAX / elem_size) { av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); exit_program(1); } if (*size < new_size) { uint8_t *tmp = av_realloc(array, new_size*elem_size); if (!tmp) { av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); exit_program(1); } memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); *size = new_size; return tmp; } return array; } avconv.c:4063: error: Integer Overflow L2 ([1, 2147483648] × 4):signed32 by call to `grow_array`. avconv.c:4062:11: Call 4060. } 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); ^ 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); cmdutils.c:83:1: Parameter `min` 81. } 82. 83. double parse_number_or_die(const char *context, const char *numstr, int type, ^ 84. double min, double max) 85. { cmdutils.c:98:9: Assignment 96. error = "Expected int for %s but found %s\n"; 97. else 98. return d; ^ 99. av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max); 100. exit_program(1); avconv.c:4062:5: Assignment 4060. } 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); ^ 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); avconv.c:4063:23: Call 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); ^ 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); 4065. return 0; cmdutils.c:1028:1: <LHS trace> 1026. } 1027. 1028. void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 1029. { 1030. if (new_size >= INT_MAX / elem_size) { cmdutils.c:1028:1: Parameter `new_size` 1026. } 1027. 1028. void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 1029. { 1030. if (new_size >= INT_MAX / elem_size) { cmdutils.c:1028:1: <RHS trace> 1026. } 1027. 1028. void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 1029. { 1030. if (new_size >= INT_MAX / elem_size) { cmdutils.c:1028:1: Parameter `elem_size` 1026. } 1027. 1028. void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 1029. { 1030. if (new_size >= INT_MAX / elem_size) { cmdutils.c:1035:24: Binary operation: ([1, 2147483648] × 4):signed32 by call to `grow_array` 1033. } 1034. if (*size < new_size) { 1035. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 1036. if (!tmp) { 1037. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
https://github.com/libav/libav/blob/1be8c90847300ac7889833612c99d57c58ff64b1/cmdutils.c/#L1035
d2a_code_trace_data_41694
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:1015: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`. Showing all 14 steps of the trace test/bntest.c:1013:17: Call 1011. || !BN_add(ret, a, a) 1012. || !equalBN("A + A", lshift1, ret) 1013. || !BN_mul(ret, a, two, ctx) ^ 1014. || !equalBN("A * 2", lshift1, ret) 1015. || !BN_div(ret, remainder, lshift1, two, ctx) crypto/bn/bn_mul.c:828:1: Parameter `r->top` 826. #endif /* BN_RECURSION */ 827. 828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 829. { 830. int ret = 0; test/bntest.c:1015:17: Call 1013. || !BN_mul(ret, a, two, ctx) 1014. || !equalBN("A * 2", lshift1, ret) 1015. || !BN_div(ret, remainder, lshift1, two, ctx) ^ 1016. || !equalBN("LShift1 / 2", a, ret) 1017. || !equalBN("LShift1 % 2", zero, remainder) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_41695
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:1465: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1438, column 9 is not reachable after line 1465, column 5. Showing all 177 steps of the trace test/bntest.c:1431:1: start of procedure test_gf2m_mod_div() 1429. } 1430. 1431. > int test_gf2m_mod_div(BIO *bp, BN_CTX *ctx) 1432. { 1433. BIGNUM *a, *b[2], *c, *d, *e, *f; test/bntest.c:1434:5: 1432. { 1433. BIGNUM *a, *b[2], *c, *d, *e, *f; 1434. > int i, j, ret = 0; 1435. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1436. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1435:5: 1433. BIGNUM *a, *b[2], *c, *d, *e, *f; 1434. int i, j, ret = 0; 1435. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1436. int p1[] = { 193, 15, 0, -1 }; 1437. test/bntest.c:1436:5: 1434. int i, j, ret = 0; 1435. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1436. > int p1[] = { 193, 15, 0, -1 }; 1437. 1438. a = BN_new(); test/bntest.c:1438:5: 1436. int p1[] = { 193, 15, 0, -1 }; 1437. 1438. > a = BN_new(); 1439. b[0] = BN_new(); 1440. 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:1439:5: 1437. 1438. a = BN_new(); 1439. > b[0] = BN_new(); 1440. b[1] = BN_new(); 1441. 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:1440:5: 1438. a = BN_new(); 1439. b[0] = BN_new(); 1440. > b[1] = BN_new(); 1441. c = BN_new(); 1442. 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:1441:5: 1439. b[0] = BN_new(); 1440. b[1] = BN_new(); 1441. > c = BN_new(); 1442. d = BN_new(); 1443. 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:1442:5: 1440. b[1] = BN_new(); 1441. c = BN_new(); 1442. > d = BN_new(); 1443. e = BN_new(); 1444. 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:1443:5: 1441. c = BN_new(); 1442. d = BN_new(); 1443. > e = BN_new(); 1444. f = BN_new(); 1445. 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:1444:5: 1442. d = BN_new(); 1443. e = BN_new(); 1444. > f = BN_new(); 1445. 1446. 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:1446:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1444. f = BN_new(); 1445. 1446. BN_GF2m_arr2poly(p0, b[0]); ^ 1447. BN_GF2m_arr2poly(p1, b[1]); 1448. test/bntest.c:1447:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1445. 1446. BN_GF2m_arr2poly(p0, b[0]); 1447. BN_GF2m_arr2poly(p1, b[1]); ^ 1448. 1449. for (i = 0; i < num0; i++) { test/bntest.c:1449:10: 1447. BN_GF2m_arr2poly(p1, b[1]); 1448. 1449. > for (i = 0; i < num0; i++) { 1450. BN_bntest_rand(a, 512, 0, 0); 1451. BN_bntest_rand(c, 512, 0, 0); test/bntest.c:1449:17: Loop condition is false. Leaving loop 1447. BN_GF2m_arr2poly(p1, b[1]); 1448. 1449. for (i = 0; i < num0; i++) { ^ 1450. BN_bntest_rand(a, 512, 0, 0); 1451. BN_bntest_rand(c, 512, 0, 0); test/bntest.c:1463:5: 1461. } 1462. } 1463. > ret = 1; 1464. err: 1465. BN_free(a); test/bntest.c:1464:2: 1462. } 1463. ret = 1; 1464. > err: 1465. BN_free(a); 1466. BN_free(b[0]); test/bntest.c:1465:5: 1463. ret = 1; 1464. err: 1465. > BN_free(a); 1466. BN_free(b[0]); 1467. 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/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1465
d2a_code_trace_data_41696
void bn_correct_top(BIGNUM *a) { BN_ULONG *ftl; int tmp_top = a->top; if (tmp_top > 0) { for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ftl--; if (*ftl != 0) break; } a->top = tmp_top; } if (a->top == 0) a->neg = 0; bn_pollute(a); } crypto/rsa/rsa_x931g.c:60: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_X931_derive_prime_ex`. Showing all 18 steps of the trace crypto/rsa/rsa_x931g.c:44:18: Call 42. goto err; 43. if (!rsa->e) { 44. rsa->e = BN_dup(e); ^ 45. if (!rsa->e) 46. goto err; crypto/bn/bn_lib.c:354:10: Call 352. if (t == NULL) 353. return NULL; 354. if (!BN_copy(t, a)) { ^ 355. BN_free(t); 356. return NULL; crypto/bn/bn_lib.c:362:1: Parameter `*a->d` 360. } 361. 362. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 363. { 364. int i; crypto/rsa/rsa_x931g.c:60:14: Call 58. goto err; 59. 60. if (!BN_X931_derive_prime_ex(rsa->p, p1, p2, ^ 61. Xp, Xp1, Xp2, e, ctx, cb)) 62. goto err; crypto/bn/bn_x931p.c:51:1: Parameter `*p->d` 49. */ 50. 51. > int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, 52. const BIGNUM *Xp, const BIGNUM *Xp1, 53. const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, crypto/bn/bn_x931p.c:91:10: Call 89. /* First set p to value of Rp */ 90. 91. if (!BN_mod_inverse(p, p2, p1, ctx)) ^ 92. goto err; 93. crypto/bn/bn_gcd.c:124:1: Parameter `*in->d` 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 `*in->d` 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_x931p.c:94:10: Call 92. goto err; 93. 94. if (!BN_mul(p, p, p2, ctx)) ^ 95. goto err; 96. crypto/bn/bn_mul.c:879:13: Assignment 877. if (bn_wexpand(rr, 16) == NULL) 878. goto err; 879. rr->top = 16; ^ 880. bn_mul_comba8(rr->d, a->d, b->d); 881. goto end; crypto/bn/bn_mul.c:972:5: Call 970. end: 971. #endif 972. bn_correct_top(rr); ^ 973. if (r != rr && BN_copy(r, rr) == NULL) 974. goto err; crypto/bn/bn_lib.c:1021:1: <Offset trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `a->top` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1024:5: Assignment 1022. { 1023. BN_ULONG *ftl; 1024. int tmp_top = a->top; ^ 1025. 1026. if (tmp_top > 0) { crypto/bn/bn_lib.c:1021:1: <Length trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `*a->d` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_X931_derive_prime_ex` 1025. 1026. if (tmp_top > 0) { 1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ^ 1028. ftl--; 1029. if (*ftl != 0)
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L1027
d2a_code_trace_data_41697
int tls13_export_keying_material(SSL *s, unsigned char *out, size_t olen, const char *label, size_t llen, const unsigned char *context, size_t contextlen, int use_context) { unsigned char exportsecret[EVP_MAX_MD_SIZE]; static const unsigned char exporterlabel[] = "exporter"; unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; const EVP_MD *md = ssl_handshake_md(s); EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned int hashsize, datalen; int ret = 0; if (ctx == NULL || !ossl_statem_export_allowed(s)) goto err; if (!use_context) contextlen = 0; if (EVP_DigestInit_ex(ctx, md, NULL) <= 0 || EVP_DigestUpdate(ctx, context, contextlen) <= 0 || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0 || EVP_DigestInit_ex(ctx, md, NULL) <= 0 || EVP_DigestFinal_ex(ctx, data, &datalen) <= 0 || !tls13_hkdf_expand(s, md, s->exporter_master_secret, (const unsigned char *)label, llen, data, datalen, exportsecret, hashsize) || !tls13_hkdf_expand(s, md, exportsecret, exporterlabel, sizeof(exporterlabel) - 1, hash, hashsize, out, olen)) goto err; ret = 1; err: EVP_MD_CTX_free(ctx); return ret; } ssl/tls13_enc.c:757: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 732, column 23 is not reachable after line 757, column 5. Showing all 51 steps of the trace ssl/tls13_enc.c:723:1: start of procedure tls13_export_keying_material() 721. } 722. 723. > int tls13_export_keying_material(SSL *s, unsigned char *out, size_t olen, 724. const char *label, size_t llen, 725. const unsigned char *context, ssl/tls13_enc.c:729:5: 727. { 728. unsigned char exportsecret[EVP_MAX_MD_SIZE]; 729. > static const unsigned char exporterlabel[] = "exporter"; 730. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 731. const EVP_MD *md = ssl_handshake_md(s); ssl/tls13_enc.c:731:5: 729. static const unsigned char exporterlabel[] = "exporter"; 730. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 731. > const EVP_MD *md = ssl_handshake_md(s); 732. EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 733. unsigned int hashsize, datalen; test/tls13secretstest.c:155:1: start of procedure ssl_handshake_md() 153. } 154. 155. > const EVP_MD *ssl_handshake_md(SSL *s) 156. { 157. return EVP_sha256(); test/tls13secretstest.c:157:5: 155. const EVP_MD *ssl_handshake_md(SSL *s) 156. { 157. > return EVP_sha256(); 158. } 159. crypto/evp/m_sha1.c:177:1: start of procedure EVP_sha256() 175. }; 176. 177. > const EVP_MD *EVP_sha256(void) 178. { 179. return &sha256_md; crypto/evp/m_sha1.c:179:5: 177. const EVP_MD *EVP_sha256(void) 178. { 179. > return &sha256_md; 180. } 181. crypto/evp/m_sha1.c:180:1: return from a call to EVP_sha256 178. { 179. return &sha256_md; 180. > } 181. 182. static int init512_224(EVP_MD_CTX *ctx) test/tls13secretstest.c:158:1: return from a call to ssl_handshake_md 156. { 157. return EVP_sha256(); 158. > } 159. 160. void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl) ssl/tls13_enc.c:732:5: 730. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 731. const EVP_MD *md = ssl_handshake_md(s); 732. > EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 733. unsigned int hashsize, datalen; 734. int ret = 0; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new() 47. } 48. 49. > EVP_MD_CTX *EVP_MD_CTX_new(void) 50. { 51. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:51:5: 49. EVP_MD_CTX *EVP_MD_CTX_new(void) 50. { 51. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 52. } 53. crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:52:1: return from a call to EVP_MD_CTX_new 50. { 51. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 52. > } 53. 54. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/tls13_enc.c:734:5: 732. EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 733. unsigned int hashsize, datalen; 734. > int ret = 0; 735. 736. if (ctx == NULL || !ossl_statem_export_allowed(s)) ssl/tls13_enc.c:736:9: Taking false branch 734. int ret = 0; 735. 736. if (ctx == NULL || !ossl_statem_export_allowed(s)) ^ 737. goto err; 738. ssl/tls13_enc.c:736:25: 734. int ret = 0; 735. 736. > if (ctx == NULL || !ossl_statem_export_allowed(s)) 737. goto err; 738. test/tls13secretstest.c:199:1: start of procedure ossl_statem_export_allowed() 197. } 198. 199. > int ossl_statem_export_allowed(SSL *s) 200. { 201. return 1; test/tls13secretstest.c:201:5: 199. int ossl_statem_export_allowed(SSL *s) 200. { 201. > return 1; 202. } 203. test/tls13secretstest.c:202:1: return from a call to ossl_statem_export_allowed 200. { 201. return 1; 202. > } 203. 204. int ossl_statem_export_early_allowed(SSL *s) ssl/tls13_enc.c:736:25: Taking false branch 734. int ret = 0; 735. 736. if (ctx == NULL || !ossl_statem_export_allowed(s)) ^ 737. goto err; 738. ssl/tls13_enc.c:739:10: Taking false branch 737. goto err; 738. 739. if (!use_context) ^ 740. contextlen = 0; 741. ssl/tls13_enc.c:742:9: Taking true branch 740. contextlen = 0; 741. 742. if (EVP_DigestInit_ex(ctx, md, NULL) <= 0 ^ 743. || EVP_DigestUpdate(ctx, context, contextlen) <= 0 744. || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0 ssl/tls13_enc.c:756:2: 754. 755. ret = 1; 756. > err: 757. EVP_MD_CTX_free(ctx); 758. return ret; ssl/tls13_enc.c:757:5: 755. ret = 1; 756. err: 757. > EVP_MD_CTX_free(ctx); 758. return ret; 759. } crypto/evp/digest.c:54:1: start of procedure EVP_MD_CTX_free() 52. } 53. 54. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 55. { 56. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:56:5: Skipping EVP_MD_CTX_reset(): empty list of specs 54. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 55. { 56. EVP_MD_CTX_reset(ctx); ^ 57. OPENSSL_free(ctx); 58. } crypto/evp/digest.c:57:5: 55. { 56. EVP_MD_CTX_reset(ctx); 57. > OPENSSL_free(ctx); 58. } 59. crypto/mem.c:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:58:1: return from a call to EVP_MD_CTX_free 56. EVP_MD_CTX_reset(ctx); 57. OPENSSL_free(ctx); 58. > } 59. 60. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
https://github.com/openssl/openssl/blob/b44882a0bd0717e0aab84f5dc3ef81ab673155e9/ssl/tls13_enc.c/#L757
d2a_code_trace_data_41698
int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, void *keyenc, void *keydec) { memcpy(dest, src, sizeof(OCB128_CONTEXT)); if (keyenc) dest->keyenc = keyenc; if (keydec) dest->keydec = keydec; if (src->l) { dest->l = OPENSSL_malloc(src->max_l_index * 16); if (dest->l == NULL) return 0; memcpy(dest->l, src->l, (src->l_index + 1) * 16); } return 1; } crypto/evp/e_aes.c:2427: error: BUFFER_OVERRUN_L3 Offset added: [16, +oo] Size: [1, +oo] by call to `CRYPTO_ocb128_copy_ctx`. Showing all 9 steps of the trace crypto/evp/e_aes.c:2427:16: Call 2425. newc = (EVP_CIPHER_CTX *)ptr; 2426. new_octx = EVP_C_DATA(EVP_AES_OCB_CTX,newc); 2427. return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb, ^ 2428. &new_octx->ksenc.ks, 2429. &new_octx->ksdec.ks); crypto/modes/ocb128.c:242:1: <Offset trace> 240. * Copy an OCB128_CONTEXT object 241. */ 242. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 243. void *keyenc, void *keydec) 244. { crypto/modes/ocb128.c:242:1: Parameter `src->l_index` 240. * Copy an OCB128_CONTEXT object 241. */ 242. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 243. void *keyenc, void *keydec) 244. { crypto/modes/ocb128.c:242:1: <Length trace> 240. * Copy an OCB128_CONTEXT object 241. */ 242. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 243. void *keyenc, void *keydec) 244. { crypto/modes/ocb128.c:242:1: Parameter `src->max_l_index` 240. * Copy an OCB128_CONTEXT object 241. */ 242. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 243. void *keyenc, void *keydec) 244. { crypto/modes/ocb128.c:251:19: Call 249. dest->keydec = keydec; 250. if (src->l) { 251. dest->l = OPENSSL_malloc(src->max_l_index * 16); ^ 252. if (dest->l == NULL) 253. return 0; crypto/mem.c:125:9: Assignment 123. 124. if (num <= 0) 125. return NULL; ^ 126. 127. allow_customize = 0; crypto/modes/ocb128.c:251:9: Assignment 249. dest->keydec = keydec; 250. if (src->l) { 251. dest->l = OPENSSL_malloc(src->max_l_index * 16); ^ 252. if (dest->l == NULL) 253. return 0; crypto/modes/ocb128.c:254:9: Array access: Offset added: [16, +oo] Size: [1, +oo] by call to `CRYPTO_ocb128_copy_ctx` 252. if (dest->l == NULL) 253. return 0; 254. memcpy(dest->l, src->l, (src->l_index + 1) * 16); ^ 255. } 256. return 1;
https://github.com/openssl/openssl/blob/ac33c5a477568127ad99b1260a8978477de50e36/crypto/modes/ocb128.c/#L254
d2a_code_trace_data_41699
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } avconv.c:4101: error: Null Dereference pointer `today` last assigned on line 4099 could be null and is dereferenced at line 4101, column 69. avconv.c:4095:1: start of procedure opt_vstats() 4093. } 4094. 4095. static int opt_vstats(const char *opt, const char *arg) ^ 4096. { 4097. char filename[40]; avconv.c:4098:5: 4096. { 4097. char filename[40]; 4098. time_t today2 = time(NULL); ^ 4099. struct tm *today = localtime(&today2); 4100. avconv.c:4099:5: 4097. char filename[40]; 4098. time_t today2 = time(NULL); 4099. struct tm *today = localtime(&today2); ^ 4100. 4101. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv.c:4101:5: 4099. struct tm *today = localtime(&today2); 4100. 4101. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4102. today->tm_sec); 4103. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/e1edfbcb240cace69d92701e6910c2b03555b7d7/avconv.c/#L4101
d2a_code_trace_data_41700
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [336+min(0, `c->synth_buf_offset[*]`), 337+max(511, `c->synth_buf_offset[*]`)] (⇐ [16+min(0, `c->synth_buf_offset[*]`), 17+max(511, `c->synth_buf_offset[*]`)] + 320) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:896:5: Assignment 894. 895. sum = *dither_state; 896. p = synth_buf + 16; ^ 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; libavcodec/mpegaudiodec.c:897:5: Array access: Offset: [336+min(0, c->synth_buf_offset[*]), 337+max(511, c->synth_buf_offset[*])] (⇐ [16+min(0, c->synth_buf_offset[*]), 17+max(511, c->synth_buf_offset[*])] + 320) Size: 2 by call to `ff_mpa_synth_filter` 895. sum = *dither_state; 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); ^ 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L897
d2a_code_trace_data_41701
DECLAREContigPutFunc(putRGBcontig8bittile) { int samplesperpixel = img->samplesperpixel; (void) x; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { UNROLL8(w, NOP, *cp++ = PACK(pp[0], pp[1], pp[2]); pp += samplesperpixel); cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1242: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1236:1: <LHS trace> 1234. * 8-bit packed samples, no Map => RGB 1235. */ 1236. DECLAREContigPutFunc(putRGBcontig8bittile) ^ 1237. { 1238. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1236:1: Parameter `h` 1234. * 8-bit packed samples, no Map => RGB 1235. */ 1236. DECLAREContigPutFunc(putRGBcontig8bittile) ^ 1237. { 1238. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1242:12: Binary operation: ([0, h] - 1):unsigned32 1240. (void) x; (void) y; 1241. fromskew *= samplesperpixel; 1242. while (h-- > 0) { ^ 1243. UNROLL8(w, NOP, 1244. *cp++ = PACK(pp[0], pp[1], pp[2]);
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1242
d2a_code_trace_data_41702
static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2, const DVprofile *sys) { int size, chan, i, j, d, of, smpls, freq, quant, half_ch; uint16_t lc, rc; const uint8_t* as_pack; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack) return 0; smpls = as_pack[1] & 0x3f; freq = (as_pack[4] >> 3) & 0x07; quant = as_pack[4] & 0x07; if (quant > 1) return -1; size = (sys->audio_min_samples[freq] + smpls) * 4; half_ch = sys->difseg_size/2; for (chan = 0; chan < sys->n_difchan; chan++) { for (i = 0; i < sys->difseg_size; i++) { frame += 6 * 80; if (quant == 1 && i == half_ch) { if (!pcm2) break; else pcm = pcm2; } for (j = 0; j < 9; j++) { for (d = 8; d < 80; d += 2) { if (quant == 0) { of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride; if (of*2 >= size) continue; pcm[of*2] = frame[d+1]; pcm[of*2+1] = frame[d]; if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00) pcm[of*2+1] = 0; } else { lc = ((uint16_t)frame[d] << 4) | ((uint16_t)frame[d+2] >> 4); rc = ((uint16_t)frame[d+1] << 4) | ((uint16_t)frame[d+2] & 0x0f); lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride; if (of*2 >= size) continue; pcm[of*2] = lc & 0xff; pcm[of*2+1] = lc >> 8; of = sys->audio_shuffle[i%half_ch+half_ch][j] + (d - 8)/3 * sys->audio_stride; pcm[of*2] = rc & 0xff; pcm[of*2+1] = rc >> 8; ++d; } } frame += 16 * 80; } } if(!pcm2) break; pcm = pcm2; } return size; } libavformat/dv.c:414: error: Buffer Overrun L2 Offset: [0, 7] Size: 3 by call to `dv_produce_packet`. libavformat/dv.c:411:13: Call 409. if (size < 0) { 410. size = c->dv_demux->sys->frame_size; 411. if (get_buffer(s->pb, c->buf, size) <= 0) ^ 412. return AVERROR(EIO); 413. libavformat/aviobuf.c:365:1: Parameter `*buf` 363. } 364. 365. int get_buffer(ByteIOContext *s, unsigned char *buf, int size) ^ 366. { 367. int len, size1; libavformat/dv.c:414:16: Call 412. return AVERROR(EIO); 413. 414. size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); ^ 415. } 416. libavformat/dv.c:309:1: Parameter `*buf` 307. } 308. 309. int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, ^ 310. uint8_t* buf, int buf_size) 311. { libavformat/dv.c:315:20: Call 313. 314. if (buf_size < DV_PROFILE_BYTES || 315. !(c->sys = dv_frame_profile(buf)) || ^ 316. buf_size < c->sys->frame_size) { 317. return -1; /* Broken frame, or not enough data */ libavcodec/dvdata.h:2664:1: Parameter `*frame` 2662. #define DV_MAX_FRAME_SIZE 288000 2663. 2664. static inline const DVprofile* dv_frame_profile(const uint8_t* frame) ^ 2665. { 2666. if ((frame[3] & 0x80) == 0) { /* DSF flag */ libavformat/dv.c:322:12: Call 320. /* Queueing audio packet */ 321. /* FIXME: in case of no audio/bad audio we have to do something */ 322. size = dv_extract_audio_info(c, buf); ^ 323. for (i=0; i<c->ach; i++) { 324. c->audio_pkt[i].size = size; libavformat/dv.c:182:1: Parameter `*frame` 180. } 181. 182. static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) ^ 183. { 184. const uint8_t* as_pack; libavformat/dv.c:187:15: Call 185. int freq, stype, smpls, quant, i, ach; 186. 187. as_pack = dv_extract_pack(frame, dv_audio_source); ^ 188. if (!as_pack || !c->sys) { /* No audio ? */ 189. c->ach = 0; libavformat/dv.c:72:1: Parameter `t` 70. * to have a fallback mechanism for complete search of missing packs. 71. */ 72. static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t) ^ 73. { 74. int offs; libavformat/dv.c:327:5: Call 325. c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate; 326. } 327. dv_extract_audio(buf, c->audio_buf[0], c->audio_buf[1], c->sys); ^ 328. c->abytes += size; 329. libavformat/dv.c:101:1: <Offset trace> 99. * are converted into 16bit linear ones. 100. */ 101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2, ^ 102. const DVprofile *sys) 103. { libavformat/dv.c:101:1: Parameter `*frame` 99. * are converted into 16bit linear ones. 100. */ 101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2, ^ 102. const DVprofile *sys) 103. { libavformat/dv.c:108:15: Call 106. const uint8_t* as_pack; 107. 108. as_pack = dv_extract_pack(frame, dv_audio_source); ^ 109. if (!as_pack) /* No audio ? */ 110. return 0; libavformat/dv.c:72:1: Parameter `t` 70. * to have a fallback mechanism for complete search of missing packs. 71. */ 72. static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t) ^ 73. { 74. int offs; libavformat/dv.c:113:5: Assignment 111. 112. smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ 113. freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48KHz, 1 - 44,1kHz, 2 - 32 kHz */ ^ 114. quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ 115. libavformat/dv.c:101:1: <Length trace> 99. * are converted into 16bit linear ones. 100. */ 101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2, ^ 102. const DVprofile *sys) 103. { libavformat/dv.c:101:1: Parameter `sys->audio_min_samples[*]` 99. * are converted into 16bit linear ones. 100. */ 101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2, ^ 102. const DVprofile *sys) 103. { libavformat/dv.c:119:13: Array access: Offset: [0, 7] Size: 3 by call to `dv_produce_packet` 117. return -1; /* Unsupported quantization */ 118. 119. size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */ ^ 120. half_ch = sys->difseg_size/2; 121.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/dv.c/#L119
d2a_code_trace_data_41703
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:137: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked`. Showing all 47 steps of the trace crypto/rsa/rsa_ossl.c:96:5: Call 94. if ((ctx = BN_CTX_new()) == NULL) 95. goto err; 96. BN_CTX_start(ctx); ^ 97. f = BN_CTX_get(ctx); 98. ret = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/rsa/rsa_ossl.c:137:14: Call 135. 136. if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) 137. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock, ^ 138. rsa->n, ctx)) 139. goto err; crypto/bn/bn_mont.c:428:1: Parameter `ctx->stack.depth` 426. } 427. 428. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 429. const BIGNUM *mod, BN_CTX *ctx) 430. { crypto/bn/bn_mont.c:450:10: Call 448. if (ret == NULL) 449. return NULL; 450. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 451. BN_MONT_CTX_free(ret); 452. return NULL; crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked` 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_41704
int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header) { uint8_t rps_predict = 0; int delta_poc; int k0 = 0; int k1 = 0; int k = 0; int i; if (rps != sps->st_rps && sps->nb_st_rps) rps_predict = get_bits1(gb); if (rps_predict) { const ShortTermRPS *rps_ridx; int delta_rps, abs_delta_rps; uint8_t use_delta_flag = 0; uint8_t delta_rps_sign; if (is_slice_header) { unsigned int delta_idx = get_ue_golomb_long(gb) + 1; if (delta_idx > sps->nb_st_rps) { av_log(avctx, AV_LOG_ERROR, "Invalid value of delta_idx in slice header RPS: %d > %d.\n", delta_idx, sps->nb_st_rps); return AVERROR_INVALIDDATA; } rps_ridx = &sps->st_rps[sps->nb_st_rps - delta_idx]; rps->rps_idx_num_delta_pocs = rps_ridx->num_delta_pocs; } else rps_ridx = &sps->st_rps[rps - sps->st_rps - 1]; delta_rps_sign = get_bits1(gb); abs_delta_rps = get_ue_golomb_long(gb) + 1; delta_rps = (1 - (delta_rps_sign << 1)) * abs_delta_rps; for (i = 0; i <= rps_ridx->num_delta_pocs; i++) { int used = rps->used[k] = get_bits1(gb); if (!used) use_delta_flag = get_bits1(gb); if (used || use_delta_flag) { if (i < rps_ridx->num_delta_pocs) delta_poc = delta_rps + rps_ridx->delta_poc[i]; else delta_poc = delta_rps; rps->delta_poc[k] = delta_poc; if (delta_poc < 0) k0++; else k1++; k++; } } rps->num_delta_pocs = k; rps->num_negative_pics = k0; if (rps->num_delta_pocs != 0) { int used, tmp; for (i = 1; i < rps->num_delta_pocs; i++) { delta_poc = rps->delta_poc[i]; used = rps->used[i]; for (k = i - 1; k >= 0; k--) { tmp = rps->delta_poc[k]; if (delta_poc < tmp) { rps->delta_poc[k + 1] = tmp; rps->used[k + 1] = rps->used[k]; rps->delta_poc[k] = delta_poc; rps->used[k] = used; } } } } if ((rps->num_negative_pics >> 1) != 0) { int used; k = rps->num_negative_pics - 1; for (i = 0; i < rps->num_negative_pics >> 1; i++) { delta_poc = rps->delta_poc[i]; used = rps->used[i]; rps->delta_poc[i] = rps->delta_poc[k]; rps->used[i] = rps->used[k]; rps->delta_poc[k] = delta_poc; rps->used[k] = used; k--; } } } else { unsigned int prev, nb_positive_pics; rps->num_negative_pics = get_ue_golomb_long(gb); nb_positive_pics = get_ue_golomb_long(gb); if (rps->num_negative_pics >= MAX_REFS || nb_positive_pics >= MAX_REFS) { av_log(avctx, AV_LOG_ERROR, "Too many refs in a short term RPS.\n"); return AVERROR_INVALIDDATA; } rps->num_delta_pocs = rps->num_negative_pics + nb_positive_pics; if (rps->num_delta_pocs) { prev = 0; for (i = 0; i < rps->num_negative_pics; i++) { delta_poc = get_ue_golomb_long(gb) + 1; prev -= delta_poc; rps->delta_poc[i] = prev; rps->used[i] = get_bits1(gb); } prev = 0; for (i = 0; i < nb_positive_pics; i++) { delta_poc = get_ue_golomb_long(gb) + 1; prev += delta_poc; rps->delta_poc[rps->num_negative_pics + i] = prev; rps->used[rps->num_negative_pics + i] = get_bits1(gb); } } } return 0; } libavcodec/hevc_ps.c:873: error: Integer Overflow L2 ([1, 64] - [-oo, 64]):unsigned32 by call to `ff_hevc_decode_short_term_rps`. libavcodec/hevc_ps.c:872:10: Assignment 870. goto err; 871. } 872. for (i = 0; i < sps->nb_st_rps; i++) { ^ 873. if ((ret = ff_hevc_decode_short_term_rps(gb, avctx, &sps->st_rps[i], 874. sps, 0)) < 0) libavcodec/hevc_ps.c:873:20: Call 871. } 872. for (i = 0; i < sps->nb_st_rps; i++) { 873. if ((ret = ff_hevc_decode_short_term_rps(gb, avctx, &sps->st_rps[i], ^ 874. sps, 0)) < 0) 875. goto err; libavcodec/hevc_ps.c:109:1: <LHS trace> 107. } 108. 109. int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ^ 110. ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header) 111. { libavcodec/hevc_ps.c:109:1: Parameter `sps->nb_st_rps` 107. } 108. 109. int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ^ 110. ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header) 111. { libavcodec/hevc_ps.c:109:1: <RHS trace> 107. } 108. 109. int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ^ 110. ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header) 111. { libavcodec/hevc_ps.c:109:1: Parameter `sps->nb_st_rps` 107. } 108. 109. int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ^ 110. ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header) 111. { libavcodec/hevc_ps.c:136:13: Binary operation: ([1, 64] - [-oo, 64]):unsigned32 by call to `ff_hevc_decode_short_term_rps` 134. return AVERROR_INVALIDDATA; 135. } 136. rps_ridx = &sps->st_rps[sps->nb_st_rps - delta_idx]; ^ 137. rps->rps_idx_num_delta_pocs = rps_ridx->num_delta_pocs; 138. } else
https://github.com/libav/libav/blob/8c399bd5cefd572eceb448981fcb6d4dbca35d27/libavcodec/hevc_ps.c/#L136
d2a_code_trace_data_41705
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", _asn1_mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/ocsp/ocsp_prn.c:237: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 11 steps of the trace crypto/ocsp/ocsp_prn.c:216:15: Call 214. } 215. 216. if ((br = OCSP_response_get1_basic(o)) == NULL) ^ 217. goto err; 218. rd = &br->tbsResponseData; crypto/ocsp/ocsp_cl.c:204:1: Parameter `*resp->responseBytes->response->data` 202. */ 203. 204. > OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp) 205. { 206. OCSP_RESPBYTES *rb; crypto/ocsp/ocsp_prn.c:219:9: Call 217. goto err; 218. rd = &br->tbsResponseData; 219. l = ASN1_INTEGER_get(rd->version); ^ 220. if (BIO_printf(bp, "\n Version: %lu (0x%lx)\n", l + 1, l) <= 0) 221. goto err; crypto/asn1/a_int.c:608:1: Parameter `*a->data` 606. } 607. 608. > long ASN1_INTEGER_get(const ASN1_INTEGER *a) 609. { 610. int i; crypto/ocsp/ocsp_prn.c:237:10: Call 235. if (BIO_printf(bp, "\n Produced At: ") <= 0) 236. goto err; 237. if (!ASN1_GENERALIZEDTIME_print(bp, rd->producedAt)) ^ 238. goto err; 239. if (BIO_printf(bp, "\n Responses:\n") <= 0) crypto/asn1/a_gentm.c:266:1: <Offset trace> 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data` 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:287:5: Assignment 285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 286. + (v[2] - '0') * 10 + (v[3] - '0'); 287. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 288. if ((M > 12) || (M < 1)) 289. goto err; crypto/asn1/a_gentm.c:261:1: <Length trace> 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:261:1: Array declaration 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 306. 307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 309. (gmt) ? " GMT" : "") <= 0) 310. return (0);
https://github.com/openssl/openssl/blob/84cf97af0691290d53c0a51807fa15f0843219ef/crypto/asn1/a_gentm.c/#L308
d2a_code_trace_data_41706
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; unsigned int currbuf = 0; if ((s->rlayer.wpend_tot > (int)len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return (-1); } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], i); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; return (s->rlayer.wpend_ret); } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return (i); } SSL3_BUFFER_add_offset(&wb[currbuf], i); SSL3_BUFFER_add_left(&wb[currbuf], -i); } } ssl/record/rec_layer_d1.c:437: error: INTEGER_OVERFLOW_L2 ([0, max(1, `s->rlayer.numwpipes`)] - 1):unsigned32 by call to `dtls1_read_failed`. Showing all 25 steps of the trace ssl/record/rec_layer_d1.c:338:1: Parameter `s->rlayer.numwpipes` 336. * none of our business 337. */ 338. > int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, 339. int len, int peek) 340. { ssl/record/rec_layer_d1.c:429:9: Call 427. 428. /* Check for timeout */ 429. if (dtls1_handle_timeout(s) > 0) ^ 430. goto start; 431. ssl/d1_lib.c:355:1: Parameter `s->rlayer.numwpipes` 353. } 354. 355. > int dtls1_handle_timeout(SSL *s) 356. { 357. /* if no timer is expired, don't do anything */ ssl/record/rec_layer_d1.c:435:15: Call 433. if ((SSL3_RECORD_get_length(rr) == 0) 434. || (s->rlayer.rstate == SSL_ST_READ_BODY)) { 435. ret = dtls1_get_record(s); ^ 436. if (ret <= 0) { 437. ret = dtls1_read_failed(s, ret); ssl/record/ssl3_record.c:1462:1: Parameter `s->rlayer.numwpipes` 1460. */ 1461. /* used only by dtls1_read_bytes */ 1462. > int dtls1_get_record(SSL *s) 1463. { 1464. int ssl_major, ssl_minor; ssl/record/ssl3_record.c:1479:10: Call 1477. * This is a non-blocking operation. 1478. */ 1479. if (!dtls1_process_buffered_records(s)) ^ 1480. return -1; 1481. ssl/record/rec_layer_d1.c:229:1: Parameter `s->rlayer.numwpipes` 227. &((s)->rlayer.d->unprocessed_rcds)) 228. 229. > int dtls1_process_buffered_records(SSL *s) 230. { 231. pitem *item; ssl/record/rec_layer_d1.c:437:19: Call 435. ret = dtls1_get_record(s); 436. if (ret <= 0) { 437. ret = dtls1_read_failed(s, ret); ^ 438. /* anything other than a timeout is an error */ 439. if (ret <= 0) ssl/statem/statem_dtls.c:912:1: Parameter `s->rlayer.numwpipes` 910. #endif 911. 912. > int dtls1_read_failed(SSL *s, int code) 913. { 914. if (code > 0) { ssl/statem/statem_dtls.c:938:12: Call 936. } 937. 938. return dtls1_handle_timeout(s); ^ 939. } 940. ssl/d1_lib.c:355:1: Parameter `s->rlayer.numwpipes` 353. } 354. 355. > int dtls1_handle_timeout(SSL *s) 356. { 357. /* if no timer is expired, don't do anything */ ssl/d1_lib.c:379:12: Call 377. 378. dtls1_start_timer(s); 379. return dtls1_retransmit_buffered_messages(s); ^ 380. } 381. ssl/statem/statem_dtls.c:956:1: Parameter `s->rlayer.numwpipes` 954. } 955. 956. > int dtls1_retransmit_buffered_messages(SSL *s) 957. { 958. pqueue *sent = s->d1->sent_messages; ssl/statem/statem_dtls.c:968:13: Call 966. for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) { 967. frag = (hm_fragment *)item->data; 968. if (dtls1_retransmit_message(s, (unsigned short) ^ 969. dtls1_get_queue_priority 970. (frag->msg_header.seq, ssl/statem/statem_dtls.c:1042:1: Parameter `s->rlayer.numwpipes` 1040. } 1041. 1042. > int dtls1_retransmit_message(SSL *s, unsigned short seq, int *found) 1043. { 1044. int ret; ssl/statem/statem_dtls.c:1104:11: Call 1102. saved_retransmit_state.epoch); 1103. 1104. ret = dtls1_do_write(s, frag->msg_header.is_ccs ? ^ 1105. SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); 1106. ssl/statem/statem_dtls.c:111:1: Parameter `s->rlayer.numwpipes` 109. * SSL3_RT_CHANGE_CIPHER_SPEC) 110. */ 111. > int dtls1_do_write(SSL *s, int type) 112. { 113. int ret; ssl/statem/statem_dtls.c:239:15: Call 237. } 238. 239. ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len); ^ 240. if (ret < 0) { 241. /* ssl/record/rec_layer_d1.c:953:1: Parameter `s->rlayer.numwpipes` 951. * not all data has been sent or non-blocking IO. 952. */ 953. > int dtls1_write_bytes(SSL *s, int type, const void *buf, int len) 954. { 955. int i; ssl/record/rec_layer_d1.c:959:9: Call 957. OPENSSL_assert(len <= SSL3_RT_MAX_PLAIN_LENGTH); 958. s->rwstate = SSL_NOTHING; 959. i = do_dtls1_write(s, type, buf, len, 0); ^ 960. return i; 961. } ssl/record/rec_layer_d1.c:963:1: Parameter `s->rlayer.numwpipes` 961. } 962. 963. > int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 964. unsigned int len, int create_empty_fragment) 965. { ssl/record/rec_layer_d1.c:1151:12: Call 1149. 1150. /* we now just need to write the buffer */ 1151. return ssl3_write_pending(s, type, buf, len); ^ 1152. err: 1153. return -1; ssl/record/rec_layer_s3.c:878:1: <LHS trace> 876. 877. /* if s->s3->wbuf.left != 0, we need to call this */ 878. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, 879. unsigned int len) 880. { ssl/record/rec_layer_s3.c:878:1: Parameter `s->rlayer.numwpipes` 876. 877. /* if s->s3->wbuf.left != 0, we need to call this */ 878. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, 879. unsigned int len) 880. { ssl/record/rec_layer_s3.c:897:16: Binary operation: ([0, max(1, s->rlayer.numwpipes)] - 1):unsigned32 by call to `dtls1_read_failed` 895. /* Loop until we find a buffer we haven't written out yet */ 896. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 897. && currbuf < s->rlayer.numwpipes - 1) { ^ 898. currbuf++; 899. continue;
https://github.com/openssl/openssl/blob/1fb9fdc3027b27d8eb6a1e6a846435b070980770/ssl/record/rec_layer_s3.c/#L897
d2a_code_trace_data_41707
static int group_field_test(void) { int r = 1; BIGNUM *secp521r1_field = NULL; BIGNUM *sect163r2_field = NULL; EC_GROUP *secp521r1_group = NULL; EC_GROUP *sect163r2_group = NULL; BN_hex2bn(&secp521r1_field, "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFF"); BN_hex2bn(&sect163r2_field, "08000000000000000000000000000000" "00000000C9"); secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1); if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group))) r = 0; # ifndef OPENSSL_NO_EC2M sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2); if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group))) r = 0; # endif EC_GROUP_free(secp521r1_group); EC_GROUP_free(sect163r2_group); BN_free(secp521r1_field); BN_free(sect163r2_field); return r; } test/ectest.c:1184: error: NULL_DEREFERENCE pointer `secp521r1_group` last assigned on line 1183 could be null and is dereferenced by call to `EC_GROUP_get0_field()` at line 1184, column 33. Showing all 23 steps of the trace test/ectest.c:1163:1: start of procedure group_field_test() 1161. } 1162. 1163. > static int group_field_test(void) 1164. { 1165. int r = 1; test/ectest.c:1165:5: 1163. static int group_field_test(void) 1164. { 1165. > int r = 1; 1166. BIGNUM *secp521r1_field = NULL; 1167. BIGNUM *sect163r2_field = NULL; test/ectest.c:1166:5: 1164. { 1165. int r = 1; 1166. > BIGNUM *secp521r1_field = NULL; 1167. BIGNUM *sect163r2_field = NULL; 1168. EC_GROUP *secp521r1_group = NULL; test/ectest.c:1167:5: 1165. int r = 1; 1166. BIGNUM *secp521r1_field = NULL; 1167. > BIGNUM *sect163r2_field = NULL; 1168. EC_GROUP *secp521r1_group = NULL; 1169. EC_GROUP *sect163r2_group = NULL; test/ectest.c:1168:5: 1166. BIGNUM *secp521r1_field = NULL; 1167. BIGNUM *sect163r2_field = NULL; 1168. > EC_GROUP *secp521r1_group = NULL; 1169. EC_GROUP *sect163r2_group = NULL; 1170. test/ectest.c:1169:5: 1167. BIGNUM *sect163r2_field = NULL; 1168. EC_GROUP *secp521r1_group = NULL; 1169. > EC_GROUP *sect163r2_group = NULL; 1170. 1171. BN_hex2bn(&secp521r1_field, test/ectest.c:1171:5: Skipping BN_hex2bn(): empty list of specs 1169. EC_GROUP *sect163r2_group = NULL; 1170. 1171. BN_hex2bn(&secp521r1_field, ^ 1172. "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 1173. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" test/ectest.c:1179:5: Skipping BN_hex2bn(): empty list of specs 1177. 1178. 1179. BN_hex2bn(&sect163r2_field, ^ 1180. "08000000000000000000000000000000" 1181. "00000000C9"); test/ectest.c:1183:5: 1181. "00000000C9"); 1182. 1183. > secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1); 1184. if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group))) 1185. r = 0; crypto/ec/ec_curve.c:3121:1: start of procedure EC_GROUP_new_by_curve_name() 3119. } 3120. 3121. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid) 3122. { 3123. size_t i; crypto/ec/ec_curve.c:3124:5: 3122. { 3123. size_t i; 3124. > EC_GROUP *ret = NULL; 3125. 3126. if (nid <= 0) crypto/ec/ec_curve.c:3126:9: Taking false branch 3124. EC_GROUP *ret = NULL; 3125. 3126. if (nid <= 0) ^ 3127. return NULL; 3128. crypto/ec/ec_curve.c:3129:10: 3127. return NULL; 3128. 3129. > for (i = 0; i < curve_list_length; i++) 3130. if (curve_list[i].nid == nid) { 3131. ret = ec_group_new_from_data(curve_list[i]); crypto/ec/ec_curve.c:3129:17: Loop condition is true. Entering loop body 3127. return NULL; 3128. 3129. for (i = 0; i < curve_list_length; i++) ^ 3130. if (curve_list[i].nid == nid) { 3131. ret = ec_group_new_from_data(curve_list[i]); crypto/ec/ec_curve.c:3130:13: Taking true branch 3128. 3129. for (i = 0; i < curve_list_length; i++) 3130. if (curve_list[i].nid == nid) { ^ 3131. ret = ec_group_new_from_data(curve_list[i]); 3132. break; crypto/ec/ec_curve.c:3131:13: Skipping ec_group_new_from_data(): empty list of specs 3129. for (i = 0; i < curve_list_length; i++) 3130. if (curve_list[i].nid == nid) { 3131. ret = ec_group_new_from_data(curve_list[i]); ^ 3132. break; 3133. } crypto/ec/ec_curve.c:3135:9: Taking true branch 3133. } 3134. 3135. if (ret == NULL) { ^ 3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP); 3137. return NULL; crypto/ec/ec_curve.c:3136:9: Skipping ERR_put_error(): empty list of specs 3134. 3135. if (ret == NULL) { 3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP); ^ 3137. return NULL; 3138. } crypto/ec/ec_curve.c:3137:9: 3135. if (ret == NULL) { 3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP); 3137. > return NULL; 3138. } 3139. crypto/ec/ec_curve.c:3141:1: return from a call to EC_GROUP_new_by_curve_name 3139. 3140. return ret; 3141. > } 3142. 3143. size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems) test/ectest.c:1184:9: 1182. 1183. secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1); 1184. > if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group))) 1185. r = 0; 1186. crypto/ec/ec_lib.c:369:1: start of procedure EC_GROUP_get0_field() 367. } 368. 369. > const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group) 370. { 371. return group->field; crypto/ec/ec_lib.c:371:5: 369. const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group) 370. { 371. > return group->field; 372. } 373.
https://github.com/openssl/openssl/blob/8d4f150f70d70d6c3e62661ed7cc16c2f751d8a1/test/ectest.c/#L1184
d2a_code_trace_data_41708
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:108: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 249):unsigned64 by call to `PACKET_forward`. Showing all 14 steps of the trace test/packettest.c:105:10: Call 103. PACKET pkt; 104. 105. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 106. || !TEST_true(PACKET_get_net_3(&pkt, &i)) 107. || !TEST_ulong_eq(i, 0x020406UL) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:106:17: Call 104. 105. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 106. || !TEST_true(PACKET_get_net_3(&pkt, &i)) ^ 107. || !TEST_ulong_eq(i, 0x020406UL) 108. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 6)) ssl/packet_locl.h:194:8: Parameter `pkt->remaining` 192. /* Equivalent of n2l3 */ 193. /* Get 3 bytes in network order from |pkt| and store the value in |*data| */ 194. __owur static ossl_inline int PACKET_get_net_3(PACKET *pkt, unsigned long *data) ^ 195. { 196. if (!PACKET_peek_net_3(pkt, data)) ssl/packet_locl.h:196:10: Call 194. __owur static ossl_inline int PACKET_get_net_3(PACKET *pkt, unsigned long *data) 195. { 196. if (!PACKET_peek_net_3(pkt, data)) ^ 197. return 0; 198. ssl/packet_locl.h:179:8: Parameter `pkt->remaining` 177. * |*data| 178. */ 179. __owur static ossl_inline int PACKET_peek_net_3(const PACKET *pkt, ^ 180. unsigned long *data) 181. { test/packettest.c:108:17: Call 106. || !TEST_true(PACKET_get_net_3(&pkt, &i)) 107. || !TEST_ulong_eq(i, 0x020406UL) 108. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 6)) ^ 109. || !TEST_true(PACKET_get_net_3(&pkt, &i)) 110. || !TEST_ulong_eq(i, 0xfafcfeUL) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 249):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_41709
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) { #ifndef OPENSSL_NO_RSA unsigned char *encdata = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = NULL; size_t enclen; unsigned char *pms = NULL; size_t pmslen = 0; if (s->session->peer == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pkey = X509_get0_pubkey(s->session->peer); if (EVP_PKEY_get0_RSA(pkey) == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pmslen = SSL_MAX_MASTER_KEY_LENGTH; pms = OPENSSL_malloc(pmslen); if (pms == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); *al = SSL_AD_INTERNAL_ERROR; return 0; } pms[0] = s->client_version >> 8; pms[1] = s->client_version & 0xff; if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { goto err; } if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } pctx = EVP_PKEY_CTX_new(pkey, NULL); if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0 || EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB); goto err; } if (!WPACKET_allocate_bytes(pkt, enclen, &encdata) || EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT); goto err; } EVP_PKEY_CTX_free(pctx); pctx = NULL; # ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) (*p)[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0] = 0x70; # endif if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } s->s3->tmp.pms = pms; s->s3->tmp.pmslen = pmslen; if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) goto err; return 1; err: OPENSSL_clear_free(pms, pmslen); EVP_PKEY_CTX_free(pctx); return 0; #else SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); *al = SSL_AD_INTERNAL_ERROR; return 0; #endif } ssl/statem/statem_clnt.c:2745: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 2691, column 11 is not reachable after line 2745, column 5. Showing all 66 steps of the trace ssl/statem/statem_clnt.c:2666:1: start of procedure tls_construct_cke_rsa() 2664. } 2665. 2666. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) 2667. { 2668. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2669:5: 2667. { 2668. #ifndef OPENSSL_NO_RSA 2669. > unsigned char *encdata = NULL; 2670. EVP_PKEY *pkey = NULL; 2671. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2670:5: 2668. #ifndef OPENSSL_NO_RSA 2669. unsigned char *encdata = NULL; 2670. > EVP_PKEY *pkey = NULL; 2671. EVP_PKEY_CTX *pctx = NULL; 2672. size_t enclen; ssl/statem/statem_clnt.c:2671:5: 2669. unsigned char *encdata = NULL; 2670. EVP_PKEY *pkey = NULL; 2671. > EVP_PKEY_CTX *pctx = NULL; 2672. size_t enclen; 2673. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2673:5: 2671. EVP_PKEY_CTX *pctx = NULL; 2672. size_t enclen; 2673. > unsigned char *pms = NULL; 2674. size_t pmslen = 0; 2675. ssl/statem/statem_clnt.c:2674:5: 2672. size_t enclen; 2673. unsigned char *pms = NULL; 2674. > size_t pmslen = 0; 2675. 2676. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2676:9: Taking false branch 2674. size_t pmslen = 0; 2675. 2676. if (s->session->peer == NULL) { ^ 2677. /* 2678. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2684:5: 2682. } 2683. 2684. > pkey = X509_get0_pubkey(s->session->peer); 2685. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2686. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); crypto/x509/x509_cmp.c:265:1: start of procedure X509_get0_pubkey() 263. } 264. 265. > EVP_PKEY *X509_get0_pubkey(const X509 *x) 266. { 267. if (x == NULL) crypto/x509/x509_cmp.c:267:9: Taking false branch 265. EVP_PKEY *X509_get0_pubkey(const X509 *x) 266. { 267. if (x == NULL) ^ 268. return NULL; 269. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:269:5: 267. if (x == NULL) 268. return NULL; 269. > return X509_PUBKEY_get0(x->cert_info.key); 270. } 271. crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0() 138. } 139. 140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. EVP_PKEY *ret = NULL; crypto/x509/x_pubkey.c:142:5: 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. > EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) crypto/x509/x_pubkey.c:144:9: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:144:24: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:147:9: Taking true branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:148:9: 146. 147. if (key->pkey != NULL) 148. > return key->pkey; 149. 150. /* crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0 164. 165. return NULL; 166. > } 167. 168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:270:1: return from a call to X509_get0_pubkey 268. return NULL; 269. return X509_PUBKEY_get0(x->cert_info.key); 270. > } 271. 272. EVP_PKEY *X509_get_pubkey(X509 *x) ssl/statem/statem_clnt.c:2685:9: 2683. 2684. pkey = X509_get0_pubkey(s->session->peer); 2685. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2686. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2687. return 0; crypto/evp/p_lib.c:290:1: start of procedure EVP_PKEY_get0_RSA() 288. } 289. 290. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 291. { 292. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:292:9: Taking false branch 290. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 291. { 292. if (pkey->type != EVP_PKEY_RSA) { ^ 293. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 294. return NULL; crypto/evp/p_lib.c:296:5: 294. return NULL; 295. } 296. > return pkey->pkey.rsa; 297. } 298. crypto/evp/p_lib.c:297:1: return from a call to EVP_PKEY_get0_RSA 295. } 296. return pkey->pkey.rsa; 297. > } 298. 299. RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) ssl/statem/statem_clnt.c:2685:9: Taking false branch 2683. 2684. pkey = X509_get0_pubkey(s->session->peer); 2685. if (EVP_PKEY_get0_RSA(pkey) == NULL) { ^ 2686. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2687. return 0; ssl/statem/statem_clnt.c:2690:5: 2688. } 2689. 2690. > pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2691. pms = OPENSSL_malloc(pmslen); 2692. if (pms == NULL) { ssl/statem/statem_clnt.c:2691:5: 2689. 2690. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2691. > pms = OPENSSL_malloc(pmslen); 2692. if (pms == NULL) { 2693. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/statem/statem_clnt.c:2692:9: Taking false branch 2690. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2691. pms = OPENSSL_malloc(pmslen); 2692. if (pms == NULL) { ^ 2693. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); 2694. *al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_clnt.c:2698:5: 2696. } 2697. 2698. > pms[0] = s->client_version >> 8; 2699. pms[1] = s->client_version & 0xff; 2700. /* TODO(size_t): Convert this function */ ssl/statem/statem_clnt.c:2699:5: 2697. 2698. pms[0] = s->client_version >> 8; 2699. > pms[1] = s->client_version & 0xff; 2700. /* TODO(size_t): Convert this function */ 2701. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ssl/statem/statem_clnt.c:2701:9: 2699. pms[1] = s->client_version & 0xff; 2700. /* TODO(size_t): Convert this function */ 2701. > if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { 2702. goto err; 2703. } crypto/rand/rand_lib.c:102:1: start of procedure RAND_bytes() 100. } 101. 102. > int RAND_bytes(unsigned char *buf, int num) 103. { 104. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:104:5: 102. int RAND_bytes(unsigned char *buf, int num) 103. { 104. > const RAND_METHOD *meth = RAND_get_rand_method(); 105. if (meth && meth->bytes) 106. return meth->bytes(buf, num); crypto/rand/rand_lib.c:39:1: start of procedure RAND_get_rand_method() 37. } 38. 39. > const RAND_METHOD *RAND_get_rand_method(void) 40. { 41. if (!default_RAND_meth) { crypto/rand/rand_lib.c:41:10: Taking false branch 39. const RAND_METHOD *RAND_get_rand_method(void) 40. { 41. if (!default_RAND_meth) { ^ 42. #ifndef OPENSSL_NO_ENGINE 43. ENGINE *e = ENGINE_get_default_RAND(); crypto/rand/rand_lib.c:57:5: 55. default_RAND_meth = RAND_OpenSSL(); 56. } 57. > return default_RAND_meth; 58. } 59. crypto/rand/rand_lib.c:58:1: return from a call to RAND_get_rand_method 56. } 57. return default_RAND_meth; 58. > } 59. 60. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:105:9: Taking true branch 103. { 104. const RAND_METHOD *meth = RAND_get_rand_method(); 105. if (meth && meth->bytes) ^ 106. return meth->bytes(buf, num); 107. return (-1); crypto/rand/rand_lib.c:105:17: Taking false branch 103. { 104. const RAND_METHOD *meth = RAND_get_rand_method(); 105. if (meth && meth->bytes) ^ 106. return meth->bytes(buf, num); 107. return (-1); crypto/rand/rand_lib.c:107:5: 105. if (meth && meth->bytes) 106. return meth->bytes(buf, num); 107. > return (-1); 108. } 109. crypto/rand/rand_lib.c:108:1: return from a call to RAND_bytes 106. return meth->bytes(buf, num); 107. return (-1); 108. > } 109. 110. #if OPENSSL_API_COMPAT < 0x10100000L ssl/statem/statem_clnt.c:2701:9: Taking true branch 2699. pms[1] = s->client_version & 0xff; 2700. /* TODO(size_t): Convert this function */ 2701. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ^ 2702. goto err; 2703. } ssl/statem/statem_clnt.c:2744:2: 2742. 2743. return 1; 2744. > err: 2745. OPENSSL_clear_free(pms, pmslen); 2746. EVP_PKEY_CTX_free(pctx); ssl/statem/statem_clnt.c:2745:5: 2743. return 1; 2744. err: 2745. > OPENSSL_clear_free(pms, pmslen); 2746. EVP_PKEY_CTX_free(pctx); 2747. crypto/mem.c:273:1: start of procedure CRYPTO_clear_free() 271. } 272. 273. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 274. { 275. if (str == NULL) crypto/mem.c:275:9: Taking false branch 273. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 274. { 275. if (str == NULL) ^ 276. return; 277. if (num) crypto/mem.c:277:9: Taking true branch 275. if (str == NULL) 276. return; 277. if (num) ^ 278. OPENSSL_cleanse(str, num); 279. CRYPTO_free(str, file, line); crypto/mem.c:278:9: Skipping OPENSSL_cleanse(): method has no implementation 276. return; 277. if (num) 278. OPENSSL_cleanse(str, num); ^ 279. CRYPTO_free(str, file, line); 280. } crypto/mem.c:279:5: 277. if (num) 278. OPENSSL_cleanse(str, num); 279. > CRYPTO_free(str, file, line); 280. } crypto/mem.c:253:1: start of procedure CRYPTO_free() 251. } 252. 253. > void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:255:9: Taking true branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:255:30: Taking true branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { 256. free_impl(str, file, line); ^ 257. return; 258. } crypto/mem.c:257:9: 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { 256. free_impl(str, file, line); 257. > return; 258. } 259. crypto/mem.c:271:1: return from a call to CRYPTO_free 269. free(str); 270. #endif 271. > } 272. 273. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/mem.c:280:1: return from a call to CRYPTO_clear_free 278. OPENSSL_cleanse(str, num); 279. CRYPTO_free(str, file, line); 280. > }
https://github.com/openssl/openssl/blob/b169c0ec40408566270fb638bcbfab01a0d2dc60/ssl/statem/statem_clnt.c/#L2745
d2a_code_trace_data_41710
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1448: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 11 steps of the trace test/bntest.c:1448:10: Call 1446. goto err; 1447. 1448. if (!TEST_true(BN_mod_mul(ret, a, b, m, ctx)) ^ 1449. || !equalBN("A * B (mod M)", mod_mul, ret)) 1450. goto err; crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mod.c:218:5: Call 216. ret = 1; 217. err: 218. BN_CTX_end(ctx); ^ 219. return ret; 220. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `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_41711
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:332: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_inverse`. Showing all 37 steps of the trace crypto/dsa/dsa_ossl.c:332:10: Call 330. * Calculate W = inv(S) mod Q save W in u2 331. */ 332. if ((BN_mod_inverse(u2, s, dsa->q, ctx)) == NULL) ^ 333. goto err; 334. crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_inverse` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_41712
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:270: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:270:3: 268. *(ptr++)=(inbuffer[0]>>10)&0x3f; 269. *(ptr++)=(inbuffer[0]>>5)&0x1f; 270. *(ptr++)=inbuffer[0]&0x1f; ^ 271. *(ptr++)=(inbuffer[1]>>12)&0xf; 272. *(ptr++)=(inbuffer[1]>>8)&0xf;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L270
d2a_code_trace_data_41713
static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len, int prediction_resistance) { 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, prediction_resistance); if (ret != 0) ctx->reseed_count++; return ret; } test/drbgtest.c:528: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 526 could be null and is dereferenced at line 528, column 9. Showing all 13 steps of the trace test/drbgtest.c:521:1: start of procedure get_entropy_hook() 519. 520. /* Intercepts and counts calls to the get_entropy() callback */ 521. > static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout, 522. int entropy, size_t min_len, size_t max_len, 523. int prediction_resistance) test/drbgtest.c:526:5: 524. { 525. size_t ret; 526. > HOOK_CTX *ctx = get_hook_ctx(drbg); 527. 528. if (ctx->fail != 0) 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:528:9: 526. HOOK_CTX *ctx = get_hook_ctx(drbg); 527. 528. > if (ctx->fail != 0) 529. return 0; 530.
https://github.com/openssl/openssl/blob/b44882a0bd0717e0aab84f5dc3ef81ab673155e9/test/drbgtest.c/#L528
d2a_code_trace_data_41714
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:392: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/wavpack.c:291:1: Parameter `bc->bits_left` 289. } 290. 291. static int wv_get_value(WavpackFrameContext *ctx, BitstreamContext *bc, ^ 292. int channel, int *last) 293. { libavcodec/wavpack.c:392:17: Call 390. if (bitstream_bits_left(bc) <= 0) 391. goto error; 392. if (bitstream_read_bit(bc)) { ^ 393. add -= (mid - base); 394. base = mid; 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_41715
void t2p_read_tiff_size(T2P* t2p, TIFF* input){ uint64* sbc=NULL; #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) unsigned char* jpt=NULL; tstrip_t i=0; tstrip_t stripcount=0; #endif uint64 k = 0; if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ #ifdef CCITT_SUPPORT if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } t2p->tiff_datasize=(tmsize_t)sbc[0]; return; } #endif #ifdef ZIP_SUPPORT if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } t2p->tiff_datasize=(tmsize_t)sbc[0]; return; } #endif #ifdef OJPEG_SUPPORT if(t2p->tiff_compression == COMPRESSION_OJPEG){ if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } stripcount=TIFFNumberOfStrips(input); for(i=0;i<stripcount;i++){ k = checkAdd64(k, sbc[i], t2p); } if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){ if(t2p->tiff_dataoffset != 0){ if(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){ if((uint64)t2p->tiff_datasize < k) { TIFFWarning(TIFF2PDF_MODULE, "Input file %s has short JPEG interchange file byte count", TIFFFileName(input)); t2p->pdf_ojpegiflength=t2p->tiff_datasize; k = checkAdd64(k, t2p->tiff_datasize, t2p); k = checkAdd64(k, 6, t2p); k = checkAdd64(k, stripcount, t2p); k = checkAdd64(k, stripcount, t2p); t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } return; }else { TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } } } k = checkAdd64(k, stripcount, t2p); k = checkAdd64(k, stripcount, t2p); k = checkAdd64(k, 2048, t2p); t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } #endif #ifdef JPEG_SUPPORT if(t2p->tiff_compression == COMPRESSION_JPEG) { uint32 count = 0; if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){ if(count > 4){ k += count; k -= 2; } } else { k = 2; } stripcount=TIFFNumberOfStrips(input); if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } for(i=0;i<stripcount;i++){ k = checkAdd64(k, sbc[i], t2p); k -=2; k +=2; } k = checkAdd64(k, 2, t2p); k = checkAdd64(k, 6, t2p); t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } #endif (void) 0; } k = checkMultiply64(TIFFScanlineSize(input), t2p->tiff_length, t2p); if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){ k = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p); } if (k == 0) { t2p->t2p_error = T2P_ERR_ERROR; } t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } tools/tiff2pdf.c:1941: error: Null Dereference pointer `sbc` last assigned on line 1899 could be null and is dereferenced at line 1941, column 23. tools/tiff2pdf.c:1897:1: start of procedure t2p_read_tiff_size() 1895. */ 1896. 1897. void t2p_read_tiff_size(T2P* t2p, TIFF* input){ ^ 1898. 1899. uint64* sbc=NULL; tools/tiff2pdf.c:1899:2: 1897. void t2p_read_tiff_size(T2P* t2p, TIFF* input){ 1898. 1899. uint64* sbc=NULL; ^ 1900. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1901. unsigned char* jpt=NULL; tools/tiff2pdf.c:1901:2: 1899. uint64* sbc=NULL; 1900. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1901. unsigned char* jpt=NULL; ^ 1902. tstrip_t i=0; 1903. tstrip_t stripcount=0; tools/tiff2pdf.c:1902:2: 1900. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1901. unsigned char* jpt=NULL; 1902. tstrip_t i=0; ^ 1903. tstrip_t stripcount=0; 1904. #endif tools/tiff2pdf.c:1903:2: 1901. unsigned char* jpt=NULL; 1902. tstrip_t i=0; 1903. tstrip_t stripcount=0; ^ 1904. #endif 1905. uint64 k = 0; tools/tiff2pdf.c:1905:9: 1903. tstrip_t stripcount=0; 1904. #endif 1905. uint64 k = 0; ^ 1906. 1907. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ tools/tiff2pdf.c:1907:5: Taking true branch 1905. uint64 k = 0; 1906. 1907. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ ^ 1908. #ifdef CCITT_SUPPORT 1909. if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ tools/tiff2pdf.c:1909:6: Taking false branch 1907. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ 1908. #ifdef CCITT_SUPPORT 1909. if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ ^ 1910. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1911. if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { tools/tiff2pdf.c:1920:6: Taking false branch 1918. #endif 1919. #ifdef ZIP_SUPPORT 1920. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ ^ 1921. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1922. if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { tools/tiff2pdf.c:1931:6: Taking true branch 1929. #endif 1930. #ifdef OJPEG_SUPPORT 1931. if(t2p->tiff_compression == COMPRESSION_OJPEG){ ^ 1932. if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ 1933. TIFFError(TIFF2PDF_MODULE, tools/tiff2pdf.c:1932:8: 1930. #ifdef OJPEG_SUPPORT 1931. if(t2p->tiff_compression == COMPRESSION_OJPEG){ 1932. if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ ^ 1933. TIFFError(TIFF2PDF_MODULE, 1934. "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", libtiff/tif_dir.c:1213:1: start of procedure TIFFGetField() 1211. * internal directory structure. 1212. */ 1213. int ^ 1214. TIFFGetField(TIFF* tif, uint32 tag, ...) 1215. { libtiff/tif_dir.c:1219:2: 1217. va_list ap; 1218. 1219. va_start(ap, tag); ^ 1220. status = TIFFVGetField(tif, tag, ap); 1221. va_end(ap); libtiff/tif_dir.c:1220:2: Skipping TIFFVGetField(): empty list of specs 1218. 1219. va_start(ap, tag); 1220. status = TIFFVGetField(tif, tag, ap); ^ 1221. va_end(ap); 1222. return (status); libtiff/tif_dir.c:1221:2: 1219. va_start(ap, tag); 1220. status = TIFFVGetField(tif, tag, ap); 1221. va_end(ap); ^ 1222. return (status); 1223. } libtiff/tif_dir.c:1222:2: 1220. status = TIFFVGetField(tif, tag, ap); 1221. va_end(ap); 1222. return (status); ^ 1223. } 1224. libtiff/tif_dir.c:1223:1: return from a call to TIFFGetField 1221. va_end(ap); 1222. return (status); 1223. } ^ 1224. 1225. /* tools/tiff2pdf.c:1932:8: Taking false branch 1930. #ifdef OJPEG_SUPPORT 1931. if(t2p->tiff_compression == COMPRESSION_OJPEG){ 1932. if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ ^ 1933. TIFFError(TIFF2PDF_MODULE, 1934. "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", tools/tiff2pdf.c:1939:4: 1937. return; 1938. } 1939. stripcount=TIFFNumberOfStrips(input); ^ 1940. for(i=0;i<stripcount;i++){ 1941. k = checkAdd64(k, sbc[i], t2p); libtiff/tif_strip.c:60:1: start of procedure TIFFNumberOfStrips() 58. * Compute how many strips are in an image. 59. */ 60. uint32 ^ 61. TIFFNumberOfStrips(TIFF* tif) 62. { libtiff/tif_strip.c:63:2: 61. TIFFNumberOfStrips(TIFF* tif) 62. { 63. TIFFDirectory *td = &tif->tif_dir; ^ 64. uint32 nstrips; 65. libtiff/tif_strip.c:66:13: Condition is false 64. uint32 nstrips; 65. 66. nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : ^ 67. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); 68. if (td->td_planarconfig == PLANARCONFIG_SEPARATE) libtiff/tif_strip.c:67:7: Condition is true 65. 66. nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : 67. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); ^ 68. if (td->td_planarconfig == PLANARCONFIG_SEPARATE) 69. nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel, libtiff/tif_strip.c:66:13: 64. uint32 nstrips; 65. 66. nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : ^ 67. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); 68. if (td->td_planarconfig == PLANARCONFIG_SEPARATE) libtiff/tif_strip.c:66:2: 64. uint32 nstrips; 65. 66. nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : ^ 67. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); 68. if (td->td_planarconfig == PLANARCONFIG_SEPARATE) libtiff/tif_strip.c:68:6: Taking true branch 66. nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : 67. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); 68. if (td->td_planarconfig == PLANARCONFIG_SEPARATE) ^ 69. nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel, 70. "TIFFNumberOfStrips"); libtiff/tif_strip.c:69:3: 67. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); 68. if (td->td_planarconfig == PLANARCONFIG_SEPARATE) 69. nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel, ^ 70. "TIFFNumberOfStrips"); 71. return (nstrips); libtiff/tif_aux.c:36:1: start of procedure _TIFFMultiply32() 34. #include <math.h> 35. 36. uint32 ^ 37. _TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where) 38. { libtiff/tif_aux.c:39:2: 37. _TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where) 38. { 39. uint32 bytes = first * second; ^ 40. 41. if (second && bytes / second != first) { libtiff/tif_aux.c:41:6: Taking true branch 39. uint32 bytes = first * second; 40. 41. if (second && bytes / second != first) { ^ 42. TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where); 43. bytes = 0; libtiff/tif_aux.c:41:16: Taking false branch 39. uint32 bytes = first * second; 40. 41. if (second && bytes / second != first) { ^ 42. TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where); 43. bytes = 0; libtiff/tif_aux.c:46:2: 44. } 45. 46. return bytes; ^ 47. } 48. libtiff/tif_aux.c:47:1: return from a call to _TIFFMultiply32 45. 46. return bytes; 47. } ^ 48. 49. uint64 libtiff/tif_strip.c:71:2: 69. nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel, 70. "TIFFNumberOfStrips"); 71. return (nstrips); ^ 72. } 73. libtiff/tif_strip.c:72:1: return from a call to TIFFNumberOfStrips 70. "TIFFNumberOfStrips"); 71. return (nstrips); 72. } ^ 73. 74. /* tools/tiff2pdf.c:1940:8: 1938. } 1939. stripcount=TIFFNumberOfStrips(input); 1940. for(i=0;i<stripcount;i++){ ^ 1941. k = checkAdd64(k, sbc[i], t2p); 1942. } tools/tiff2pdf.c:1940:12: Loop condition is true. Entering loop body 1938. } 1939. stripcount=TIFFNumberOfStrips(input); 1940. for(i=0;i<stripcount;i++){ ^ 1941. k = checkAdd64(k, sbc[i], t2p); 1942. } tools/tiff2pdf.c:1941:5: 1939. stripcount=TIFFNumberOfStrips(input); 1940. for(i=0;i<stripcount;i++){ 1941. k = checkAdd64(k, sbc[i], t2p); ^ 1942. } 1943. if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/tools/tiff2pdf.c/#L1941
d2a_code_trace_data_41716
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:282: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 1]):unsigned64 by call to `WPACKET_finish`. Showing all 10 steps of the trace test/wpackettest.c:259:17: Call 257. || !TEST_true(WPACKET_set_flags(&pkt, WPACKET_FLAGS_NON_ZERO_LENGTH)) 258. /* Should fail because of zero length */ 259. || !TEST_false(WPACKET_finish(&pkt)) ^ 260. || !TEST_true(WPACKET_put_bytes_u8(&pkt, 0xff)) 261. || !TEST_true(WPACKET_finish(&pkt)) ssl/packet.c:255:1: Parameter `pkt->subs->lenbytes` 253. } 254. 255. > int WPACKET_finish(WPACKET *pkt) 256. { 257. int ret; test/wpackettest.c:282:17: Call 280. if (!TEST_true(WPACKET_init_len(&pkt, buf, 1)) 281. || !TEST_true(WPACKET_set_flags(&pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) 282. || !TEST_true(WPACKET_finish(&pkt)) ^ 283. || !TEST_true(WPACKET_get_total_written(&pkt, &written)) 284. || !TEST_size_t_eq(written, 0)) ssl/packet.c:255:1: Parameter `pkt->curr` 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->curr` 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->lenbytes` 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:203:13: Binary operation: ([0, +oo] - [0, 1]):unsigned64 by call to `WPACKET_finish` 201. 202. /* Deallocate any bytes allocated for the length of the WPACKET */ 203. if ((pkt->curr - sub->lenbytes) == sub->packet_len) { ^ 204. pkt->written -= sub->lenbytes; 205. pkt->curr -= sub->lenbytes;
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet.c/#L203
d2a_code_trace_data_41717
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_eay.c:751: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 29 steps of the trace crypto/rsa/rsa_eay.c:715:1: Parameter `ctx->stack.depth` 713. } 714. 715. > static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 716. { 717. BIGNUM *r1,*m1,*vrfy; crypto/rsa/rsa_eay.c:722:2: Call 720. int ret=0; 721. 722. BN_CTX_start(ctx); ^ 723. r1 = BN_CTX_get(ctx); 724. m1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/rsa/rsa_eay.c:751:3: Call 749. 750. MONT_HELPER(rsa->_method_mod_p, ctx, p, rsa->flags & RSA_FLAG_CACHE_PRIVATE, goto err); 751. MONT_HELPER(rsa->_method_mod_q, ctx, q, rsa->flags & RSA_FLAG_CACHE_PRIVATE, goto err); ^ 752. } 753. crypto/bn/bn_mont.c:530:1: Parameter `ctx->stack.depth` 528. } 529. 530. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 531. const BIGNUM *mod, BN_CTX *ctx) 532. { crypto/bn/bn_mont.c:546:16: Call 544. { 545. ret = BN_MONT_CTX_new(); 546. if (ret && !BN_MONT_CTX_set(ret, mod, ctx)) ^ 547. BN_MONT_CTX_free(ret); 548. else crypto/bn/bn_mont.c:412:1: Parameter `ctx->stack.depth` 410. } 411. 412. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 413. { 414. int ret = 0; crypto/bn/bn_mont.c:417:2: Call 415. BIGNUM *Ri,*R; 416. 417. BN_CTX_start(ctx); ^ 418. if((Ri = BN_CTX_get(ctx)) == NULL) goto err; 419. R= &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:473:8: Call 471. tmod.top = buf[0] != 0 ? 1 : 0; 472. /* Ri = R^-1 mod N*/ 473. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 474. goto err; 475. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:208:1: Parameter `ctx->stack.depth` 206. static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. > BIGNUM *BN_mod_inverse(BIGNUM *in, 209. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 210. { crypto/bn/bn_gcd.c:217:10: Call 215. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 216. { 217. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 218. } 219. crypto/bn/bn_gcd.c:506:1: Parameter `ctx->stack.depth` 504. * It does not contain branches that may leak sensitive information. 505. */ 506. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 507. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 508. { crypto/bn/bn_gcd.c:518:2: Call 516. bn_check_top(n); 517. 518. BN_CTX_start(ctx); ^ 519. A = BN_CTX_get(ctx); 520. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:547:8: Call 545. pB = &local_B; 546. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 547. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 548. } 549. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 180. const BIGNUM *divisor, BN_CTX *ctx); 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:192:10: Call 190. if ((BN_get_flags(num, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(divisor, BN_FLG_CONSTTIME) != 0)) 191. { 192. return BN_div_no_branch(dv, rm, num, divisor, ctx); ^ 193. } 194. crypto/bn/bn_div.c:414:1: Parameter `ctx->stack.depth` 412. * branches that may leak sensitive information. 413. */ 414. > static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 415. const BIGNUM *divisor, BN_CTX *ctx) 416. { crypto/bn/bn_div.c:434:2: Call 432. } 433. 434. BN_CTX_start(ctx); ^ 435. tmp=BN_CTX_get(ctx); 436. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:630:2: Call 628. } 629. bn_correct_top(res); 630. BN_CTX_end(ctx); ^ 631. return(1); 632. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/56c7754cab3da9745e52e36b0bf998f8356fd6d5/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_41718
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:1072: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1072:17: 1070. (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) 1071. if(!s->first_slice_line) 1072. CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, ^ 1073. (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 1074. }else{
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1072
d2a_code_trace_data_41719
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1043: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1043:9: 1041. /* first line */ 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1043
d2a_code_trace_data_41720
int test_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *d, *e, *one; int i; a = BN_new(); b = BN_new(); d = BN_new(); e = BN_new(); one = BN_new(); BN_one(one); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (BN_exp(d, a, b, ctx) <= 0) return (0); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " ^ "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_one(e); for (; !BN_is_zero(b); BN_sub(b, b, one)) BN_mul(e, e, a, ctx); BN_sub(e, e, d); if (!BN_is_zero(e)) { fprintf(stderr, "Exponentiation test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(d); BN_free(e); BN_free(one); return (1); } test/bntest.c:1225: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1192, column 9 is not reachable after line 1225, column 5. Showing all 149 steps of the trace test/bntest.c:1186:1: start of procedure test_exp() 1184. } 1185. 1186. > int test_exp(BIO *bp, BN_CTX *ctx) 1187. { 1188. BIGNUM *a, *b, *d, *e, *one; test/bntest.c:1191:5: 1189. int i; 1190. 1191. > a = BN_new(); 1192. b = BN_new(); 1193. 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:1192:5: 1190. 1191. a = BN_new(); 1192. > b = BN_new(); 1193. d = BN_new(); 1194. 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:1193:5: 1191. a = BN_new(); 1192. b = BN_new(); 1193. > d = BN_new(); 1194. e = BN_new(); 1195. one = 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:1194:5: 1192. b = BN_new(); 1193. d = BN_new(); 1194. > e = BN_new(); 1195. one = BN_new(); 1196. BN_one(one); 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:1195:5: 1193. d = BN_new(); 1194. e = BN_new(); 1195. > one = BN_new(); 1196. BN_one(one); 1197. 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:1196:5: 1194. e = BN_new(); 1195. one = BN_new(); 1196. > BN_one(one); 1197. 1198. for (i = 0; i < num2; i++) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:1198:10: 1196. BN_one(one); 1197. 1198. > for (i = 0; i < num2; i++) { 1199. BN_bntest_rand(a, 20 + i * 5, 0, 0); 1200. BN_bntest_rand(b, 2 + i, 0, 0); test/bntest.c:1198:17: Loop condition is false. Leaving loop 1196. BN_one(one); 1197. 1198. for (i = 0; i < num2; i++) { ^ 1199. BN_bntest_rand(a, 20 + i * 5, 0, 0); 1200. BN_bntest_rand(b, 2 + i, 0, 0); test/bntest.c:1224:5: 1222. } 1223. } 1224. > BN_free(a); 1225. BN_free(b); 1226. BN_free(d); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:1225:5: 1223. } 1224. BN_free(a); 1225. > BN_free(b); 1226. BN_free(d); 1227. BN_free(e); 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/#L1225
d2a_code_trace_data_41721
static int check_chain_extensions(X509_STORE_CTX *ctx) { #ifdef OPENSSL_NO_CHAIN_VERIFY return 1; #else int i, ok=0, must_be_ca, plen = 0; X509 *x; int (*cb)(int xok,X509_STORE_CTX *xctx); int proxy_path_length = 0; int purpose; int allow_proxy_certs; cb=ctx->verify_cb; must_be_ca = -1; if (ctx->parent) { allow_proxy_certs = 0; purpose = X509_PURPOSE_CRL_SIGN; } else { allow_proxy_certs = !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) allow_proxy_certs = 1; purpose = ctx->param->purpose; } for (i = 0; i < ctx->last_untrusted; i++) { int ret; x = sk_X509_value(ctx->chain, i); if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) && (x->ex_flags & EXFLAG_CRITICAL)) { ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } ret = X509_check_ca(x); switch(must_be_ca) { case -1: if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1) && (ret != 0)) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; case 0: if (ret != 0) { ret = 0; ctx->error = X509_V_ERR_INVALID_NON_CA; } else ret = 1; break; default: if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; } if (ret == 0) { ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (ctx->param->purpose > 0) { ret = X509_check_purpose(x, purpose, must_be_ca > 0); if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ctx->error = X509_V_ERR_INVALID_PURPOSE; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } } if ((i > 1) && !(x->ex_flags & EXFLAG_SI) && (x->ex_pathlen != -1) && (plen > (x->ex_pathlen + proxy_path_length + 1))) { ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (!(x->ex_flags & EXFLAG_SI)) plen++; if (x->ex_flags & EXFLAG_PROXY) { if (x->ex_pcpathlen != -1 && i > x->ex_pcpathlen) { ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } proxy_path_length++; must_be_ca = 0; } else must_be_ca = 1; } ok = 1; end: return ok; #endif } crypto/x509/x509_vfy.c:591: error: NULL_DEREFERENCE pointer `x` last assigned on line 581 could be null and is dereferenced at line 591, column 30. Showing all 24 steps of the trace crypto/x509/x509_vfy.c:537:1: start of procedure check_chain_extensions() 535. */ 536. 537. > static int check_chain_extensions(X509_STORE_CTX *ctx) 538. { 539. #ifdef OPENSSL_NO_CHAIN_VERIFY crypto/x509/x509_vfy.c:542:2: 540. return 1; 541. #else 542. > int i, ok=0, must_be_ca, plen = 0; 543. X509 *x; 544. int (*cb)(int xok,X509_STORE_CTX *xctx); crypto/x509/x509_vfy.c:545:2: 543. X509 *x; 544. int (*cb)(int xok,X509_STORE_CTX *xctx); 545. > int proxy_path_length = 0; 546. int purpose; 547. int allow_proxy_certs; crypto/x509/x509_vfy.c:548:2: 546. int purpose; 547. int allow_proxy_certs; 548. > cb=ctx->verify_cb; 549. 550. /* must_be_ca can have 1 of 3 values: crypto/x509/x509_vfy.c:558:2: 556. all certificates in the chain except the leaf certificate. 557. */ 558. > must_be_ca = -1; 559. 560. /* CRL path validation */ crypto/x509/x509_vfy.c:561:6: Taking false branch 559. 560. /* CRL path validation */ 561. if (ctx->parent) ^ 562. { 563. allow_proxy_certs = 0; crypto/x509/x509_vfy.c:569:7: Condition is true 567. { 568. allow_proxy_certs = 569. !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); ^ 570. /* A hack to keep people who don't want to modify their 571. software happy */ crypto/x509/x509_vfy.c:569:4: 567. { 568. allow_proxy_certs = 569. > !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); 570. /* A hack to keep people who don't want to modify their 571. software happy */ crypto/x509/x509_vfy.c:568:3: 566. else 567. { 568. > allow_proxy_certs = 569. !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); 570. /* A hack to keep people who don't want to modify their crypto/x509/x509_vfy.c:572:7: Taking false branch 570. /* A hack to keep people who don't want to modify their 571. software happy */ 572. if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) ^ 573. allow_proxy_certs = 1; 574. purpose = ctx->param->purpose; crypto/x509/x509_vfy.c:574:3: 572. if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) 573. allow_proxy_certs = 1; 574. > purpose = ctx->param->purpose; 575. } 576. crypto/x509/x509_vfy.c:578:7: 576. 577. /* Check all untrusted certificates */ 578. > for (i = 0; i < ctx->last_untrusted; i++) 579. { 580. int ret; crypto/x509/x509_vfy.c:578:14: Loop condition is true. Entering loop body 576. 577. /* Check all untrusted certificates */ 578. for (i = 0; i < ctx->last_untrusted; i++) ^ 579. { 580. int ret; crypto/x509/x509_vfy.c:581:7: Condition is true 579. { 580. int ret; 581. x = sk_X509_value(ctx->chain, i); ^ 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 583. && (x->ex_flags & EXFLAG_CRITICAL)) crypto/x509/x509_vfy.c:581:3: 579. { 580. int ret; 581. > x = sk_X509_value(ctx->chain, i); 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 583. && (x->ex_flags & EXFLAG_CRITICAL)) crypto/stack/stack.c:300:1: start of procedure sk_value() 298. } 299. 300. > void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:302:6: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:13: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:24: Taking true branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:39: 300. void *sk_value(const _STACK *st, int i) 301. { 302. > if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. } crypto/stack/stack.c:304:1: return from a call to sk_value 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. > } 305. 306. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:582:9: Taking false branch 580. int ret; 581. x = sk_X509_value(ctx->chain, i); 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) ^ 583. && (x->ex_flags & EXFLAG_CRITICAL)) 584. { crypto/x509/x509_vfy.c:591:8: Taking true branch 589. if (!ok) goto end; 590. } 591. if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) ^ 592. { 593. ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; crypto/x509/x509_vfy.c:591:30: 589. if (!ok) goto end; 590. } 591. > if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) 592. { 593. ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
https://github.com/openssl/openssl/blob/2dac2667d1ec0ffd9f5609cc07f7e1221624e152/crypto/x509/x509_vfy.c/#L591
d2a_code_trace_data_41722
static int decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; s->dsp.clear_blocks(h->mb); tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; if(h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); else predict_field_decoding_flag(h); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type == FF_B_TYPE){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } }else if(h->slice_type == FF_P_TYPE ){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(h->slice_type == FF_I_TYPE); decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)){ unsigned int x, y; align_get_bits(&s->gb); for(y=0; y<16; y++){ const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3); for(x=0; x<16; x++){ tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } s->current_picture.qscale_table[mb_xy]= 0; h->chroma_qp[0] = get_chroma_qp(h, 0, 0); h->chroma_qp[1] = get_chroma_qp(h, 1, 0); memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if(IS_INTRA(mb_type)){ int pred_mode; if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } write_back_intra_pred_mode(h); if( check_intra4x4_pred_mode(h) < 0) return -1; }else{ h->intra16x16_pred_mode= check_intra_pred_mode(h, h->intra16x16_pred_mode); if(h->intra16x16_pred_mode < 0) return -1; } pred_mode= check_intra_pred_mode(h, get_ue_golomb(&s->gb)); if(pred_mode < 0) return -1; h->chroma_pred_mode= pred_mode; }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if(h->slice_type == FF_B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0]) || IS_DIRECT(h->sub_mb_type[1]) || IS_DIRECT(h->sub_mb_type[2]) || IS_DIRECT(h->sub_mb_type[3])) { pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type == FF_P_TYPE || h->slice_type == FF_SP_TYPE); for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for(list=0; list<h->list_count; list++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ unsigned int tmp = get_te0_golomb(&s->gb, ref_count); if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } ref[list][i]= tmp; }else{ ref[list][i] = -1; } } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(h->sub_mb_type[i], 0, list)){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp[cbp]; } h->cbp = cbp; if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ if(get_bits1(&s->gb)) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i8x8, i4x4, chroma_idx; int dquant; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8, *dc_scan; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } dquant= get_se_golomb(&s->gb); if( dquant > 25 || dquant < -26 ){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } s->qscale += dquant; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if(IS_INTRA16x16(mb_type)){ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){ return -1; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } }else{ for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ DCTELEM *buf = &h->mb[64*i8x8]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 ) return -1; } nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 15) < 0){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; } libavcodec/h264.c:4720: error: Uninitialized Value The value read from sub_partition_count[_] was never initialized. libavcodec/h264.c:4720:30: 4718. const int sub_mb_type= h->sub_mb_type[i]; 4719. const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; 4720. for(j=0; j<sub_partition_count[i]; j++){ ^ 4721. int mx, my; 4722. const int index= 4*i + block_width*j;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L4720
d2a_code_trace_data_41723
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:452: error: Integer Overflow L2 ([1, +oo] - 2):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:452:20: Call 450. return AVERROR_INVALIDDATA; 451. 452. lpc_mode = bitstream_read(bc, 2); ^ 453. if (lpc_mode > 2) 454. return AVERROR_INVALIDDATA; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 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_41724
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); av_free(ref->video); av_free(ref->audio); av_free(ref); } avconv.c:1786: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. avconv.c:1786:21: Call 1784. ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); 1785. if (ost->picref) 1786. avfilter_unref_buffer(ost->picref); ^ 1787. } 1788. #endif libavfilter/avfilter.c:72:1: Parameter `ref->buf->refcount` 70. } 71. 72. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 73. { 74. if (!ref) avconv.c:1786:21: Call 1784. ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); 1785. if (ost->picref) 1786. avfilter_unref_buffer(ost->picref); ^ 1787. } 1788. #endif libavfilter/avfilter.c:72:1: <LHS trace> 70. } 71. 72. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 73. { 74. if (!ref) libavfilter/avfilter.c:72:1: Parameter `ref->buf->refcount` 70. } 71. 72. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 73. { 74. if (!ref) libavfilter/avfilter.c:76:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 74. if (!ref) 75. return; 76. if (!(--ref->buf->refcount)) ^ 77. ref->buf->free(ref->buf); 78. av_free(ref->video);
https://github.com/libav/libav/blob/06d37fede4d36ea528ef69e4358a5775df016df0/libavfilter/avfilter.c/#L76
d2a_code_trace_data_41725
int test_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *d, *e, *one; int i; a = BN_new(); b = BN_new(); d = BN_new(); e = BN_new(); one = BN_new(); BN_one(one); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (BN_exp(d, a, b, ctx) <= 0) return (0); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " ^ "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_one(e); for (; !BN_is_zero(b); BN_sub(b, b, one)) BN_mul(e, e, a, ctx); BN_sub(e, e, d); if (!BN_is_zero(e)) { fprintf(stderr, "Exponentiation test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(d); BN_free(e); BN_free(one); return (1); } test/bntest.c:1215: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1182, column 9 is not reachable after line 1215, column 5. Showing all 149 steps of the trace test/bntest.c:1176:1: start of procedure test_exp() 1174. } 1175. 1176. > int test_exp(BIO *bp, BN_CTX *ctx) 1177. { 1178. BIGNUM *a, *b, *d, *e, *one; test/bntest.c:1181:5: 1179. int i; 1180. 1181. > a = BN_new(); 1182. b = BN_new(); 1183. 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:1182:5: 1180. 1181. a = BN_new(); 1182. > b = BN_new(); 1183. d = BN_new(); 1184. 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:1183:5: 1181. a = BN_new(); 1182. b = BN_new(); 1183. > d = BN_new(); 1184. e = BN_new(); 1185. one = 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:1184:5: 1182. b = BN_new(); 1183. d = BN_new(); 1184. > e = BN_new(); 1185. one = BN_new(); 1186. BN_one(one); 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:1185:5: 1183. d = BN_new(); 1184. e = BN_new(); 1185. > one = BN_new(); 1186. BN_one(one); 1187. 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:1186:5: 1184. e = BN_new(); 1185. one = BN_new(); 1186. > BN_one(one); 1187. 1188. for (i = 0; i < num2; i++) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:1188:10: 1186. BN_one(one); 1187. 1188. > for (i = 0; i < num2; i++) { 1189. BN_bntest_rand(a, 20 + i * 5, 0, 0); 1190. BN_bntest_rand(b, 2 + i, 0, 0); test/bntest.c:1188:17: Loop condition is false. Leaving loop 1186. BN_one(one); 1187. 1188. for (i = 0; i < num2; i++) { ^ 1189. BN_bntest_rand(a, 20 + i * 5, 0, 0); 1190. BN_bntest_rand(b, 2 + i, 0, 0); test/bntest.c:1214:5: 1212. } 1213. } 1214. > BN_free(a); 1215. BN_free(b); 1216. BN_free(d); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:1215:5: 1213. } 1214. BN_free(a); 1215. > BN_free(b); 1216. BN_free(d); 1217. BN_free(e); 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/#L1215
d2a_code_trace_data_41726
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) { CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ret->name = OPENSSL_strdup(name); if (ret->name == NULL) { CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); goto err; } ret->public_key = public_key; if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) goto err; return ret; err: CTLOG_free(ret); return NULL; } crypto/ct/ct_log.c:256: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 237, column 18 is not reachable after line 256, column 5. Showing all 59 steps of the trace crypto/ct/ct_log.c:235:1: start of procedure CTLOG_new() 233. * Copies the name. 234. */ 235. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 236. { 237. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); crypto/ct/ct_log.c:237:5: 235. CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 236. { 237. > CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 238. 239. if (ret == NULL) { crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:239:9: Taking false branch 237. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 238. 239. if (ret == NULL) { ^ 240. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); 241. return NULL; crypto/ct/ct_log.c:244:5: 242. } 243. 244. > ret->name = OPENSSL_strdup(name); 245. if (ret->name == NULL) { 246. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); crypto/o_str.c:28:1: start of procedure CRYPTO_strdup() 26. } 27. 28. > char *CRYPTO_strdup(const char *str, const char* file, int line) 29. { 30. char *ret; crypto/o_str.c:33:9: Taking false branch 31. size_t size; 32. 33. if (str == NULL) ^ 34. return NULL; 35. size = strlen(str) + 1; crypto/o_str.c:35:5: 33. if (str == NULL) 34. return NULL; 35. > size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) crypto/o_str.c:36:5: 34. return NULL; 35. size = strlen(str) + 1; 36. > ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. memcpy(ret, str, size); crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking true branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:75:32: Taking true branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:76:9: Skipping __function_pointer__(): unresolved function pointer 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 76. return malloc_impl(num, file, line); ^ 77. 78. if (num <= 0) crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:37:9: Taking true branch 35. size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) ^ 38. memcpy(ret, str, size); 39. return ret; crypto/o_str.c:38:9: 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. > memcpy(ret, str, size); 39. return ret; 40. } crypto/o_str.c:39:5: 37. if (ret != NULL) 38. memcpy(ret, str, size); 39. > return ret; 40. } 41. crypto/o_str.c:40:1: return from a call to CRYPTO_strdup 38. memcpy(ret, str, size); 39. return ret; 40. > } 41. 42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/ct/ct_log.c:245:9: Taking false branch 243. 244. ret->name = OPENSSL_strdup(name); 245. if (ret->name == NULL) { ^ 246. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); 247. goto err; crypto/ct/ct_log.c:250:5: 248. } 249. 250. > ret->public_key = public_key; 251. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 252. goto err; crypto/ct/ct_log.c:251:9: 249. 250. ret->public_key = public_key; 251. > if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 252. goto err; 253. crypto/ct/ct_log.c:73:1: start of procedure ct_v1_log_id_from_pkey() 71. 72. /* Converts a log's public key into a SHA256 log ID */ 73. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey, 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { crypto/ct/ct_log.c:76:5: 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { 76. > int ret = 0; 77. unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); crypto/ct/ct_log.c:77:5: 75. { 76. int ret = 0; 77. > unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. crypto/ct/ct_log.c:78:5: 76. int ret = 0; 77. unsigned char *pkey_der = NULL; 78. > int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { crypto/x509/x_pubkey.c:202:1: start of procedure i2d_PUBKEY() 200. } 201. 202. > int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. X509_PUBKEY *xpk = NULL; crypto/x509/x_pubkey.c:204:5: 202. int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. > X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) crypto/x509/x_pubkey.c:206:10: Taking true branch 204. X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) ^ 207. return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) crypto/x509/x_pubkey.c:207:9: 205. int ret; 206. if (!a) 207. > return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) 209. return 0; crypto/x509/x_pubkey.c:213:1: return from a call to i2d_PUBKEY 211. X509_PUBKEY_free(xpk); 212. return ret; 213. > } 214. 215. /* crypto/ct/ct_log.c:80:9: Taking true branch 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { ^ 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); 82. goto err; crypto/ct/ct_log.c:81:9: Skipping ERR_put_error(): empty list of specs 79. 80. if (pkey_der_len <= 0) { 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); ^ 82. goto err; 83. } crypto/ct/ct_log.c:87:1: 85. SHA256(pkey_der, pkey_der_len, log_id); 86. ret = 1; 87. > err: 88. OPENSSL_free(pkey_der); 89. return ret; crypto/ct/ct_log.c:88:5: 86. ret = 1; 87. err: 88. > OPENSSL_free(pkey_der); 89. return ret; 90. } crypto/mem.c:163:1: start of procedure CRYPTO_free() 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:165:9: Taking false branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:179:5: 177. } 178. #else 179. > free(str); 180. #endif 181. } crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:89:5: 87. err: 88. OPENSSL_free(pkey_der); 89. > return ret; 90. } 91. crypto/ct/ct_log.c:90:1: return from a call to ct_v1_log_id_from_pkey 88. OPENSSL_free(pkey_der); 89. return ret; 90. > } 91. 92. CTLOG_STORE *CTLOG_STORE_new(void) crypto/ct/ct_log.c:251:9: Taking true branch 249. 250. ret->public_key = public_key; 251. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) ^ 252. goto err; 253. crypto/ct/ct_log.c:255:1: 253. 254. return ret; 255. > err: 256. CTLOG_free(ret); 257. return NULL; crypto/ct/ct_log.c:256:5: Skipping CTLOG_free(): empty list of specs 254. return ret; 255. err: 256. CTLOG_free(ret); ^ 257. return NULL; 258. }
https://github.com/openssl/openssl/blob/6025001707fd65679d758c877200469d4e72ea88/crypto/ct/ct_log.c/#L256
d2a_code_trace_data_41727
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:720: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`. Showing all 19 steps of the trace test/bntest.c:719:13: Call 717. for (j = 0; j < 2; j++) { 718. BN_GF2m_mod(c, a, b[j]); 719. BN_GF2m_mod_sqrt(d, a, b[j], ctx); ^ 720. BN_GF2m_mod_sqr(e, d, b[j], ctx); 721. BN_GF2m_add(f, c, e); crypto/bn/bn_gf2m.c:1016:1: Parameter `ctx->stack.depth` 1014. * for best performance, use the BN_GF2m_mod_sqrt_arr function. 1015. */ 1016. > int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 1017. { 1018. int ret = 0; test/bntest.c:720:13: Call 718. BN_GF2m_mod(c, a, b[j]); 719. BN_GF2m_mod_sqrt(d, a, b[j], ctx); 720. BN_GF2m_mod_sqr(e, d, b[j], ctx); ^ 721. BN_GF2m_add(f, c, e); 722. /* Test that d^2 = a, where d = sqrt(a). */ crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; test/bntest.c:719:13: Call 717. for (j = 0; j < 2; j++) { 718. BN_GF2m_mod(c, a, b[j]); 719. BN_GF2m_mod_sqrt(d, a, b[j], ctx); ^ 720. BN_GF2m_mod_sqr(e, d, b[j], ctx); 721. BN_GF2m_add(f, c, e); crypto/bn/bn_gf2m.c:1016:1: Parameter `ctx->stack.depth` 1014. * for best performance, use the BN_GF2m_mod_sqrt_arr function. 1015. */ 1016. > int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 1017. { 1018. int ret = 0; test/bntest.c:720:13: Call 718. BN_GF2m_mod(c, a, b[j]); 719. BN_GF2m_mod_sqrt(d, a, b[j], ctx); 720. BN_GF2m_mod_sqr(e, d, b[j], ctx); ^ 721. BN_GF2m_add(f, c, e); 722. /* Test that d^2 = a, where d = sqrt(a). */ crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; crypto/bn/bn_gf2m.c:547:11: Call 545. goto err; 546. } 547. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); ^ 548. bn_check_top(r); 549. err: crypto/bn/bn_gf2m.c:504:5: Call 502. 503. bn_check_top(a); 504. BN_CTX_start(ctx); ^ 505. if ((s = BN_CTX_get(ctx)) == NULL) 506. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:522:5: Call 520. ret = 1; 521. err: 522. BN_CTX_end(ctx); ^ 523. return ret; 524. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.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_GF2m_mod_sqr` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_41728
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [480+min(0, `c->synth_buf_offset[*]`), 481+max(511, `c->synth_buf_offset[*]`)] (⇐ [32+min(0, `c->synth_buf_offset[*]`), 33+max(511, `c->synth_buf_offset[*]`)] + 448) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:922:5: Assignment 920. } 921. 922. p = synth_buf + 32; ^ 923. SUM8(sum, -=, w + 32, p); 924. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:923:5: Array access: Offset: [480+min(0, c->synth_buf_offset[*]), 481+max(511, c->synth_buf_offset[*])] (⇐ [32+min(0, c->synth_buf_offset[*]), 33+max(511, c->synth_buf_offset[*])] + 448) Size: 2 by call to `ff_mpa_synth_filter` 921. 922. p = synth_buf + 32; 923. SUM8(sum, -=, w + 32, p); ^ 924. *samples = round_sample(&sum); 925. *dither_state= sum;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L923
d2a_code_trace_data_41729
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/ec2_smpl.c:811: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_GF2m_add`. Showing all 16 steps of the trace crypto/ec/ec2_smpl.c:793:10: Call 791. 792. BN_CTX_start(ctx); 793. t0 = BN_CTX_get(ctx); ^ 794. t1 = BN_CTX_get(ctx); 795. t2 = 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:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ec2_smpl.c:811:13: Call 809. || !BN_GF2m_add(t2, p->Y, t2) 810. || !group->meth->field_mul(group, t2, t2, t0, ctx) 811. || !BN_GF2m_add(t1, t2, t1) ^ 812. || !group->meth->field_mul(group, t2, p->X, t0, ctx) 813. || !group->meth->field_inv(group, t2, t2, ctx) crypto/bn/bn_gf2m.c:252:1: Parameter `*r->d` 250. * could be equal; r is the bitwise XOR of a and b. 251. */ 252. > int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 253. { 254. int i; crypto/bn/bn_gf2m.c:268:9: Call 266. } 267. 268. if (bn_wexpand(r, at->top) == NULL) ^ 269. return 0; 270. crypto/bn/bn_lib.c:939:1: Parameter `*a->d` 937. } 938. 939. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:941:37: Call 939. BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 942. } 943. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_GF2m_add` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_41730
static inline void MPV_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16]) { int dxy, mx, my, src_x, src_y, motion_x, motion_y; int mb_x, mb_y, i; uint8_t *ptr, *dest; mb_x = s->mb_x; mb_y = s->mb_y; prefetch_motion(s, ref_picture, dir); if(s->obmc && s->pict_type != FF_B_TYPE){ int16_t mv_cache[4][4][2]; const int xy= s->mb_x + s->mb_y*s->mb_stride; const int mot_stride= s->b8_stride; const int mot_xy= mb_x*2 + mb_y*2*mot_stride; assert(!s->mb_skipped); memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy ], sizeof(int16_t)*4); memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4); memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4); if(mb_y==0 || IS_INTRA(s->current_picture.mb_type[xy-s->mb_stride])){ memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4); }else{ memcpy(mv_cache[0][1], s->current_picture.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4); } if(mb_x==0 || IS_INTRA(s->current_picture.mb_type[xy-1])){ *(int32_t*)mv_cache[1][0]= *(int32_t*)mv_cache[1][1]; *(int32_t*)mv_cache[2][0]= *(int32_t*)mv_cache[2][1]; }else{ *(int32_t*)mv_cache[1][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1]; *(int32_t*)mv_cache[2][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1+mot_stride]; } if(mb_x+1>=s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1])){ *(int32_t*)mv_cache[1][3]= *(int32_t*)mv_cache[1][2]; *(int32_t*)mv_cache[2][3]= *(int32_t*)mv_cache[2][2]; }else{ *(int32_t*)mv_cache[1][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2]; *(int32_t*)mv_cache[2][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2+mot_stride]; } mx = 0; my = 0; for(i=0;i<4;i++) { const int x= (i&1)+1; const int y= (i>>1)+1; int16_t mv[5][2]= { {mv_cache[y][x ][0], mv_cache[y][x ][1]}, {mv_cache[y-1][x][0], mv_cache[y-1][x][1]}, {mv_cache[y][x-1][0], mv_cache[y][x-1][1]}, {mv_cache[y][x+1][0], mv_cache[y][x+1][1]}, {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}}; obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, pix_op[1], mv); mx += mv[0][0]; my += mv[0][1]; } if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); return; } switch(s->mv_type) { case MV_TYPE_16X16: if(s->mcsel){ if(s->real_sprite_warping_points==1){ gmc1_motion(s, dest_y, dest_cb, dest_cr, ref_picture); }else{ gmc_motion(s, dest_y, dest_cb, dest_cr, ref_picture); } }else if(s->quarter_sample){ qpel_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, qpix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else if(ENABLE_WMV2 && s->mspel){ ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else { mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } break; case MV_TYPE_8X8: mx = 0; my = 0; if(s->quarter_sample){ for(i=0;i<4;i++) { motion_x = s->mv[dir][i][0]; motion_y = s->mv[dir][i][1]; dxy = ((motion_y & 3) << 2) | (motion_x & 3); src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8; src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8; src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~3; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) dxy &= ~12; ptr = ref_picture[0] + (src_y * s->linesize) + (src_x); if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8 || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){ ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize; qpix_op[1][dxy](dest, ptr, s->linesize); mx += s->mv[dir][i][0]/2; my += s->mv[dir][i][1]/2; } }else{ for(i=0;i<4;i++) { hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], 0, 0, mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, s->width, s->height, s->linesize, s->h_edge_pos, s->v_edge_pos, 8, 8, pix_op[1], s->mv[dir][i][0], s->mv[dir][i][1]); mx += s->mv[dir][i][0]; my += s->mv[dir][i][1]; } } if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); break; case MV_TYPE_FIELD: if (s->picture_structure == PICT_FRAME) { if(s->quarter_sample){ for(i=0; i<2; i++){ qpel_motion(s, dest_y, dest_cb, dest_cr, 1, i, s->field_select[dir][i], ref_picture, pix_op, qpix_op, s->mv[dir][i][0], s->mv[dir][i][1], 8); } }else{ mpeg_motion(s, dest_y, dest_cb, dest_cr, 1, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 8); mpeg_motion(s, dest_y, dest_cb, dest_cr, 1, 1, s->field_select[dir][1], ref_picture, pix_op, s->mv[dir][1][0], s->mv[dir][1][1], 8); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != FF_B_TYPE && !s->first_field){ ref_picture= s->current_picture_ptr->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } break; case MV_TYPE_16X8: for(i=0; i<2; i++){ uint8_t ** ref2picture; if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == FF_B_TYPE || s->first_field){ ref2picture= ref_picture; }else{ ref2picture= s->current_picture_ptr->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][i], ref2picture, pix_op, s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8); dest_y += 16*s->linesize; dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize; dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize; } break; case MV_TYPE_DMV: if(s->picture_structure == PICT_FRAME){ for(i=0; i<2; i++){ int j; for(j=0; j<2; j++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, 1, j, j^i, ref_picture, pix_op, s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8); } pix_op = s->dsp.avg_pixels_tab; } }else{ for(i=0; i<2; i++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, s->picture_structure != i+1, ref_picture, pix_op, s->mv[dir][2*i][0],s->mv[dir][2*i][1],16); pix_op=s->dsp.avg_pixels_tab; if(!s->first_field){ ref_picture = s->current_picture_ptr->data; } } } break; default: assert(0); } } libavcodec/mpegvideo_common.h:624: error: Buffer Overrun L1 Offset added: 8 Size: 4. libavcodec/mpegvideo_common.h:597:1: <Length trace> 595. * the motion vectors are taken from s->mv and the MV type from s->mv_type 596. */ 597. static inline void MPV_motion(MpegEncContext *s, ^ 598. uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, 599. int dir, uint8_t **ref_picture, libavcodec/mpegvideo_common.h:597:1: Array declaration 595. * the motion vectors are taken from s->mv and the MV type from s->mv_type 596. */ 597. static inline void MPV_motion(MpegEncContext *s, ^ 598. uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, 599. int dir, uint8_t **ref_picture, libavcodec/mpegvideo_common.h:624:13: Array access: Offset added: 8 Size: 4 622. 623. if(mb_y==0 || IS_INTRA(s->current_picture.mb_type[xy-s->mb_stride])){ 624. memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4); ^ 625. }else{ 626. memcpy(mv_cache[0][1], s->current_picture.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_common.h/#L624
d2a_code_trace_data_41731
static enum CodecID find_codec_or_die(const char *name, int type, int encoder) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); av_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); av_exit(1); } return codec->id; } ffmpeg.c:2763: error: Null Dereference pointer `codec` last assigned on line 2756 could be null and is dereferenced at line 2763, column 8. ffmpeg.c:2749:1: start of procedure find_codec_or_die() 2747. } 2748. 2749. static enum CodecID find_codec_or_die(const char *name, int type, int encoder) ^ 2750. { 2751. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:2751:32: Condition is true 2749. static enum CodecID find_codec_or_die(const char *name, int type, int encoder) 2750. { 2751. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2752. AVCodec *codec; 2753. ffmpeg.c:2751:5: 2749. static enum CodecID find_codec_or_die(const char *name, int type, int encoder) 2750. { 2751. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2752. AVCodec *codec; 2753. ffmpeg.c:2754:9: Taking false branch 2752. AVCodec *codec; 2753. 2754. if(!name) ^ 2755. return CODEC_ID_NONE; 2756. codec = encoder ? ffmpeg.c:2756:13: Condition is true 2754. if(!name) 2755. return CODEC_ID_NONE; 2756. codec = encoder ? ^ 2757. avcodec_find_encoder_by_name(name) : 2758. avcodec_find_decoder_by_name(name); ffmpeg.c:2756:5: 2754. if(!name) 2755. return CODEC_ID_NONE; 2756. codec = encoder ? ^ 2757. avcodec_find_encoder_by_name(name) : 2758. avcodec_find_decoder_by_name(name); ffmpeg.c:2759:9: Taking true branch 2757. avcodec_find_encoder_by_name(name) : 2758. avcodec_find_decoder_by_name(name); 2759. if(!codec) { ^ 2760. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 2761. av_exit(1); ffmpeg.c:2760:9: 2758. avcodec_find_decoder_by_name(name); 2759. if(!codec) { 2760. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 2761. av_exit(1); 2762. } ffmpeg.c:2761:9: Skipping av_exit(): empty list of specs 2759. if(!codec) { 2760. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 2761. av_exit(1); ^ 2762. } 2763. if(codec->type != type) { ffmpeg.c:2763:8: 2761. av_exit(1); 2762. } 2763. if(codec->type != type) { ^ 2764. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 2765. av_exit(1);
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L2763
d2a_code_trace_data_41732
static int hadamard8_intra8x8_c( void *s, uint8_t *src, uint8_t *dummy, int stride, int h){ int i; int temp[64]; int sum=0; assert(h==8); for(i=0; i<8; i++){ BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0],src[stride*i+1]); BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2],src[stride*i+3]); BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4],src[stride*i+5]); BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6],src[stride*i+7]); BUTTERFLY1(temp[8*i+0], temp[8*i+2]); BUTTERFLY1(temp[8*i+1], temp[8*i+3]); BUTTERFLY1(temp[8*i+4], temp[8*i+6]); BUTTERFLY1(temp[8*i+5], temp[8*i+7]); BUTTERFLY1(temp[8*i+0], temp[8*i+4]); BUTTERFLY1(temp[8*i+1], temp[8*i+5]); BUTTERFLY1(temp[8*i+2], temp[8*i+6]); BUTTERFLY1(temp[8*i+3], temp[8*i+7]); } for(i=0; i<8; i++){ BUTTERFLY1(temp[8*0+i], temp[8*1+i]); BUTTERFLY1(temp[8*2+i], temp[8*3+i]); BUTTERFLY1(temp[8*4+i], temp[8*5+i]); BUTTERFLY1(temp[8*6+i], temp[8*7+i]); BUTTERFLY1(temp[8*0+i], temp[8*2+i]); BUTTERFLY1(temp[8*1+i], temp[8*3+i]); BUTTERFLY1(temp[8*4+i], temp[8*6+i]); BUTTERFLY1(temp[8*5+i], temp[8*7+i]); sum += BUTTERFLYA(temp[8*0+i], temp[8*4+i]) +BUTTERFLYA(temp[8*1+i], temp[8*5+i]) +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); } sum -= FFABS(temp[8*0] + temp[8*4]); return sum; } libavcodec/dsputil.c:3581: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/dsputil.c:3581:12: 3579. } 3580. 3581. sum -= FFABS(temp[8*0] + temp[8*4]); // -mean ^ 3582. 3583. return sum;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L3581
d2a_code_trace_data_41733
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec_key.c:391: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ec_key.c:354:5: Call 352. return 0; 353. 354. BN_CTX_start(ctx); ^ 355. point = EC_POINT_new(key->group); 356. crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ec_key.c:391:5: Call 389. 390. err: 391. BN_CTX_end(ctx); ^ 392. BN_CTX_free(ctx); 393. EC_POINT_free(point); 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_41734
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); if (ref->extended_data != ref->data) av_freep(&ref->extended_data); av_free(ref->video); av_free(ref->audio); av_free(ref); } libavfilter/vf_overlay.c:342: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/vf_overlay.c:342:5: Call 340. { 341. ff_end_frame(inlink->dst->outputs[0]); 342. avfilter_unref_buffer(inlink->cur_buf); ^ 343. } 344. libavfilter/buffer.c:74:1: <LHS trace> 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:74:1: Parameter `ref->buf->refcount` 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:78:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 76. if (!ref) 77. return; 78. if (!(--ref->buf->refcount)) ^ 79. ref->buf->free(ref->buf); 80. if (ref->extended_data != ref->data)
https://github.com/libav/libav/blob/533fd5b5b468131cfe164455783c351eb69af657/libavfilter/buffer.c/#L78
d2a_code_trace_data_41735
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavformat/rtpenc_h263_rfc2190.c:118: error: Integer Overflow L2 ([0, +oo] - 2):unsigned32 by call to `bitstream_skip`. libavformat/rtpenc_h263_rfc2190.c:117:20: Call 115. bitstream_init(&bc, buf, size * 8); 116. if (bitstream_read(&bc, 22) == 0x20) { /* Picture Start Code */ 117. info.tr = bitstream_read(&bc, 8); ^ 118. bitstream_skip(&bc, 2); /* PTYPE start, H.261 disambiguation */ 119. bitstream_skip(&bc, 3); /* Split screen, document camera, freeze picture release */ 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) libavformat/rtpenc_h263_rfc2190.c:118:9: Call 116. if (bitstream_read(&bc, 22) == 0x20) { /* Picture Start Code */ 117. info.tr = bitstream_read(&bc, 8); 118. bitstream_skip(&bc, 2); /* PTYPE start, H.261 disambiguation */ ^ 119. bitstream_skip(&bc, 3); /* Split screen, document camera, freeze picture release */ 120. info.src = bitstream_read(&bc, 3); libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:244:9: Call 242. { 243. if (n <= bc->bits_left) 244. skip_remaining(bc, n); ^ 245. else { 246. n -= bc->bits_left; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 2):unsigned32 by call to `bitstream_skip` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L237
d2a_code_trace_data_41736
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec2_smpl.c:456: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ec2_smpl.c:375:5: Call 373. } 374. 375. BN_CTX_start(ctx); ^ 376. x0 = BN_CTX_get(ctx); 377. y0 = 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/ec/ec2_smpl.c:456:5: Call 454. 455. err: 456. BN_CTX_end(ctx); ^ 457. BN_CTX_free(new_ctx); 458. return ret; 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_41737
static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) { int i; for (i = 0; i < 4; i++) { block[0] = pixels[0]; block[1] = pixels[1]; block[2] = pixels[2]; block[3] = pixels[3]; block[4] = pixels[4]; block[5] = pixels[5]; block[6] = pixels[6]; block[7] = pixels[7]; pixels += line_size; block += 8; } memcpy(block , block- 8, sizeof(*block)*8); memcpy(block+ 8, block-16, sizeof(*block)*8); memcpy(block+16, block-24, sizeof(*block)*8); memcpy(block+24, block-32, sizeof(*block)*8); } libavcodec/dnxhdenc.c:415: error: Buffer Overrun L1 Offset: [11, +oo] (⇐ [4, +oo] + 7) Size: 8 by call to `dnxhd_get_pixels_4x8`. libavcodec/dnxhdenc.c:401:1: Parameter `ctx->blocks[*]` 399. } 400. 401. static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y) ^ 402. { 403. const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize) + (mb_x << 4); libavcodec/dnxhdenc.c:415:13: Call 413. if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) { 414. if (ctx->interlaced) { 415. dnxhd_get_pixels_4x8(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize); ^ 416. dnxhd_get_pixels_4x8(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize); 417. dnxhd_get_pixels_4x8(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize); libavcodec/dnxhdenc.c:380:1: <Length trace> 378. } 379. 380. static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) ^ 381. { 382. int i; libavcodec/dnxhdenc.c:380:1: Parameter `*block` 378. } 379. 380. static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) ^ 381. { 382. int i; libavcodec/dnxhdenc.c:391:9: Array access: Offset: [11, +oo] (⇐ [4, +oo] + 7) Size: 8 by call to `dnxhd_get_pixels_4x8` 389. block[5] = pixels[5]; 390. block[6] = pixels[6]; 391. block[7] = pixels[7]; ^ 392. pixels += line_size; 393. block += 8;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dnxhdenc.c/#L391
d2a_code_trace_data_41738
int test_div_recp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; BN_RECP_CTX *recp; int i; recp = BN_RECP_CTX_new(); a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 400, 0, 0); BN_copy(b, a); BN_lshift(a, a, i); BN_add_word(a, i); } else BN_bntest_rand(b, 50 + 3 * (i - num1), 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); BN_RECP_CTX_set(recp, b, ctx); BN_div_recp(d, c, a, recp, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); if (!results) { BN_print(bp, a); BIO_puts(bp, " % "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_mul(e, d, b, ctx); BN_add(d, e, c); BN_sub(d, d, a); if (!BN_is_zero(d)) { fprintf(stderr, "Reciprocal division test failed!\n"); fprintf(stderr, "a="); BN_print_fp(stderr, a); fprintf(stderr, "\nb="); BN_print_fp(stderr, b); fprintf(stderr, "\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); BN_RECP_CTX_free(recp); return (1); } test/bntest.c:639: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 589, column 9 is not reachable after line 639, column 5. Showing all 162 steps of the trace test/bntest.c:581:1: start of procedure test_div_recp() 579. } 580. 581. > int test_div_recp(BIO *bp, BN_CTX *ctx) 582. { 583. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:587:5: 585. int i; 586. 587. > recp = BN_RECP_CTX_new(); 588. a = BN_new(); 589. b = BN_new(); crypto/bn/bn_recp.c:70:1: start of procedure BN_RECP_CTX_new() 68. } 69. 70. > BN_RECP_CTX *BN_RECP_CTX_new(void) 71. { 72. BN_RECP_CTX *ret; crypto/bn/bn_recp.c:74:9: 72. BN_RECP_CTX *ret; 73. 74. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 75. return (NULL); 76. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_recp.c:74:9: Taking false branch 72. BN_RECP_CTX *ret; 73. 74. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 75. return (NULL); 76. crypto/bn/bn_recp.c:77:5: 75. return (NULL); 76. 77. > BN_RECP_CTX_init(ret); 78. ret->flags = BN_FLG_MALLOCED; 79. return (ret); crypto/bn/bn_recp.c:62:1: start of procedure BN_RECP_CTX_init() 60. #include "bn_lcl.h" 61. 62. > void BN_RECP_CTX_init(BN_RECP_CTX *recp) 63. { 64. bn_init(&(recp->N)); crypto/bn/bn_recp.c:64:5: Skipping bn_init(): empty list of specs 62. void BN_RECP_CTX_init(BN_RECP_CTX *recp) 63. { 64. bn_init(&(recp->N)); ^ 65. bn_init(&(recp->Nr)); 66. recp->num_bits = 0; crypto/bn/bn_recp.c:65:5: Skipping bn_init(): empty list of specs 63. { 64. bn_init(&(recp->N)); 65. bn_init(&(recp->Nr)); ^ 66. recp->num_bits = 0; 67. recp->flags = 0; crypto/bn/bn_recp.c:66:5: 64. bn_init(&(recp->N)); 65. bn_init(&(recp->Nr)); 66. > recp->num_bits = 0; 67. recp->flags = 0; 68. } crypto/bn/bn_recp.c:67:5: 65. bn_init(&(recp->Nr)); 66. recp->num_bits = 0; 67. > recp->flags = 0; 68. } 69. crypto/bn/bn_recp.c:68:1: return from a call to BN_RECP_CTX_init 66. recp->num_bits = 0; 67. recp->flags = 0; 68. > } 69. 70. BN_RECP_CTX *BN_RECP_CTX_new(void) crypto/bn/bn_recp.c:78:5: 76. 77. BN_RECP_CTX_init(ret); 78. > ret->flags = BN_FLG_MALLOCED; 79. return (ret); 80. } crypto/bn/bn_recp.c:79:5: 77. BN_RECP_CTX_init(ret); 78. ret->flags = BN_FLG_MALLOCED; 79. > return (ret); 80. } 81. crypto/bn/bn_recp.c:80:1: return from a call to BN_RECP_CTX_new 78. ret->flags = BN_FLG_MALLOCED; 79. return (ret); 80. > } 81. 82. void BN_RECP_CTX_free(BN_RECP_CTX *recp) test/bntest.c:588:5: 586. 587. recp = BN_RECP_CTX_new(); 588. > a = BN_new(); 589. b = BN_new(); 590. 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:589:5: 587. recp = BN_RECP_CTX_new(); 588. a = BN_new(); 589. > b = BN_new(); 590. c = BN_new(); 591. 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:590:5: 588. a = BN_new(); 589. b = BN_new(); 590. > c = BN_new(); 591. d = BN_new(); 592. 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:591:5: 589. b = BN_new(); 590. c = BN_new(); 591. > d = BN_new(); 592. e = BN_new(); 593. 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:592:5: 590. c = BN_new(); 591. d = BN_new(); 592. > e = BN_new(); 593. 594. for (i = 0; i < num0 + num1; i++) { crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:594:10: 592. e = BN_new(); 593. 594. > for (i = 0; i < num0 + num1; i++) { 595. if (i < num1) { 596. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:594:17: Loop condition is false. Leaving loop 592. e = BN_new(); 593. 594. for (i = 0; i < num0 + num1; i++) { ^ 595. if (i < num1) { 596. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:638:5: 636. } 637. } 638. > BN_free(a); 639. BN_free(b); 640. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:639:5: 637. } 638. BN_free(a); 639. > BN_free(b); 640. BN_free(c); 641. BN_free(d); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L639
d2a_code_trace_data_41739
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale, float bias) { const float *prCoeff; int i, j; DECLARE_ALIGNED_16(float, raXin[32]); int hist_index= s->hist_index[chans]; float *subband_fir_hist2 = s->subband_fir_noidea[chans]; int subindex; scale *= sqrt(1/8.0); if (!s->multirate_inter) prCoeff = fir_32bands_nonperfect; else prCoeff = fir_32bands_perfect; for (subindex = 0; subindex < 8; subindex++) { float *subband_fir_hist = s->subband_fir_hist[chans] + hist_index; for (i = 0; i < s->subband_activity[chans]; i++){ if((i-1)&2) raXin[i] = -samples_in[i][subindex]; else raXin[i] = samples_in[i][subindex]; } for (; i < 32; i++) raXin[i] = 0.0; ff_imdct_half(&s->imdct, subband_fir_hist, raXin); for (i = 0; i < 16; i++){ float a= subband_fir_hist2[i ]; float b= subband_fir_hist2[i+16]; float c= 0; float d= 0; for (j = 0; j < 512-hist_index; j += 64){ a += prCoeff[i+j ]*(-subband_fir_hist[15-i+j]); b += prCoeff[i+j+16]*( subband_fir_hist[ i+j]); c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j]); d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j]); } for ( ; j < 512; j += 64){ a += prCoeff[i+j ]*(-subband_fir_hist[15-i+j-512]); b += prCoeff[i+j+16]*( subband_fir_hist[ i+j-512]); c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j-512]); d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j-512]); } samples_out[i ] = a * scale + bias; samples_out[i+16] = b * scale + bias; subband_fir_hist2[i ] = c; subband_fir_hist2[i+16] = d; } samples_out+= 32; hist_index = (hist_index-32)&511; } s->hist_index[chans]= hist_index; } libavcodec/dca.c:986: error: Buffer Overrun L1 Offset: [16, `s->prim_channels` + 30] (⇐ [0, `s->prim_channels` - 1] + [16, 31]) Size: 5 by call to `qmf_32_subbands`. libavcodec/dca.c:842:1: Parameter `s->prim_channels` 840. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 841. 842. static int dca_subsubframe(DCAContext * s) ^ 843. { 844. int k, l; libavcodec/dca.c:986:10: Call 984. /* static float pcm_to_double[8] = 985. {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/ 986. qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k], ^ 987. M_SQRT1_2 /*pcm_to_double[s->source_pcm_res] */ , 988. 0 /*s->bias */ ); libavcodec/dca.c:687:14: <Offset trace> 685. 686. /* Multiply by filter coefficients */ 687. for (i = 0; i < 16; i++){ ^ 688. float a= subband_fir_hist2[i ]; 689. float b= subband_fir_hist2[i+16]; libavcodec/dca.c:687:14: Assignment 685. 686. /* Multiply by filter coefficients */ 687. for (i = 0; i < 16; i++){ ^ 688. float a= subband_fir_hist2[i ]; 689. float b= subband_fir_hist2[i+16]; libavcodec/dca.c:652:1: <Length trace> 650. } 651. 652. static void qmf_32_subbands(DCAContext * s, int chans, ^ 653. float samples_in[32][8], float *samples_out, 654. float scale, float bias) libavcodec/dca.c:652:1: Parameter `chans` 650. } 651. 652. static void qmf_32_subbands(DCAContext * s, int chans, ^ 653. float samples_in[32][8], float *samples_out, 654. float scale, float bias) libavcodec/dca.c:661:5: Assignment 659. 660. int hist_index= s->hist_index[chans]; 661. float *subband_fir_hist2 = s->subband_fir_noidea[chans]; ^ 662. 663. int subindex; libavcodec/dca.c:689:22: Array access: Offset: [16, s->prim_channels + 30] (⇐ [0, s->prim_channels - 1] + [16, 31]) Size: 5 by call to `qmf_32_subbands` 687. for (i = 0; i < 16; i++){ 688. float a= subband_fir_hist2[i ]; 689. float b= subband_fir_hist2[i+16]; ^ 690. float c= 0; 691. float d= 0;
https://github.com/libav/libav/blob/f0319383436e1abc3fc1464fe4e5f4dc40db3419/libavcodec/dca.c/#L689
d2a_code_trace_data_41740
int opt_timelimit(const char *opt, const char *arg) { #if HAVE_SETRLIMIT int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); struct rlimit rl = { lim, lim + 1 }; if (setrlimit(RLIMIT_CPU, &rl)) perror("setrlimit"); #else av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt); #endif return 0; } cmdutils.c:436: error: Integer Overflow L2 ([0, 2147483647] + 1):signed32. cmdutils.c:435:15: <LHS trace> 433. { 434. #if HAVE_SETRLIMIT 435. int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); ^ 436. struct rlimit rl = { lim, lim + 1 }; 437. if (setrlimit(RLIMIT_CPU, &rl)) cmdutils.c:435:15: Call 433. { 434. #if HAVE_SETRLIMIT 435. int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); ^ 436. struct rlimit rl = { lim, lim + 1 }; 437. if (setrlimit(RLIMIT_CPU, &rl)) cmdutils.c:83:1: Parameter `min` 81. } 82. 83. double parse_number_or_die(const char *context, const char *numstr, int type, ^ 84. double min, double max) 85. { cmdutils.c:98:9: Assignment 96. error = "Expected int for %s but found %s\n"; 97. else 98. return d; ^ 99. av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max); 100. exit_program(1); cmdutils.c:435:5: Assignment 433. { 434. #if HAVE_SETRLIMIT 435. int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); ^ 436. struct rlimit rl = { lim, lim + 1 }; 437. if (setrlimit(RLIMIT_CPU, &rl)) cmdutils.c:436:24: Binary operation: ([0, 2147483647] + 1):signed32 434. #if HAVE_SETRLIMIT 435. int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); 436. struct rlimit rl = { lim, lim + 1 }; ^ 437. if (setrlimit(RLIMIT_CPU, &rl)) 438. perror("setrlimit");
https://github.com/libav/libav/blob/1be8c90847300ac7889833612c99d57c58ff64b1/cmdutils.c/#L436
d2a_code_trace_data_41741
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, CERT *c) { uint32_t alg_mkey, alg_auth, alg_enc, alg_mac, algo_strength; int min_tls; const char *l, *buf; int j, multi, found, rule, retval, ok, buflen; uint32_t cipher_id = 0; char ch; retval = 1; l = rule_str; for (;;) { ch = *l; if (ch == '\0') break; if (ch == '-') { rule = CIPHER_DEL; l++; } else if (ch == '+') { rule = CIPHER_ORD; l++; } else if (ch == '!') { rule = CIPHER_KILL; l++; } else if (ch == '@') { rule = CIPHER_SPECIAL; l++; } else { rule = CIPHER_ADD; } if (ITEM_SEP(ch)) { l++; continue; } alg_mkey = 0; alg_auth = 0; alg_enc = 0; alg_mac = 0; min_tls = 0; algo_strength = 0; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while (((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.') || (ch == '=')) #else while (isalnum(ch) || (ch == '-') || (ch == '.') || (ch == '=')) #endif { ch = *(++l); buflen++; } if (buflen == 0) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); retval = found = 0; l++; break; } if (rule == CIPHER_SPECIAL) { found = 0; break; } if (ch == '+') { multi = 1; l++; } else multi = 0; j = found = 0; cipher_id = 0; while (ca_list[j]) { if (strncmp(buf, ca_list[j]->name, buflen) == 0 && (ca_list[j]->name[buflen] == '\0')) { found = 1; break; } else j++; } if (!found) break; if (ca_list[j]->algorithm_mkey) { if (alg_mkey) { alg_mkey &= ca_list[j]->algorithm_mkey; if (!alg_mkey) { found = 0; break; } } else alg_mkey = ca_list[j]->algorithm_mkey; } if (ca_list[j]->algorithm_auth) { if (alg_auth) { alg_auth &= ca_list[j]->algorithm_auth; if (!alg_auth) { found = 0; break; } } else alg_auth = ca_list[j]->algorithm_auth; } if (ca_list[j]->algorithm_enc) { if (alg_enc) { alg_enc &= ca_list[j]->algorithm_enc; if (!alg_enc) { found = 0; break; } } else alg_enc = ca_list[j]->algorithm_enc; } if (ca_list[j]->algorithm_mac) { if (alg_mac) { alg_mac &= ca_list[j]->algorithm_mac; if (!alg_mac) { found = 0; break; } } else alg_mac = ca_list[j]->algorithm_mac; } if (ca_list[j]->algo_strength & SSL_STRONG_MASK) { if (algo_strength & SSL_STRONG_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~SSL_STRONG_MASK; if (!(algo_strength & SSL_STRONG_MASK)) { found = 0; break; } } else algo_strength = ca_list[j]->algo_strength & SSL_STRONG_MASK; } if (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) { if (algo_strength & SSL_DEFAULT_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) | ~SSL_DEFAULT_MASK; if (!(algo_strength & SSL_DEFAULT_MASK)) { found = 0; break; } } else algo_strength |= ca_list[j]->algo_strength & SSL_DEFAULT_MASK; } if (ca_list[j]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->min_tls) { if (min_tls != 0 && min_tls != ca_list[j]->min_tls) { found = 0; break; } else { min_tls = ca_list[j]->min_tls; } } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && strncmp(buf, "STRENGTH", 8) == 0) ok = ssl_cipher_strength_sort(head_p, tail_p); else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { int level = buf[9] - '0'; if (level < 0 || level > 5) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } else { c->sec_level = level; ok = 1; } } else SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); if (ok == 0) retval = 0; while ((*l != '\0') && !ITEM_SEP(*l)) l++; } else if (found) { ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return (retval); } test/sslapitest.c:221: error: BUFFER_OVERRUN_L1 Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 4 by call to `SSL_CTX_set_cipher_list`. Showing all 13 steps of the trace test/sslapitest.c:221:10: Call 219. 220. /* We also want to ensure that we use RSA-based key exchange. */ 221. rc = SSL_CTX_set_cipher_list(cctx, "RSA"); ^ 222. if (rc == 0) { 223. printf("Unable to restrict to RSA key exchange.\n"); ssl/ssl_lib.c:2084:1: Parameter `*str` 2082. 2083. /** specify the ciphers to be used by default by the SSL_CTX */ 2084. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2085. { 2086. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2088:10: Call 2086. STACK_OF(SSL_CIPHER) *sk; 2087. 2088. sk = ssl_create_cipher_list(ctx->method, &ctx->cipher_list, ^ 2089. &ctx->cipher_list_by_id, str, ctx->cert); 2090. /* ssl/ssl_ciph.c:1295:1: Parameter `*rule_str` 1293. #endif 1294. 1295. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER) 1296. **cipher_list, STACK_OF(SSL_CIPHER) 1297. **cipher_list_by_id, ssl/ssl_ciph.c:1313:10: Call 1311. return NULL; 1312. #ifndef OPENSSL_NO_EC 1313. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1314. return NULL; 1315. #endif ssl/ssl_ciph.c:1241:1: Parameter `**prule_str` 1239. 1240. #ifndef OPENSSL_NO_EC 1241. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1242. const char **prule_str) 1243. { ssl/ssl_ciph.c:1466:5: Assignment 1464. */ 1465. ok = 1; 1466. rule_p = rule_str; ^ 1467. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1468. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1476:14: Call 1474. 1475. if (ok && (strlen(rule_p) > 0)) 1476. ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); ^ 1477. 1478. OPENSSL_free(ca_list); /* Not needed anymore */ ssl/ssl_ciph.c:985:1: <Length trace> 983. } 984. 985. > static int ssl_cipher_process_rulestr(const char *rule_str, 986. CIPHER_ORDER **head_p, 987. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:985:1: Parameter `*rule_str` 983. } 984. 985. > static int ssl_cipher_process_rulestr(const char *rule_str, 986. CIPHER_ORDER **head_p, 987. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:998:5: Assignment 996. 997. retval = 1; 998. l = rule_str; ^ 999. for (;;) { 1000. ch = *l; ssl/ssl_ciph.c:1034:13: Assignment 1032. for (;;) { 1033. ch = *l; 1034. buf = l; ^ 1035. buflen = 0; 1036. #ifndef CHARSET_EBCDIC ssl/ssl_ciph.c:1204:29: Array access: Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 4 by call to `SSL_CTX_set_cipher_list` 1202. ok = ssl_cipher_strength_sort(head_p, tail_p); 1203. else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { 1204. int level = buf[9] - '0'; ^ 1205. if (level < 0 || level > 5) { 1206. SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
https://github.com/openssl/openssl/blob/6f8950a3cc466a7e2660dd9d7c8e9d11f47643ed/ssl/ssl_ciph.c/#L1204
d2a_code_trace_data_41742
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/sm2/sm2_crypt.c:339: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 16 steps of the trace crypto/sm2/sm2_crypt.c:339:17: Call 337. if (!EC_POINT_set_affine_coordinates(group, C1, sm2_ctext->C1x, 338. sm2_ctext->C1y, ctx) 339. || !EC_POINT_mul(group, C1, NULL, C1, EC_KEY_get0_private_key(key), ^ 340. ctx) 341. || !EC_POINT_get_affine_coordinates(group, C1, x2, y2, ctx)) { 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_41743
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:57: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 253):unsigned64 by call to `PACKET_forward`. Showing all 14 steps of the trace test/packettest.c:54:10: Call 52. PACKET pkt; 53. 54. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 55. || !TEST_true(PACKET_get_1(&pkt, &i)) 56. || !TEST_uint_eq(i, 0x02) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:55:17: Call 53. 54. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 55. || !TEST_true(PACKET_get_1(&pkt, &i)) ^ 56. || !TEST_uint_eq(i, 0x02) 57. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 2)) ssl/packet_locl.h:271:8: Parameter `pkt->remaining` 269. 270. /* Get 1 byte from |pkt| and store the value in |*data| */ 271. __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data) ^ 272. { 273. if (!PACKET_peek_1(pkt, data)) ssl/packet_locl.h:273:10: Call 271. __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data) 272. { 273. if (!PACKET_peek_1(pkt, data)) ^ 274. return 0; 275. ssl/packet_locl.h:259:8: Parameter `pkt->remaining` 257. 258. /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */ 259. __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt, ^ 260. unsigned int *data) 261. { test/packettest.c:57:17: Call 55. || !TEST_true(PACKET_get_1(&pkt, &i)) 56. || !TEST_uint_eq(i, 0x02) 57. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 2)) ^ 58. || !TEST_true(PACKET_get_1(&pkt, &i)) 59. || !TEST_uint_eq(i, 0xfe) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 253):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_41744
int RAND_status(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->status != NULL) return meth->status(); return 0; } crypto/rand/rand_lib.c:845: error: NULL_DEREFERENCE pointer `meth` last assigned on line 843 could be null and is dereferenced at line 845, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:841:1: start of procedure RAND_status() 839. #endif 840. 841. > int RAND_status(void) 842. { 843. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:843:5: 841. int RAND_status(void) 842. { 843. > const RAND_METHOD *meth = RAND_get_rand_method(); 844. 845. if (meth->status != NULL) crypto/rand/rand_lib.c:726:1: start of procedure RAND_get_rand_method() 724. } 725. 726. > const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:728:5: 726. const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. > const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:730:10: 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. > if (!RUN_ONCE(&rand_init, do_rand_init)) 731. return NULL; 732. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking true branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:730:10: Condition is false 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:730:10: Taking true branch 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:731:9: 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) 731. > return NULL; 732. 733. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:754:1: return from a call to RAND_get_rand_method 752. CRYPTO_THREAD_unlock(rand_meth_lock); 753. return tmp_meth; 754. > } 755. 756. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:845:9: 843. const RAND_METHOD *meth = RAND_get_rand_method(); 844. 845. > if (meth->status != NULL) 846. return meth->status(); 847. return 0;
https://github.com/openssl/openssl/blob/9bba2c4c97a5fc5aea9e24223eebb85a15817e74/crypto/rand/rand_lib.c/#L845
d2a_code_trace_data_41745
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } test/sm2_internal_test.c:162: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_mul`. Showing all 32 steps of the trace test/sm2_internal_test.c:151:17: Call 149. 150. if (!TEST_ptr(expected) 151. || !TEST_true(BN_hex2bn(&priv, privkey_hex))) ^ 152. goto done; 153. crypto/bn/bn_print.c:166:5: Assignment 164. j = i; /* least significant 'hex' */ 165. m = 0; 166. h = 0; ^ 167. while (j > 0) { 168. m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; crypto/bn/bn_print.c:184:5: Assignment 182. j -= BN_BYTES * 2; 183. } 184. ret->top = h; ^ 185. bn_correct_top(ret); 186. test/sm2_internal_test.c:157:17: Call 155. if (!TEST_ptr(key) 156. || !TEST_true(EC_KEY_set_group(key, group)) 157. || !TEST_true(EC_KEY_set_private_key(key, priv))) ^ 158. goto done; 159. crypto/ec/ec_key.c:438:1: Parameter `priv_key->top` 436. } 437. 438. > int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key) 439. { 440. if (key->group == NULL || key->group->meth == NULL) test/sm2_internal_test.c:162:17: Call 160. pt = EC_POINT_new(group); 161. if (!TEST_ptr(pt) 162. || !TEST_true(EC_POINT_mul(group, pt, priv, NULL, NULL, NULL)) ^ 163. || !TEST_true(EC_KEY_set_public_key(key, pt)) 164. || !TEST_true(sm2_ciphertext_size(key, digest, msg_len, &ctext_len))) 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:342:1: Parameter `group->order->top` 340. * in the addition if scalar != NULL 341. */ 342. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 343. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 344. BN_CTX *ctx) crypto/ec/ec_mult.c:393:16: Call 391. * constant time version. 392. */ 393. return ec_mul_consttime(group, r, scalar, NULL, ctx); ^ 394. } 395. 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:147:18: Call 145. BN_CTX_start(ctx); 146. 147. order_bits = BN_num_bits(group->order); ^ 148. 149. s = EC_POINT_new(group); 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/ec_mult.c:189:14: Call 187. * constant-timeness 188. */ 189. if (!BN_nnmod(k, k, group->order, ctx)) ^ 190. goto err; 191. } crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_mul` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_41746
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavcodec/truemotion2rt.c:127: error: Integer Overflow L2 ([0, +oo] - 32):unsigned32 by call to `bitstream_skip`. libavcodec/truemotion2rt.c:119:11: Call 117. return ret; 118. 119. ret = bitstream_init8(bc, avpkt->data + ret, avpkt->size - ret); ^ 120. if (ret < 0) 121. return ret; libavcodec/bitstream.h:104:1: Parameter `bc->bits_left` 102. 103. /* Initialize BitstreamContext with buffer size in bytes instead of bits. */ 104. static inline int bitstream_init8(BitstreamContext *bc, const uint8_t *buffer, ^ 105. unsigned byte_size) 106. { libavcodec/truemotion2rt.c:127:5: Call 125. return ret; 126. 127. bitstream_skip(bc, 32); ^ 128. delta_mode = s->delta_size - 2; 129. dst = p->data[0]; libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:244:9: Call 242. { 243. if (n <= bc->bits_left) 244. skip_remaining(bc, n); ^ 245. else { 246. n -= bc->bits_left; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 32):unsigned32 by call to `bitstream_skip` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L237
d2a_code_trace_data_41747
static int wpacket_intern_close(WPACKET *pkt) { WPACKET_SUB *sub = pkt->subs; 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 ((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((unsigned char *)&pkt->buf->data[sub->packet_len], packlen, sub->lenbytes)) return 0; pkt->subs = sub->parent; OPENSSL_free(sub); return 1; } ssl/statem/statem_clnt.c:799: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `WPACKET_close`. Showing all 11 steps of the trace ssl/statem/statem_clnt.c:797:17: Call 795. i = s->session->session_id_length; 796. if (i > (int)sizeof(s->session->session_id) 797. || !WPACKET_start_sub_packet_u8(&pkt) ^ 798. || (i != 0 && !WPACKET_memcpy(&pkt, s->session->session_id, i)) 799. || !WPACKET_close(&pkt)) { ssl/packet.c:190:1: Parameter `lenbytes` 188. } 189. 190. > int WPACKET_start_sub_packet_len(WPACKET *pkt, size_t lenbytes) 191. { 192. WPACKET_SUB *sub; ssl/packet.c:207:5: Assignment 205. pkt->subs = sub; 206. sub->pwritten = pkt->written + lenbytes; 207. sub->lenbytes = lenbytes; ^ 208. 209. if (lenbytes == 0) { ssl/statem/statem_clnt.c:799:17: Call 797. || !WPACKET_start_sub_packet_u8(&pkt) 798. || (i != 0 && !WPACKET_memcpy(&pkt, s->session->session_id, i)) 799. || !WPACKET_close(&pkt)) { ^ 800. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); 801. goto err; ssl/packet.c:158:1: Parameter `pkt->curr` 156. } 157. 158. > int WPACKET_close(WPACKET *pkt) 159. { 160. /* ssl/packet.c:167:12: Call 165. return 0; 166. 167. return wpacket_intern_close(pkt); ^ 168. } 169. ssl/packet.c:124:1: <LHS trace> 122. * close a sub-packet and write out its length if necessary. 123. */ 124. > static int wpacket_intern_close(WPACKET *pkt) 125. { 126. WPACKET_SUB *sub = pkt->subs; ssl/packet.c:124:1: Parameter `pkt->curr` 122. * close a sub-packet and write out its length if necessary. 123. */ 124. > static int wpacket_intern_close(WPACKET *pkt) 125. { 126. WPACKET_SUB *sub = pkt->subs; ssl/packet.c:124:1: <RHS trace> 122. * close a sub-packet and write out its length if necessary. 123. */ 124. > static int wpacket_intern_close(WPACKET *pkt) 125. { 126. WPACKET_SUB *sub = pkt->subs; ssl/packet.c:124:1: Parameter `pkt->subs->lenbytes` 122. * close a sub-packet and write out its length if necessary. 123. */ 124. > static int wpacket_intern_close(WPACKET *pkt) 125. { 126. WPACKET_SUB *sub = pkt->subs; ssl/packet.c:136:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `WPACKET_close` 134. && sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) { 135. /* Deallocate any bytes allocated for the length of the WPACKET */ 136. if ((pkt->curr - sub->lenbytes) == sub->packet_len) { ^ 137. pkt->written -= sub->lenbytes; 138. pkt->curr -= sub->lenbytes;
https://github.com/openssl/openssl/blob/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/packet.c/#L136
d2a_code_trace_data_41748
static int flv_write_header(AVFormatContext *s) { ByteIOContext *pb = s->pb; FLVContext *flv = s->priv_data; int i, width, height, samplerate, samplesize, channels, audiocodecid, videocodecid; double framerate = 0.0; int metadata_size_pos, data_size; flv->hasAudio = 0; flv->hasVideo = 0; for(i=0; i<s->nb_streams; i++){ AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_type == CODEC_TYPE_VIDEO) { width = enc->width; height = enc->height; if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) { framerate = av_q2d(s->streams[i]->r_frame_rate); } else { framerate = 1/av_q2d(s->streams[i]->codec->time_base); } flv->hasVideo=1; videocodecid = enc->codec_tag; if(videocodecid == 0) { av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n"); return -1; } } else { flv->hasAudio=1; samplerate = enc->sample_rate; channels = enc->channels; audiocodecid = enc->codec_tag; samplesize = (enc->codec_id == CODEC_ID_PCM_S8) ? 8 : 16; if(get_audio_flags(enc)<0) return -1; } av_set_pts_info(s->streams[i], 24, 1, 1000); } put_tag(pb,"FLV"); put_byte(pb,1); put_byte(pb, FLV_HEADER_FLAG_HASAUDIO * flv->hasAudio + FLV_HEADER_FLAG_HASVIDEO * flv->hasVideo); put_be32(pb,9); put_be32(pb,0); for(i=0; i<s->nb_streams; i++){ if(s->streams[i]->codec->codec_tag == 5){ put_byte(pb,8); put_be24(pb,0); put_be24(pb,0); put_be32(pb,0); put_be32(pb,11); flv->reserved=5; } } put_byte(pb, 18); metadata_size_pos= url_ftell(pb); put_be24(pb, 0); put_be24(pb, 0); put_be32(pb, 0); put_byte(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, "onMetaData"); put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY); put_be32(pb, 5*flv->hasVideo + 4*flv->hasAudio + 2); put_amf_string(pb, "duration"); flv->duration_offset= url_ftell(pb); put_amf_double(pb, 0); if(flv->hasVideo){ put_amf_string(pb, "width"); put_amf_double(pb, width); put_amf_string(pb, "height"); put_amf_double(pb, height); put_amf_string(pb, "videodatarate"); put_amf_double(pb, s->bit_rate / 1024.0); put_amf_string(pb, "framerate"); put_amf_double(pb, framerate); put_amf_string(pb, "videocodecid"); put_amf_double(pb, videocodecid); } if(flv->hasAudio){ put_amf_string(pb, "audiosamplerate"); put_amf_double(pb, samplerate); put_amf_string(pb, "audiosamplesize"); put_amf_double(pb, samplesize); put_amf_string(pb, "stereo"); put_amf_bool(pb, (channels == 2)); put_amf_string(pb, "audiocodecid"); put_amf_double(pb, audiocodecid); } put_amf_string(pb, "filesize"); flv->filesize_offset= url_ftell(pb); put_amf_double(pb, 0); put_amf_string(pb, ""); put_byte(pb, AMF_END_OF_OBJECT); data_size= url_ftell(pb) - metadata_size_pos - 10; url_fseek(pb, metadata_size_pos, SEEK_SET); put_be24(pb, data_size); url_fseek(pb, data_size + 10 - 3, SEEK_CUR); put_be32(pb, data_size + 11); return 0; } libavformat/flvenc.c:209: error: Uninitialized Value The value read from width was never initialized. libavformat/flvenc.c:209:9: 207. if(flv->hasVideo){ 208. put_amf_string(pb, "width"); 209. put_amf_double(pb, width); ^ 210. 211. put_amf_string(pb, "height");
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvenc.c/#L209
d2a_code_trace_data_41749
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; } test/ec_internal_test.c:36: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_pseudo_rand`. Showing all 22 steps of the trace test/ec_internal_test.c:29:9: Call 27. 28. BN_CTX_start(ctx); 29. a = BN_CTX_get(ctx); ^ 30. b = BN_CTX_get(ctx); 31. if (!TEST_ptr(c = BN_CTX_get(ctx)) crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); test/ec_internal_test.c:36:13: Call 34. || !TEST_true(BN_is_one(b)) 35. /* (1/a)*a = 1 */ 36. || !TEST_true(BN_pseudo_rand(a, BN_num_bits(group->field) - 1, ^ 37. BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY)) 38. || !TEST_true(group->meth->field_inv(group, b, a, ctx)) crypto/bn/bn_rand.c:187:1: Parameter `*rnd->d` 185. } 186. 187. > int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) 188. { 189. return BN_rand(rnd, bits, top, bottom); crypto/bn/bn_rand.c:189:12: Call 187. int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) 188. { 189. return BN_rand(rnd, bits, top, bottom); ^ 190. } 191. crypto/bn/bn_rand.c:97:1: Parameter `*rnd->d` 95. } 96. 97. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 98. { 99. return bnrand(NORMAL, rnd, bits, top, bottom); crypto/bn/bn_rand.c:99:12: Call 97. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 98. { 99. return bnrand(NORMAL, rnd, bits, top, bottom); ^ 100. } 101. crypto/bn/bn_rand.c:21:1: Parameter `*rnd->d` 19. } BNRAND_FLAG; 20. 21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom) 22. { 23. unsigned char *buf = NULL; crypto/bn/bn_rand.c:29:9: Call 27. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 28. goto toosmall; 29. BN_zero(rnd); ^ 30. return 1; 31. } crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_pseudo_rand` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_41750
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } apps/s_client.c:284: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_ex`. Showing all 51 steps of the trace apps/s_client.c:282:22: Call 280. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 281. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 282. p != NULL && BN_rshift1(p, N) && ^ 283. /* p = (N-1)/2 */ 284. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && crypto/bn/bn_shift.c:60:14: Assignment 58. i = a->top; 59. ap = a->d; 60. j = i - (ap[i - 1] == 1); ^ 61. if (a != r) { 62. if (bn_wexpand(r, j) == NULL) crypto/bn/bn_shift.c:60:5: Assignment 58. i = a->top; 59. ap = a->d; 60. j = i - (ap[i - 1] == 1); ^ 61. if (a != r) { 62. if (bn_wexpand(r, j) == NULL) crypto/bn/bn_shift.c:76:5: Assignment 74. c = (t & 1) ? BN_TBIT : 0; 75. } 76. r->top = j; ^ 77. if (!r->top) 78. r->neg = 0; /* don't allow negative zero */ apps/s_client.c:284:9: Call 282. p != NULL && BN_rshift1(p, N) && 283. /* p = (N-1)/2 */ 284. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 285. r != NULL && 286. /* verify g^((N-1)/2) == -1 (mod N) */ crypto/bn/bn_prime.c:145:1: Parameter `a->top` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:596:1: Parameter `m->top` 594. * http://www.daemonology.net/hyperthreading-considered-harmful/) 595. */ 596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 597. const BIGNUM *m, BN_CTX *ctx, 598. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:617:10: Call 615. bn_check_top(m); 616. 617. if (!BN_is_odd(m)) { ^ 618. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS); 619. return 0; crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:755:14: Call 753. /* prepare a^1 in Montgomery domain */ 754. if (a->neg || BN_ucmp(a, m) >= 0) { 755. if (!BN_nnmod(&am, a, m, ctx)) ^ 756. goto err; 757. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_ex` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_41751
static int scaling_list_data(HEVCContext *s, ScalingList *sl) { GetBitContext *gb = &s->HEVClc.gb; uint8_t scaling_list_pred_mode_flag[4][6]; int32_t scaling_list_dc_coef[2][6]; int size_id, matrix_id, i, pos; for (size_id = 0; size_id < 4; size_id++) for (matrix_id = 0; matrix_id < (size_id == 3 ? 2 : 6); matrix_id++) { scaling_list_pred_mode_flag[size_id][matrix_id] = get_bits1(gb); if (!scaling_list_pred_mode_flag[size_id][matrix_id]) { unsigned int delta = get_ue_golomb_long(gb); if (delta) { if (matrix_id < delta) { av_log(s->avctx, AV_LOG_ERROR, "Invalid delta in scaling list data: %d.\n", delta); return AVERROR_INVALIDDATA; } memcpy(sl->sl[size_id][matrix_id], sl->sl[size_id][matrix_id - delta], size_id > 0 ? 64 : 16); if (size_id > 1) sl->sl_dc[size_id - 2][matrix_id] = sl->sl_dc[size_id - 2][matrix_id - delta]; } } else { int next_coef, coef_num; int32_t scaling_list_delta_coef; next_coef = 8; coef_num = FFMIN(64, 1 << (4 + (size_id << 1))); if (size_id > 1) { scaling_list_dc_coef[size_id - 2][matrix_id] = get_se_golomb(gb) + 8; next_coef = scaling_list_dc_coef[size_id - 2][matrix_id]; sl->sl_dc[size_id - 2][matrix_id] = next_coef; } for (i = 0; i < coef_num; i++) { if (size_id == 0) pos = 4 * ff_hevc_diag_scan4x4_y[i] + ff_hevc_diag_scan4x4_x[i]; else pos = 8 * ff_hevc_diag_scan8x8_y[i] + ff_hevc_diag_scan8x8_x[i]; scaling_list_delta_coef = get_se_golomb(gb); next_coef = (next_coef + scaling_list_delta_coef + 256) % 256; sl->sl[size_id][matrix_id][pos] = next_coef; } } } return 0; } libavcodec/hevc_ps.c:573: error: Integer Overflow L2 ([0, 5] - [-oo, 5]):unsigned32. libavcodec/hevc_ps.c:559:14: <LHS trace> 557. 558. for (size_id = 0; size_id < 4; size_id++) 559. for (matrix_id = 0; matrix_id < (size_id == 3 ? 2 : 6); matrix_id++) { ^ 560. scaling_list_pred_mode_flag[size_id][matrix_id] = get_bits1(gb); 561. if (!scaling_list_pred_mode_flag[size_id][matrix_id]) { libavcodec/hevc_ps.c:559:14: Assignment 557. 558. for (size_id = 0; size_id < 4; size_id++) 559. for (matrix_id = 0; matrix_id < (size_id == 3 ? 2 : 6); matrix_id++) { ^ 560. scaling_list_pred_mode_flag[size_id][matrix_id] = get_bits1(gb); 561. if (!scaling_list_pred_mode_flag[size_id][matrix_id]) { libavcodec/hevc_ps.c:559:14: <RHS trace> 557. 558. for (size_id = 0; size_id < 4; size_id++) 559. for (matrix_id = 0; matrix_id < (size_id == 3 ? 2 : 6); matrix_id++) { ^ 560. scaling_list_pred_mode_flag[size_id][matrix_id] = get_bits1(gb); 561. if (!scaling_list_pred_mode_flag[size_id][matrix_id]) { libavcodec/hevc_ps.c:559:14: Assignment 557. 558. for (size_id = 0; size_id < 4; size_id++) 559. for (matrix_id = 0; matrix_id < (size_id == 3 ? 2 : 6); matrix_id++) { ^ 560. scaling_list_pred_mode_flag[size_id][matrix_id] = get_bits1(gb); 561. if (!scaling_list_pred_mode_flag[size_id][matrix_id]) { libavcodec/hevc_ps.c:573:21: Binary operation: ([0, 5] - [-oo, 5]):unsigned32 571. } 572. 573. memcpy(sl->sl[size_id][matrix_id], ^ 574. sl->sl[size_id][matrix_id - delta], 575. size_id > 0 ? 64 : 16);
https://github.com/libav/libav/blob/e22ebd04bcab7f86548794556c28ecca46d9c2ac/libavcodec/hevc_ps.c/#L573
d2a_code_trace_data_41752
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1055: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 6]):unsigned64 by call to `WPACKET_put_bytes`. Showing all 9 steps of the trace ssl/t1_lib.c:1016:1: Parameter `pkt->written` 1014. } 1015. 1016. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al) 1017. { 1018. #ifndef OPENSSL_NO_EC ssl/t1_lib.c:1055:14: Call 1053. if (s->tlsext_hostname != NULL) { 1054. /* Add TLS extension servername to the Client Hello message */ 1055. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_server_name, 2) ^ 1056. /* Sub-packet for server_name extension */ 1057. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:226:1: Parameter `pkt->written` 224. } 225. 226. > int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t size) 227. { 228. unsigned char *data; ssl/packet.c:234:17: Call 232. 233. if (size > sizeof(unsigned int) 234. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 235. || !put_value(data, val, size)) 236. 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 + 6]):unsigned64 by call to `WPACKET_put_bytes` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/packet.c/#L25
d2a_code_trace_data_41753
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); ffmpeg_exit(1); } *mid++= 0; av_metadata_set2(&metadata, arg, mid, 0); return 0; } ffmpeg.c:2820: error: Null Dereference pointer `mid` last assigned on line 2820 could be null and is dereferenced at line 2820, column 5. ffmpeg.c:2812:1: start of procedure opt_metadata() 2810. } 2811. 2812. static int opt_metadata(const char *opt, const char *arg) ^ 2813. { 2814. char *mid= strchr(arg, '='); ffmpeg.c:2814:5: 2812. static int opt_metadata(const char *opt, const char *arg) 2813. { 2814. char *mid= strchr(arg, '='); ^ 2815. 2816. if(!mid){ ffmpeg.c:2816:9: Taking true branch 2814. char *mid= strchr(arg, '='); 2815. 2816. if(!mid){ ^ 2817. fprintf(stderr, "Missing =\n"); 2818. ffmpeg_exit(1); ffmpeg.c:2817:9: 2815. 2816. if(!mid){ 2817. fprintf(stderr, "Missing =\n"); ^ 2818. ffmpeg_exit(1); 2819. } ffmpeg.c:2818:9: Skipping ffmpeg_exit(): empty list of specs 2816. if(!mid){ 2817. fprintf(stderr, "Missing =\n"); 2818. ffmpeg_exit(1); ^ 2819. } 2820. *mid++= 0; ffmpeg.c:2820:5: 2818. ffmpeg_exit(1); 2819. } 2820. *mid++= 0; ^ 2821. 2822. av_metadata_set2(&metadata, arg, mid, 0);
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L2820