id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_45154
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:866: error: NULL_DEREFERENCE pointer `meth` last assigned on line 864 could be null and is dereferenced at line 866, column 9. Showing all 6 steps of the trace crypto/rand/rand_lib.c:862:1: start of procedure RAND_status() 860. #endif 861. 862. > int RAND_status(void) 863. { 864. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:864:5: 862. int RAND_status(void) 863. { 864. > const RAND_METHOD *meth = RAND_get_rand_method(); 865. 866. if (meth->status != NULL) crypto/rand/rand_lib.c:722:1: start of procedure RAND_get_rand_method() 720. #endif 721. 722. > const RAND_METHOD *RAND_get_rand_method(void) 723. { 724. #ifdef FIPS_MODE crypto/rand/rand_lib.c:725:5: 723. { 724. #ifdef FIPS_MODE 725. > return NULL; 726. #else 727. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:754:1: return from a call to RAND_get_rand_method 752. return tmp_meth; 753. #endif 754. > } 755. 756. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:866:9: 864. const RAND_METHOD *meth = RAND_get_rand_method(); 865. 866. > if (meth->status != NULL) 867. return meth->status(); 868. return 0;
https://github.com/openssl/openssl/blob/363e941ed43c648adf4d6d0874077ddd80041e1f/crypto/rand/rand_lib.c/#L866
d2a_code_trace_data_45155
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:4348: error: Null Dereference pointer `today` last assigned on line 4346 could be null and is dereferenced at line 4348, column 69. avconv.c:4342:1: start of procedure opt_vstats() 4340. } 4341. 4342. static int opt_vstats(const char *opt, const char *arg) ^ 4343. { 4344. char filename[40]; avconv.c:4345:5: 4343. { 4344. char filename[40]; 4345. time_t today2 = time(NULL); ^ 4346. struct tm *today = localtime(&today2); 4347. avconv.c:4346:5: 4344. char filename[40]; 4345. time_t today2 = time(NULL); 4346. struct tm *today = localtime(&today2); ^ 4347. 4348. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv.c:4348:5: 4346. struct tm *today = localtime(&today2); 4347. 4348. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4349. today->tm_sec); 4350. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/e056f8d37dfc1252a288b0272256a7562a870003/avconv.c/#L4348
d2a_code_trace_data_45156
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr) { register const MPA_INT *w, *w2, *p; int j; OUT_INT *samples2; #if CONFIG_FLOAT float sum, sum2; #elif FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif memcpy(synth_buf + 512, synth_buf, 32 * sizeof(*synth_buf)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(MACS, sum, w, p); p = synth_buf + 48; SUM8(MLSS, 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, MACS, sum2, MLSS, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, MLSS, sum2, MLSS, 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(MLSS, sum, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; } libavcodec/qdm2.c:1967: error: Buffer Overrun L1 Offset: [464, +oo] (⇐ [16, +oo] + 448) Size: 2 by call to `qdm2_decode`. libavcodec/qdm2.c:1967:13: Call 1965. 1966. for (i = 0; i < 16; i++) { 1967. if (qdm2_decode(s, buf, out) < 0) ^ 1968. return -1; 1969. out += s->channels * s->frame_size; libavcodec/qdm2.c:1911:13: Call 1909. if (!q->has_errors) { 1910. if (q->sub_packet == 2) 1911. qdm2_decode_fft_packets(q); ^ 1912. 1913. qdm2_fft_tone_synthesizer(q, q->sub_packet); libavcodec/qdm2.c:1967:13: Call 1965. 1966. for (i = 0; i < 16; i++) { 1967. if (qdm2_decode(s, buf, out) < 0) ^ 1968. return -1; 1969. out += s->channels * s->frame_size; libavcodec/qdm2.c:1886:1: Parameter `q->synth_buf_offset[*]` 1884. 1885. 1886. static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out) ^ 1887. { 1888. int ch, i; libavcodec/qdm2.c:1928:9: Call 1926. /* sound synthesis stage 2 (MPEG audio like synthesis filter) */ 1927. if (!q->has_errors && q->do_synth_filter) 1928. qdm2_synthesis_filter(q, q->sub_packet); ^ 1929. 1930. q->sub_packet = (q->sub_packet + 1) % 16; libavcodec/qdm2.c:1602:1: Parameter `q->synth_buf[*]` 1600. * @param index subpacket number 1601. */ 1602. static void qdm2_synthesis_filter (QDM2Context *q, int index) ^ 1603. { 1604. OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE]; libavcodec/qdm2.c:1619:13: Call 1617. 1618. for (i = 0; i < 8; i++) { 1619. ff_mpa_synth_filter(q->synth_buf[ch], &(q->synth_buf_offset[ch]), ^ 1620. ff_mpa_synth_window, &dither_state, 1621. samples_ptr, q->nb_channels, libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr` 703. /* XXX: optimize by avoiding ring buffer usage */ 704. #if !CONFIG_FLOAT 705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 706. MPA_INT *window, int *dither_state, 707. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:718:5: Assignment 716. 717. offset = *synth_buf_offset; 718. synth_buf = synth_buf_ptr + offset; ^ 719. 720. #if FRAC_BITS <= 15 libavcodec/mpegaudiodec.c:731:5: Call 729. #endif 730. 731. apply_window_mp3_c(synth_buf, window, dither_state, samples, incr); ^ 732. 733. offset = (offset - 32) & 511; libavcodec/mpegaudiodec.c:646:1: <Length trace> 644. } 645. 646. static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, ^ 647. int *dither_state, OUT_INT *samples, int incr) 648. { libavcodec/mpegaudiodec.c:646:1: Parameter `*synth_buf` 644. } 645. 646. static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, ^ 647. int *dither_state, OUT_INT *samples, int incr) 648. { libavcodec/mpegaudiodec.c:668:5: Assignment 666. 667. sum = *dither_state; 668. p = synth_buf + 16; ^ 669. SUM8(MACS, sum, w, p); 670. p = synth_buf + 48; libavcodec/mpegaudiodec.c:669:5: Array access: Offset: [464, +oo] (⇐ [16, +oo] + 448) Size: 2 by call to `qdm2_decode` 667. sum = *dither_state; 668. p = synth_buf + 16; 669. SUM8(MACS, sum, w, p); ^ 670. p = synth_buf + 48; 671. SUM8(MLSS, sum, w + 32, p);
https://github.com/libav/libav/blob/47d2ddca802f4c1bc4b454c5ac40f06f79b740a0/libavcodec/mpegaudiodec.c/#L669
d2a_code_trace_data_45157
void TIFFReverseBits(uint8* cp, tmsize_t n) { for (; n > 8; n -= 8) { cp[0] = TIFFBitRevTable[cp[0]]; cp[1] = TIFFBitRevTable[cp[1]]; cp[2] = TIFFBitRevTable[cp[2]]; cp[3] = TIFFBitRevTable[cp[3]]; cp[4] = TIFFBitRevTable[cp[4]]; cp[5] = TIFFBitRevTable[cp[5]]; cp[6] = TIFFBitRevTable[cp[6]]; cp[7] = TIFFBitRevTable[cp[7]]; cp += 8; } while (n-- > 0) *cp = TIFFBitRevTable[*cp], cp++; } tools/tiffcp.c:781: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteScanline`. tools/tiffcp.c:768:1: Parameter `out->tif_rawdata` 766. * Contig -> contig by scanline for rows/strip change. 767. */ 768. DECLAREcpFunc(cpContig2ContigByRow) ^ 769. { 770. tdata_t buf = _TIFFmalloc(TIFFScanlineSize(in)); tools/tiffcp.c:781:7: Call 779. goto bad; 780. } 781. if (TIFFWriteScanline(out, buf, row, 0) < 0) { ^ 782. TIFFError(TIFFFileName(out), 783. "Error, can't write scanline %lu", libtiff/tif_write.c:48:1: Parameter `*tif->tif_rawdata` 46. static int TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc); 47. 48. int ^ 49. TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample) 50. { libtiff/tif_write.c:107:8: Call 105. * Changing strips -- flush any data present. 106. */ 107. if (!TIFFFlushData(tif)) ^ 108. return (-1); 109. tif->tif_curstrip = strip; libtiff/tif_flush.c:98:1: Parameter `*tif->tif_rawdata` 96. * problems for other people. 97. */ 98. int ^ 99. TIFFFlushData(TIFF* tif) 100. { libtiff/tif_flush.c:108:10: Call 106. return (0); 107. } 108. return (TIFFFlushData1(tif)); ^ 109. } 110. libtiff/tif_write.c:709:1: Parameter `*tif->tif_rawdata` 707. * for infinite recursion. 708. */ 709. int ^ 710. TIFFFlushData1(TIFF* tif) 711. { libtiff/tif_write.c:715:4: Call 713. if (!isFillOrder(tif, tif->tif_dir.td_fillorder) && 714. (tif->tif_flags & TIFF_NOBITREV) == 0) 715. TIFFReverseBits((uint8*)tif->tif_rawdata, ^ 716. tif->tif_rawcc); 717. if (!TIFFAppendToStrip(tif, libtiff/tif_swab.c:285:1: <Length trace> 283. } 284. 285. void ^ 286. TIFFReverseBits(uint8* cp, tmsize_t n) 287. { libtiff/tif_swab.c:285:1: Parameter `*cp` 283. } 284. 285. void ^ 286. TIFFReverseBits(uint8* cp, tmsize_t n) 287. { libtiff/tif_swab.c:296:3: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteScanline` 294. cp[5] = TIFFBitRevTable[cp[5]]; 295. cp[6] = TIFFBitRevTable[cp[6]]; 296. cp[7] = TIFFBitRevTable[cp[7]]; ^ 297. cp += 8; 298. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L296
d2a_code_trace_data_45158
static int expand(OPENSSL_LHASH *lh) { OPENSSL_LH_NODE **n, **n1, **n2, *np; unsigned int p, pmax, nni, j; unsigned long hash; nni = lh->num_alloc_nodes; p = lh->p; pmax = lh->pmax; if (p + 1 >= pmax) { j = nni * 2; n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j); if (n == NULL) { lh->error++; return 0; } lh->b = n; memset(n + nni, 0, sizeof(*n) * (j - nni)); lh->pmax = nni; lh->num_alloc_nodes = j; lh->num_expand_reallocs++; lh->p = 0; } else { lh->p++; } lh->num_nodes++; lh->num_expands++; n1 = &(lh->b[p]); n2 = &(lh->b[p + pmax]); *n2 = NULL; for (np = *n1; np != NULL;) { hash = np->hash; if ((hash % nni) != p) { *n1 = (*n1)->next; np->next = *n2; *n2 = np; } else n1 = &((*n1)->next); np = *n1; } return 1; } test/sslapitest.c:4827: error: BUFFER_OVERRUN_L3 Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert`. Showing all 24 steps of the trace test/sslapitest.c:4803:12: Call 4801. goto end; 4802. 4803. gNid = SRP_create_verifier(userid, password, &row[DB_srpsalt], ^ 4804. &row[DB_srpverifier], NULL, NULL); 4805. if (!TEST_ptr(gNid)) crypto/srp/srp_vfy.c:649:10: Call 647. goto err; 648. 649. if (!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) ^ 650. goto err; 651. crypto/srp/srp_vfy.c:722:9: Call 720. } 721. 722. x = SRP_Calc_x(salttmp, user, pass); ^ 723. if (x == NULL) 724. goto err; crypto/srp/srp_lib.c:136:10: Call 134. goto err; 135. 136. if (!EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL) ^ 137. || !EVP_DigestUpdate(ctxt, user, strlen(user)) 138. || !EVP_DigestUpdate(ctxt, ":", 1) crypto/evp/digest.c:122:19: Call 120. 121. if (type != NULL && impl == NULL) 122. tmpimpl = ENGINE_get_digest_engine(type->type); ^ 123. #endif 124. crypto/engine/tb_digest.c:65:12: Call 63. ENGINE *ENGINE_get_digest_engine(int nid) 64. { 65. return engine_table_select(&digest_table, nid); ^ 66. } 67. crypto/engine/eng_table.c:212:10: Call 210. * operations. But don't worry about a debug printout 211. */ 212. if (!int_table_check(table, 0)) ^ 213. goto end; 214. tmplate.nid = nid; crypto/engine/eng_table.c:73:15: Call 71. if (!create) 72. return 0; 73. if ((lh = lh_ENGINE_PILE_new(engine_pile_hash, engine_pile_cmp)) == NULL) ^ 74. return 0; 75. *t = (ENGINE_TABLE *)lh; crypto/engine/eng_int.h:152:1: Call 150. typedef struct st_engine_pile ENGINE_PILE; 151. 152. > DEFINE_LHASH_OF(ENGINE_PILE); 153. 154. #endif /* HEADER_ENGINE_INT_H */ crypto/lhash/lhash.c:64:5: Assignment 62. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 63. ret->num_nodes = MIN_NODES / 2; 64. ret->num_alloc_nodes = MIN_NODES; ^ 65. ret->pmax = MIN_NODES / 2; 66. ret->up_load = UP_LOAD; test/sslapitest.c:4827:17: Call 4825. || !TEST_ptr(row[DB_srptype]) 4826. || !TEST_ptr(row[DB_srpgN]) 4827. || !TEST_true(TXT_DB_insert(db, row))) ^ 4828. goto end; 4829. crypto/txt_db/txt_db.c:237:1: Parameter `(*db->index)->num_alloc_nodes` 235. } 236. 237. > int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) 238. { 239. int i; crypto/txt_db/txt_db.c:260:19: Call 258. if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0)) 259. continue; 260. (void)lh_OPENSSL_STRING_insert(db->index[i], row); ^ 261. if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL) 262. goto err1; include/openssl/lhash.h:202:1: Parameter `lh->num_alloc_nodes` 200. LHASH_OF(type) 201. 202. > DEFINE_LHASH_OF(OPENSSL_STRING); 203. # ifdef _MSC_VER 204. /* include/openssl/lhash.h:202:1: Call 200. LHASH_OF(type) 201. 202. > DEFINE_LHASH_OF(OPENSSL_STRING); 203. # ifdef _MSC_VER 204. /* crypto/lhash/lhash.c:104:1: Parameter `lh->num_alloc_nodes` 102. } 103. 104. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data) 105. { 106. unsigned long hash; crypto/lhash/lhash.c:111:77: Call 109. 110. lh->error = 0; 111. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh)) ^ 112. return NULL; /* 'lh->error++' already done in 'expand' */ 113. crypto/lhash/lhash.c:222:1: <Offset trace> 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:222:1: Parameter `lh->num_alloc_nodes` 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:228:5: Assignment 226. unsigned long hash; 227. 228. nni = lh->num_alloc_nodes; ^ 229. p = lh->p; 230. pmax = lh->pmax; crypto/lhash/lhash.c:222:1: <Length trace> 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:222:1: Parameter `lh->num_alloc_nodes` 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:228:5: Assignment 226. unsigned long hash; 227. 228. nni = lh->num_alloc_nodes; ^ 229. p = lh->p; 230. pmax = lh->pmax; crypto/lhash/lhash.c:239:9: Array access: Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert` 237. } 238. lh->b = n; 239. memset(n + nni, 0, sizeof(*n) * (j - nni)); ^ 240. lh->pmax = nni; 241. lh->num_alloc_nodes = j;
https://github.com/openssl/openssl/blob/866cc2334c95c8602eb4d018bfc224357c47b511/crypto/lhash/lhash.c/#L239
d2a_code_trace_data_45159
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1061: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 13]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1059:21: Call 1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) 1058. /* Sub-packet for server_name extension */ 1059. || !WPACKET_start_sub_packet_u16(pkt) ^ 1060. /* Sub-packet for servername list (always 1 hostname)*/ 1061. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:205:1: Parameter `pkt->buf->length` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1061:21: Call 1059. || !WPACKET_start_sub_packet_u16(pkt) 1060. /* Sub-packet for servername list (always 1 hostname)*/ 1061. || !WPACKET_start_sub_packet_u16(pkt) ^ 1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name) 1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname, ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:229:10: Call 227. } 228. 229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 230. return 0; 231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 13]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25
d2a_code_trace_data_45160
void av_close_input_stream(AVFormatContext *s) { int i; AVStream *st; if (s->cur_st && s->cur_st->parser) av_free_packet(&s->cur_pkt); if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); } av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec); av_free(st->filename); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } flush_packet_queue(s); av_freep(&s->priv_data); av_free(s); } ffmpeg.c:3862: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `av_close_input_file`. ffmpeg.c:3862:9: Call 3860. } 3861. for(i=0;i<nb_input_files;i++) 3862. av_close_input_file(input_files[i]); ^ 3863. 3864. av_free_static(); libavformat/utils.c:2152:1: Parameter `s->nb_programs` 2150. } 2151. 2152. void av_close_input_file(AVFormatContext *s) ^ 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; libavformat/utils.c:2155:5: Call 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; 2155. av_close_input_stream(s); ^ 2156. if (pb) 2157. url_fclose(pb); libavformat/utils.c:2118:1: <LHS trace> 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2118:1: Parameter `s->nb_programs` 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file` 2139. av_free(st); 2140. } 2141. for(i=s->nb_programs-1; i>=0; i--) { ^ 2142. av_freep(&s->programs[i]->provider_name); 2143. av_freep(&s->programs[i]->name);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141
d2a_code_trace_data_45161
int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) { X509_NAME *xn; X509_OBJECT obj, *pobj; int i, ok, idx, ret; xn=X509_get_issuer_name(x); ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); if (ok != X509_LU_X509) { if (ok == X509_LU_RETRY) { X509_OBJECT_free_contents(&obj); X509err(X509_F_X509_STORE_CTX_GET1_ISSUER,X509_R_SHOULD_RETRY); return -1; } else if (ok != X509_LU_FAIL) { X509_OBJECT_free_contents(&obj); return -1; } return 0; } if (ctx->check_issued(ctx, x, obj.data.x509)) { *issuer = obj.data.x509; return 1; } X509_OBJECT_free_contents(&obj); ret = 0; CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); if (idx != -1) { for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) { pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); if (pobj->type != X509_LU_X509) break; if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509))) break; if (ctx->check_issued(ctx, x, pobj->data.x509)) { *issuer = pobj->data.x509; X509_OBJECT_up_ref_count(pobj); ret = 1; break; } } } CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); return ret; } crypto/x509/x509_lu.c:679: error: NULL_DEREFERENCE pointer `pobj` last assigned on line 677 could be null and is dereferenced at line 679, column 8. Showing all 43 steps of the trace crypto/x509/x509_lu.c:637:1: start of procedure X509_STORE_CTX_get1_issuer() 635. * -1 some other error. 636. */ 637. > int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) 638. { 639. X509_NAME *xn; crypto/x509/x509_lu.c:642:2: 640. X509_OBJECT obj, *pobj; 641. int i, ok, idx, ret; 642. > xn=X509_get_issuer_name(x); 643. ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); 644. if (ok != X509_LU_X509) crypto/x509/x509_cmp.c:130:1: start of procedure X509_get_issuer_name() 128. #endif 129. 130. > X509_NAME *X509_get_issuer_name(X509 *a) 131. { 132. return(a->cert_info->issuer); crypto/x509/x509_cmp.c:132:2: 130. X509_NAME *X509_get_issuer_name(X509 *a) 131. { 132. > return(a->cert_info->issuer); 133. } 134. crypto/x509/x509_cmp.c:133:2: return from a call to X509_get_issuer_name 131. { 132. return(a->cert_info->issuer); 133. } ^ 134. 135. unsigned long X509_issuer_name_hash(X509 *x) crypto/x509/x509_lu.c:643:2: Skipping X509_STORE_get_by_subject(): empty list of specs 641. int i, ok, idx, ret; 642. xn=X509_get_issuer_name(x); 643. ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); ^ 644. if (ok != X509_LU_X509) 645. { crypto/x509/x509_lu.c:644:6: Taking false branch 642. xn=X509_get_issuer_name(x); 643. ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); 644. if (ok != X509_LU_X509) ^ 645. { 646. if (ok == X509_LU_RETRY) crypto/x509/x509_lu.c:661:6: Taking false branch 659. } 660. /* If certificate matches all OK */ 661. if (ctx->check_issued(ctx, x, obj.data.x509)) ^ 662. { 663. *issuer = obj.data.x509; crypto/x509/x509_lu.c:666:2: 664. return 1; 665. } 666. > X509_OBJECT_free_contents(&obj); 667. 668. /* Else find index of first cert accepted by 'check_issued' */ crypto/x509/x509_lu.c:426:1: start of procedure X509_OBJECT_free_contents() 424. } 425. 426. > void X509_OBJECT_free_contents(X509_OBJECT *a) 427. { 428. switch (a->type) crypto/x509/x509_lu.c:428:2: 426. void X509_OBJECT_free_contents(X509_OBJECT *a) 427. { 428. > switch (a->type) 429. { 430. case X509_LU_X509: crypto/x509/x509_lu.c:430:2: Switch condition is false. Skipping switch case 428. switch (a->type) 429. { 430. case X509_LU_X509: ^ 431. X509_free(a->data.x509); 432. break; crypto/x509/x509_lu.c:433:2: Switch condition is false. Skipping switch case 431. X509_free(a->data.x509); 432. break; 433. case X509_LU_CRL: ^ 434. X509_CRL_free(a->data.crl); 435. break; crypto/x509/x509_lu.c:437:2: return from a call to X509_OBJECT_free_contents 435. break; 436. } 437. } ^ 438. 439. static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type, crypto/x509/x509_lu.c:669:2: 667. 668. /* Else find index of first cert accepted by 'check_issued' */ 669. > ret = 0; 670. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 671. idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); crypto/x509/x509_lu.c:670:2: 668. /* Else find index of first cert accepted by 'check_issued' */ 669. ret = 0; 670. > CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 671. idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); 672. if (idx != -1) /* should be true as we've had at least one match */ crypto/lock.c:426:1: start of procedure CRYPTO_lock() 424. } 425. 426. > void CRYPTO_lock(int mode, int type, const char *file, int line) 427. { 428. #ifdef LOCK_DEBUG crypto/lock.c:453:6: Taking false branch 451. } 452. #endif 453. if (type < 0) ^ 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:468:7: Taking true branch 466. } 467. else 468. if (locking_callback != NULL) ^ 469. locking_callback(mode,type,file,line); 470. } crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer 467. else 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); ^ 470. } 471. crypto/lock.c:453:2: 451. } 452. #endif 453. > if (type < 0) 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:470:2: return from a call to CRYPTO_lock 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); 470. } ^ 471. 472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/x509/x509_lu.c:671:2: 669. ret = 0; 670. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 671. > idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); 672. if (idx != -1) /* should be true as we've had at least one match */ 673. { crypto/x509/x509_lu.c:486:1: start of procedure X509_OBJECT_idx_by_subject() 484. 485. 486. > int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, 487. X509_NAME *name) 488. { crypto/x509/x509_lu.c:489:2: Skipping x509_object_idx_cnt(): empty list of specs 487. X509_NAME *name) 488. { 489. return x509_object_idx_cnt(h, type, name, NULL); ^ 490. } 491. crypto/x509/x509_lu.c:490:2: return from a call to X509_OBJECT_idx_by_subject 488. { 489. return x509_object_idx_cnt(h, type, name, NULL); 490. } ^ 491. 492. X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, crypto/x509/x509_lu.c:672:6: Taking true branch 670. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 671. idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); 672. if (idx != -1) /* should be true as we've had at least one match */ ^ 673. { 674. /* Look through all matching certs for suitable issuer */ crypto/x509/x509_lu.c:675:8: 673. { 674. /* Look through all matching certs for suitable issuer */ 675. > for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) 676. { 677. pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); crypto/x509/x509_lu.c:675:21: Condition is true 673. { 674. /* Look through all matching certs for suitable issuer */ 675. for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) ^ 676. { 677. pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); crypto/x509/x509_lu.c:675:17: 673. { 674. /* Look through all matching certs for suitable issuer */ 675. > for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) 676. { 677. pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); crypto/stack/stack.c:294:1: start of procedure sk_num() 292. } 293. 294. > int sk_num(const _STACK *st) 295. { 296. if(st == NULL) return -1; crypto/stack/stack.c:296:5: Taking false branch 294. int sk_num(const _STACK *st) 295. { 296. if(st == NULL) return -1; ^ 297. return st->num; 298. } crypto/stack/stack.c:297:2: 295. { 296. if(st == NULL) return -1; 297. > return st->num; 298. } 299. crypto/stack/stack.c:298:1: return from a call to sk_num 296. if(st == NULL) return -1; 297. return st->num; 298. > } 299. 300. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lu.c:675:17: Loop condition is true. Entering loop body 673. { 674. /* Look through all matching certs for suitable issuer */ 675. for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) ^ 676. { 677. pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); crypto/x509/x509_lu.c:677:11: Condition is true 675. for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) 676. { 677. pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); ^ 678. /* See if we've run past the matches */ 679. if (pobj->type != X509_LU_X509) crypto/x509/x509_lu.c:677:4: 675. for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) 676. { 677. > pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); 678. /* See if we've run past the matches */ 679. if (pobj->type != X509_LU_X509) 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 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_lu.c:679:8: 677. pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); 678. /* See if we've run past the matches */ 679. > if (pobj->type != X509_LU_X509) 680. break; 681. if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509)))
https://github.com/openssl/openssl/blob/ec4a50b3c3f2f50caccfd52e939857a5d6f02fd1/crypto/x509/x509_lu.c/#L679
d2a_code_trace_data_45162
void *lh_delete(_LHASH *lh, const 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); } apps/ocsp.c:1459: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned64 by call to `BIO_new_ssl`. Showing all 19 steps of the trace apps/ocsp.c:1452:9: Call 1450. { 1451. BIO *sbio; 1452. ctx = SSL_CTX_new(SSLv23_client_method()); ^ 1453. if (ctx == NULL) 1454. { ssl/ssl_lib.c:1953:16: Call 1951. ret->app_verify_cookie_cb=0; 1952. 1953. ret->sessions=lh_SSL_SESSION_new(); ^ 1954. if (ret->sessions == NULL) goto err; 1955. ret->cert_store=X509_STORE_new(); crypto/lhash/lhash.c:133:2: Assignment 131. ret->up_load=UP_LOAD; 132. ret->down_load=DOWN_LOAD; 133. ret->num_items=0; ^ 134. 135. ret->num_expands=0; apps/ocsp.c:1459:10: Call 1457. } 1458. SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); 1459. sbio = BIO_new_ssl(ctx, 1); ^ 1460. cbio = BIO_push(sbio, cbio); 1461. } ssl/bio_ssl.c:557:1: Parameter `ctx->sessions->num_items` 555. } 556. 557. > BIO *BIO_new_ssl(SSL_CTX *ctx, int client) 558. { 559. BIO *ret; ssl/bio_ssl.c:564:11: Call 562. if ((ret=BIO_new(BIO_f_ssl())) == NULL) 563. return(NULL); 564. if ((ssl=SSL_new(ctx)) == NULL) ^ 565. { 566. BIO_free(ret); ssl/ssl_lib.c:275:1: Parameter `ctx->sessions->num_items` 273. } 274. 275. > SSL *SSL_new(SSL_CTX *ctx) 276. { 277. SSL *s; ssl/ssl_lib.c:408:2: Call 406. s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1; 407. 408. SSL_clear(s); ^ 409. 410. CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data); ssl/ssl_lib.c:185:1: Parameter `s->ctx->sessions->num_items` 183. }; 184. 185. > int SSL_clear(SSL *s) 186. { 187. ssl/ssl_lib.c:194:6: Call 192. } 193. 194. if (ssl_clear_bad_session(s)) ^ 195. { 196. SSL_SESSION_free(s->session); ssl/ssl_sess.c:991:1: Parameter `s->ctx->sessions->num_items` 989. } 990. 991. > int ssl_clear_bad_session(SSL *s) 992. { 993. if ( (s->session != NULL) && ssl/ssl_sess.c:997:3: Call 995. !(SSL_in_init(s) || SSL_in_before(s))) 996. { 997. SSL_CTX_remove_session(s->ctx,s->session); ^ 998. return(1); 999. } ssl/ssl_sess.c:682:1: Parameter `ctx->sessions->num_items` 680. } 681. 682. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 683. { 684. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:684:9: Call 682. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 683. { 684. return remove_session_lock(ctx, c, 1); ^ 685. } 686. ssl/ssl_sess.c:687:1: Parameter `ctx->sessions->num_items` 685. } 686. 687. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 688. { 689. SSL_SESSION *r; ssl/ssl_sess.c:698:6: Call 696. { 697. ret=1; 698. r=lh_SSL_SESSION_delete(ctx->sessions,c); ^ 699. SSL_SESSION_list_remove(ctx,c); 700. } crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(_LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(_LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: (0 - 1):unsigned64 by call to `BIO_new_ssl` 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/789da2c73d875af59b14156b6295aa4bdfc4f424/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_45163
static enum CodecID find_codec_or_die(const char *name, enum AVMediaType 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) { av_log(NULL, AV_LOG_ERROR, "Unknown %s '%s'\n", codec_string, name); exit_program(1); } if(codec->type != type) { av_log(NULL, AV_LOG_ERROR, "Invalid %s type '%s'\n", codec_string, name); exit_program(1); } return codec->id; } avconv.c:2809: error: Null Dereference pointer `codec` last assigned on line 2802 could be null and is dereferenced at line 2809, column 8. avconv.c:2795:1: start of procedure find_codec_or_die() 2793. } 2794. 2795. static enum CodecID find_codec_or_die(const char *name, enum AVMediaType type, int encoder) ^ 2796. { 2797. const char *codec_string = encoder ? "encoder" : "decoder"; avconv.c:2797:32: Condition is true 2795. static enum CodecID find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2796. { 2797. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2798. AVCodec *codec; 2799. avconv.c:2797:5: 2795. static enum CodecID find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2796. { 2797. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2798. AVCodec *codec; 2799. avconv.c:2800:9: Taking false branch 2798. AVCodec *codec; 2799. 2800. if(!name) ^ 2801. return CODEC_ID_NONE; 2802. codec = encoder ? avconv.c:2802:13: Condition is true 2800. if(!name) 2801. return CODEC_ID_NONE; 2802. codec = encoder ? ^ 2803. avcodec_find_encoder_by_name(name) : 2804. avcodec_find_decoder_by_name(name); avconv.c:2802:5: 2800. if(!name) 2801. return CODEC_ID_NONE; 2802. codec = encoder ? ^ 2803. avcodec_find_encoder_by_name(name) : 2804. avcodec_find_decoder_by_name(name); avconv.c:2805:9: Taking true branch 2803. avcodec_find_encoder_by_name(name) : 2804. avcodec_find_decoder_by_name(name); 2805. if(!codec) { ^ 2806. av_log(NULL, AV_LOG_ERROR, "Unknown %s '%s'\n", codec_string, name); 2807. exit_program(1); avconv.c:2806:9: Skipping av_log(): empty list of specs 2804. avcodec_find_decoder_by_name(name); 2805. if(!codec) { 2806. av_log(NULL, AV_LOG_ERROR, "Unknown %s '%s'\n", codec_string, name); ^ 2807. exit_program(1); 2808. } avconv.c:2807:9: Skipping exit_program(): empty list of specs 2805. if(!codec) { 2806. av_log(NULL, AV_LOG_ERROR, "Unknown %s '%s'\n", codec_string, name); 2807. exit_program(1); ^ 2808. } 2809. if(codec->type != type) { avconv.c:2809:8: 2807. exit_program(1); 2808. } 2809. if(codec->type != type) { ^ 2810. av_log(NULL, AV_LOG_ERROR, "Invalid %s type '%s'\n", codec_string, name); 2811. exit_program(1);
https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/avconv.c/#L2809
d2a_code_trace_data_45164
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int n, int coded, int intra, int rvlc) { int level, i, last, run; int dc_pred_dir; RLTable * rl; RL_VLC_ELEM * rl_vlc; const uint8_t * scan_table; int qmul, qadd; if(intra) { if(s->use_intra_dc_vlc){ if(s->partitioned_frame){ level = s->dc_val[0][ s->block_index[n] ]; if(n<4) level= FASTDIV((level + (s->y_dc_scale>>1)), s->y_dc_scale); else level= FASTDIV((level + (s->c_dc_scale>>1)), s->c_dc_scale); dc_pred_dir= (s->pred_dir_table[s->mb_x + s->mb_y*s->mb_stride]<<n)&32; }else{ level = mpeg4_decode_dc(s, n, &dc_pred_dir); if (level < 0) return -1; } block[0] = level; i = 0; }else{ i = -1; ff_mpeg4_pred_dc(s, n, 0, &dc_pred_dir, 0); } if (!coded) goto not_coded; if(rvlc){ rl = &rvlc_rl_intra; rl_vlc = rvlc_rl_intra.rl_vlc[0]; }else{ rl = &rl_intra; rl_vlc = rl_intra.rl_vlc[0]; } if (s->ac_pred) { if (dc_pred_dir == 0) scan_table = s->intra_v_scantable.permutated; else scan_table = s->intra_h_scantable.permutated; } else { scan_table = s->intra_scantable.permutated; } qmul=1; qadd=0; } else { i = -1; if (!coded) { s->block_last_index[n] = i; return 0; } if(rvlc) rl = &rvlc_rl_inter; else rl = &rl_inter; scan_table = s->intra_scantable.permutated; if(s->mpeg_quant){ qmul=1; qadd=0; if(rvlc){ rl_vlc = rvlc_rl_inter.rl_vlc[0]; }else{ rl_vlc = rl_inter.rl_vlc[0]; } }else{ qmul = s->qscale << 1; qadd = (s->qscale - 1) | 1; if(rvlc){ rl_vlc = rvlc_rl_inter.rl_vlc[s->qscale]; }else{ rl_vlc = rl_inter.rl_vlc[s->qscale]; } } } { OPEN_READER(re, &s->gb); for(;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0); if (level==0) { if(rvlc){ if(SHOW_UBITS(re, &s->gb, 1)==0){ av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in rvlc esc\n"); return -1; }; SKIP_CACHE(re, &s->gb, 1); last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1); run= SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6); SKIP_COUNTER(re, &s->gb, 1+1+6); UPDATE_CACHE(re, &s->gb); if(SHOW_UBITS(re, &s->gb, 1)==0){ av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in rvlc esc\n"); return -1; }; SKIP_CACHE(re, &s->gb, 1); level= SHOW_UBITS(re, &s->gb, 11); SKIP_CACHE(re, &s->gb, 11); if(SHOW_UBITS(re, &s->gb, 5)!=0x10){ av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n"); return -1; }; SKIP_CACHE(re, &s->gb, 5); level= level * qmul + qadd; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_CACHE(re, &s->gb, 1); SKIP_COUNTER(re, &s->gb, 1+11+5+1); i+= run + 1; if(last) i+=192; }else{ int cache; cache= GET_CACHE(re, &s->gb); if(IS_3IV1) cache ^= 0xC0000000; if (cache&0x80000000) { if (cache&0x40000000) { SKIP_CACHE(re, &s->gb, 2); last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1); run= SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6); SKIP_COUNTER(re, &s->gb, 2+1+6); UPDATE_CACHE(re, &s->gb); if(IS_3IV1){ level= SHOW_SBITS(re, &s->gb, 12); LAST_SKIP_BITS(re, &s->gb, 12); }else{ if(SHOW_UBITS(re, &s->gb, 1)==0){ av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in 3. esc\n"); return -1; }; SKIP_CACHE(re, &s->gb, 1); level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12); if(SHOW_UBITS(re, &s->gb, 1)==0){ av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in 3. esc\n"); return -1; }; LAST_SKIP_CACHE(re, &s->gb, 1); SKIP_COUNTER(re, &s->gb, 1+12+1); } #if 0 if(s->error_resilience >= FF_ER_COMPLIANT){ const int abs_level= FFABS(level); if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ const int run1= run - rl->max_run[last][abs_level] - 1; if(abs_level <= rl->max_level[last][run]){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n"); return -1; } if(s->error_resilience > FF_ER_COMPLIANT){ if(abs_level <= rl->max_level[last][run]*2){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n"); return -1; } if(run1 >= 0 && abs_level <= rl->max_level[last][run1]){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n"); return -1; } } } } #endif if (level>0) level= level * qmul + qadd; else level= level * qmul - qadd; if((unsigned)(level + 2048) > 4095){ if(s->error_resilience > FF_ER_COMPLIANT){ if(level > 2560 || level<-2560){ av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale); return -1; } } level= level<0 ? -2048 : 2047; } i+= run + 1; if(last) i+=192; } else { #if MIN_CACHE_BITS < 20 LAST_SKIP_BITS(re, &s->gb, 2); UPDATE_CACHE(re, &s->gb); #else SKIP_BITS(re, &s->gb, 2); #endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run + rl->max_run[run>>7][level/qmul] +1; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } } else { #if MIN_CACHE_BITS < 19 LAST_SKIP_BITS(re, &s->gb, 1); UPDATE_CACHE(re, &s->gb); #else SKIP_BITS(re, &s->gb, 1); #endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run; level = level + rl->max_level[run>>7][(run-1)&63] * qmul; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } } } else { i+= run; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } if (i > 62){ i-= 192; if(i&(~63)){ av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } block[scan_table[i]] = level; break; } block[scan_table[i]] = level; } CLOSE_READER(re, &s->gb); } not_coded: if (intra) { if(!s->use_intra_dc_vlc){ block[0] = ff_mpeg4_pred_dc(s, n, block[0], &dc_pred_dir, 0); i -= i>>31; } mpeg4_pred_ac(s, block, n, dc_pred_dir); if (s->ac_pred) { i = 63; } } s->block_last_index[n] = i; return 0; } libavcodec/h263.c:4969: error: Uninitialized Value The value read from dc_pred_dir was never initialized. libavcodec/h263.c:4969:9: 4967. } 4968. 4969. mpeg4_pred_ac(s, block, n, dc_pred_dir); ^ 4970. if (s->ac_pred) { 4971. i = 63; /* XXX: not optimal */
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h263.c/#L4969
d2a_code_trace_data_45165
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { H264Context *h = s->priv_data; const uint8_t *buf_end = buf + buf_size; unsigned int pps_id; unsigned int slice_type; int state = -1; const uint8_t *ptr; int field_poc[2]; s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; h->sei_recovery_frame_cnt = -1; h->sei_dpb_output_delay = 0; h->sei_cpb_removal_delay = -1; h->sei_buffering_period_present = 0; if (!buf_size) return 0; for (;;) { int src_length, dst_length, consumed; buf = avpriv_find_start_code(buf, buf_end, &state); if (buf >= buf_end) break; --buf; src_length = buf_end - buf; switch (state & 0x1f) { case NAL_SLICE: case NAL_IDR_SLICE: if (src_length > 20) src_length = 20; break; } ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); if (ptr == NULL || dst_length < 0) break; init_get_bits(&h->gb, ptr, 8 * dst_length); switch (h->nal_unit_type) { case NAL_SPS: ff_h264_decode_seq_parameter_set(h); break; case NAL_PPS: ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits); break; case NAL_SEI: ff_h264_decode_sei(h); break; case NAL_IDR_SLICE: s->key_frame = 1; h->prev_frame_num = 0; h->prev_frame_num_offset = 0; h->prev_poc_msb = h->prev_poc_lsb = 0; case NAL_SLICE: get_ue_golomb(&h->gb); slice_type = get_ue_golomb_31(&h->gb); s->pict_type = golomb_to_pict_type[slice_type % 5]; if (h->sei_recovery_frame_cnt >= 0) { s->key_frame = 1; } pps_id = get_ue_golomb(&h->gb); if (pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id out of range\n"); return -1; } if (!h->pps_buffers[pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS referenced\n"); return -1; } h->pps = *h->pps_buffers[pps_id]; if (!h->sps_buffers[h->pps.sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS referenced\n"); return -1; } h->sps = *h->sps_buffers[h->pps.sps_id]; h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num); avctx->profile = ff_h264_get_profile(&h->sps); avctx->level = h->sps.level_idc; if (h->sps.frame_mbs_only_flag) { h->picture_structure = PICT_FRAME; } else { if (get_bits1(&h->gb)) { h->picture_structure = PICT_TOP_FIELD + get_bits1(&h->gb); } else { h->picture_structure = PICT_FRAME; } } if (h->nal_unit_type == NAL_IDR_SLICE) get_ue_golomb(&h->gb); if (h->sps.poc_type == 0) { h->poc_lsb = get_bits(&h->gb, h->sps.log2_max_poc_lsb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc_bottom = get_se_golomb(&h->gb); } if (h->sps.poc_type == 1 && !h->sps.delta_pic_order_always_zero_flag) { h->delta_poc[0] = get_se_golomb(&h->gb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc[1] = get_se_golomb(&h->gb); } ff_init_poc(h, field_poc, &s->output_picture_number); if (h->sps.pic_struct_present_flag) { switch (h->sei_pic_struct) { case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: s->repeat_pict = 0; break; case SEI_PIC_STRUCT_FRAME: case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_BOTTOM_TOP: s->repeat_pict = 1; break; case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->repeat_pict = 2; break; case SEI_PIC_STRUCT_FRAME_DOUBLING: s->repeat_pict = 3; break; case SEI_PIC_STRUCT_FRAME_TRIPLING: s->repeat_pict = 5; break; default: s->repeat_pict = h->picture_structure == PICT_FRAME ? 1 : 0; break; } } else { s->repeat_pict = h->picture_structure == PICT_FRAME ? 1 : 0; } if (h->picture_structure == PICT_FRAME) { s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; if (h->sps.pic_struct_present_flag) { switch (h->sei_pic_struct) { case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: s->field_order = AV_FIELD_TT; break; case SEI_PIC_STRUCT_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->field_order = AV_FIELD_BB; break; default: s->field_order = AV_FIELD_PROGRESSIVE; break; } } else { if (field_poc[0] < field_poc[1]) s->field_order = AV_FIELD_TT; else if (field_poc[0] > field_poc[1]) s->field_order = AV_FIELD_BB; else s->field_order = AV_FIELD_PROGRESSIVE; } } else { if (h->picture_structure == PICT_TOP_FIELD) s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD; else s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; s->field_order = AV_FIELD_UNKNOWN; } return 0; } buf += consumed; } av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; } libavcodec/h264_parser.c:146: error: Null Dereference pointer `h->gb.buffer` last assigned on line 143 could be null and is dereferenced by call to `ff_h264_decode_seq_parameter_set()` at line 146, column 13. libavcodec/h264_parser.c:98:1: start of procedure parse_nal_units() 96. * @param buf_size size of the buffer. 97. */ 98. static inline int parse_nal_units(AVCodecParserContext *s, ^ 99. AVCodecContext *avctx, 100. const uint8_t *buf, int buf_size) libavcodec/h264_parser.c:102:5: 100. const uint8_t *buf, int buf_size) 101. { 102. H264Context *h = s->priv_data; ^ 103. const uint8_t *buf_end = buf + buf_size; 104. unsigned int pps_id; libavcodec/h264_parser.c:103:5: 101. { 102. H264Context *h = s->priv_data; 103. const uint8_t *buf_end = buf + buf_size; ^ 104. unsigned int pps_id; 105. unsigned int slice_type; libavcodec/h264_parser.c:106:5: 104. unsigned int pps_id; 105. unsigned int slice_type; 106. int state = -1; ^ 107. const uint8_t *ptr; 108. int field_poc[2]; libavcodec/h264_parser.c:111:5: 109. 110. /* set some sane default values */ 111. s->pict_type = AV_PICTURE_TYPE_I; ^ 112. s->key_frame = 0; 113. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; libavcodec/h264_parser.c:112:5: 110. /* set some sane default values */ 111. s->pict_type = AV_PICTURE_TYPE_I; 112. s->key_frame = 0; ^ 113. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; 114. libavcodec/h264_parser.c:113:5: 111. s->pict_type = AV_PICTURE_TYPE_I; 112. s->key_frame = 0; 113. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; ^ 114. 115. h->avctx = avctx; libavcodec/h264_parser.c:115:5: 113. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; 114. 115. h->avctx = avctx; ^ 116. h->sei_recovery_frame_cnt = -1; 117. h->sei_dpb_output_delay = 0; libavcodec/h264_parser.c:116:5: 114. 115. h->avctx = avctx; 116. h->sei_recovery_frame_cnt = -1; ^ 117. h->sei_dpb_output_delay = 0; 118. h->sei_cpb_removal_delay = -1; libavcodec/h264_parser.c:117:5: 115. h->avctx = avctx; 116. h->sei_recovery_frame_cnt = -1; 117. h->sei_dpb_output_delay = 0; ^ 118. h->sei_cpb_removal_delay = -1; 119. h->sei_buffering_period_present = 0; libavcodec/h264_parser.c:118:5: 116. h->sei_recovery_frame_cnt = -1; 117. h->sei_dpb_output_delay = 0; 118. h->sei_cpb_removal_delay = -1; ^ 119. h->sei_buffering_period_present = 0; 120. libavcodec/h264_parser.c:119:5: 117. h->sei_dpb_output_delay = 0; 118. h->sei_cpb_removal_delay = -1; 119. h->sei_buffering_period_present = 0; ^ 120. 121. if (!buf_size) libavcodec/h264_parser.c:121:10: Taking false branch 119. h->sei_buffering_period_present = 0; 120. 121. if (!buf_size) ^ 122. return 0; 123. libavcodec/h264_parser.c:288:5: Loop condition is true. Entering loop body 286. } 287. buf += consumed; 288. } ^ 289. /* didn't find a picture! */ 290. av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); libavcodec/h264_parser.c:126:9: Skipping avpriv_find_start_code(): empty list of specs 124. for (;;) { 125. int src_length, dst_length, consumed; 126. buf = avpriv_find_start_code(buf, buf_end, &state); ^ 127. if (buf >= buf_end) 128. break; libavcodec/h264_parser.c:127:13: Taking false branch 125. int src_length, dst_length, consumed; 126. buf = avpriv_find_start_code(buf, buf_end, &state); 127. if (buf >= buf_end) ^ 128. break; 129. --buf; libavcodec/h264_parser.c:129:9: 127. if (buf >= buf_end) 128. break; 129. --buf; ^ 130. src_length = buf_end - buf; 131. switch (state & 0x1f) { libavcodec/h264_parser.c:130:9: 128. break; 129. --buf; 130. src_length = buf_end - buf; ^ 131. switch (state & 0x1f) { 132. case NAL_SLICE: libavcodec/h264_parser.c:131:9: 129. --buf; 130. src_length = buf_end - buf; 131. switch (state & 0x1f) { ^ 132. case NAL_SLICE: 133. case NAL_IDR_SLICE: libavcodec/h264_parser.c:132:9: Switch condition is true. Entering switch case 130. src_length = buf_end - buf; 131. switch (state & 0x1f) { 132. case NAL_SLICE: ^ 133. case NAL_IDR_SLICE: 134. // Do not walk the whole buffer just to decode slice header libavcodec/h264_parser.c:135:17: Taking false branch 133. case NAL_IDR_SLICE: 134. // Do not walk the whole buffer just to decode slice header 135. if (src_length > 20) ^ 136. src_length = 20; 137. break; libavcodec/h264_parser.c:139:9: Skipping ff_h264_decode_nal(): empty list of specs 137. break; 138. } 139. ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); ^ 140. if (ptr == NULL || dst_length < 0) 141. break; libavcodec/h264_parser.c:140:13: Taking false branch 138. } 139. ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); 140. if (ptr == NULL || dst_length < 0) ^ 141. break; 142. libavcodec/h264_parser.c:140:28: Taking false branch 138. } 139. ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); 140. if (ptr == NULL || dst_length < 0) ^ 141. break; 142. libavcodec/h264_parser.c:143:9: 141. break; 142. 143. init_get_bits(&h->gb, ptr, 8 * dst_length); ^ 144. switch (h->nal_unit_type) { 145. case NAL_SPS: 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/h264_parser.c:144:9: 142. 143. init_get_bits(&h->gb, ptr, 8 * dst_length); 144. switch (h->nal_unit_type) { ^ 145. case NAL_SPS: 146. ff_h264_decode_seq_parameter_set(h); libavcodec/h264_parser.c:145:9: Switch condition is true. Entering switch case 143. init_get_bits(&h->gb, ptr, 8 * dst_length); 144. switch (h->nal_unit_type) { 145. case NAL_SPS: ^ 146. ff_h264_decode_seq_parameter_set(h); 147. break; libavcodec/h264_parser.c:146:13: 144. switch (h->nal_unit_type) { 145. case NAL_SPS: 146. ff_h264_decode_seq_parameter_set(h); ^ 147. break; 148. case NAL_PPS: libavcodec/h264_ps.c:295:1: start of procedure ff_h264_decode_seq_parameter_set() 293. } 294. 295. int ff_h264_decode_seq_parameter_set(H264Context *h) ^ 296. { 297. int profile_idc, level_idc, constraint_set_flags = 0; libavcodec/h264_ps.c:297:5: 295. int ff_h264_decode_seq_parameter_set(H264Context *h) 296. { 297. int profile_idc, level_idc, constraint_set_flags = 0; ^ 298. unsigned int sps_id; 299. int i, log2_max_frame_num_minus4; libavcodec/h264_ps.c:302:5: Skipping get_bits(): empty list of specs 300. SPS *sps; 301. 302. profile_idc = get_bits(&h->gb, 8); ^ 303. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag 304. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag libavcodec/h264_ps.c:303:5: 301. 302. profile_idc = get_bits(&h->gb, 8); 303. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag ^ 304. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag 305. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag 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; libavcodec/get_bits.h:276:5: 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7; ^ 277. result &= 1; 278. #else libavcodec/get_bits.h:277:5: 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7; 277. result &= 1; ^ 278. #else 279. result <<= index & 7; libavcodec/get_bits.h:283:9: Taking true branch 281. #endif 282. #if !UNCHECKED_BITSTREAM_READER 283. if (s->index < s->size_in_bits_plus8) ^ 284. #endif 285. index++; libavcodec/get_bits.h:285:9: 283. if (s->index < s->size_in_bits_plus8) 284. #endif 285. index++; ^ 286. s->index = index; 287. libavcodec/get_bits.h:286:5: 284. #endif 285. index++; 286. s->index = index; ^ 287. 288. return result; libavcodec/get_bits.h:288:5: 286. s->index = index; 287. 288. return result; ^ 289. } 290. libavcodec/get_bits.h:289:1: return from a call to get_bits1 287. 288. return result; 289. } ^ 290. 291. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:304:5: 302. profile_idc = get_bits(&h->gb, 8); 303. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag 304. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag ^ 305. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag 306. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag 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; libavcodec/get_bits.h:276:5: 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7; ^ 277. result &= 1; 278. #else libavcodec/get_bits.h:277:5: 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7; 277. result &= 1; ^ 278. #else 279. result <<= index & 7; libavcodec/get_bits.h:283:9: Taking true branch 281. #endif 282. #if !UNCHECKED_BITSTREAM_READER 283. if (s->index < s->size_in_bits_plus8) ^ 284. #endif 285. index++; libavcodec/get_bits.h:285:9: 283. if (s->index < s->size_in_bits_plus8) 284. #endif 285. index++; ^ 286. s->index = index; 287. libavcodec/get_bits.h:286:5: 284. #endif 285. index++; 286. s->index = index; ^ 287. 288. return result; libavcodec/get_bits.h:288:5: 286. s->index = index; 287. 288. return result; ^ 289. } 290. libavcodec/get_bits.h:289:1: return from a call to get_bits1 287. 288. return result; 289. } ^ 290. 291. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:305:5: 303. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag 304. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag 305. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag ^ 306. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag 307. get_bits(&h->gb, 4); // reserved 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; libavcodec/get_bits.h:276:5: 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7; ^ 277. result &= 1; 278. #else libavcodec/get_bits.h:277:5: 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7; 277. result &= 1; ^ 278. #else 279. result <<= index & 7; libavcodec/get_bits.h:283:9: Taking true branch 281. #endif 282. #if !UNCHECKED_BITSTREAM_READER 283. if (s->index < s->size_in_bits_plus8) ^ 284. #endif 285. index++; libavcodec/get_bits.h:285:9: 283. if (s->index < s->size_in_bits_plus8) 284. #endif 285. index++; ^ 286. s->index = index; 287. libavcodec/get_bits.h:286:5: 284. #endif 285. index++; 286. s->index = index; ^ 287. 288. return result; libavcodec/get_bits.h:288:5: 286. s->index = index; 287. 288. return result; ^ 289. } 290. libavcodec/get_bits.h:289:1: return from a call to get_bits1 287. 288. return result; 289. } ^ 290. 291. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:306:5: 304. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag 305. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag 306. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag ^ 307. get_bits(&h->gb, 4); // reserved 308. level_idc = get_bits(&h->gb, 8); 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/b89e8759e053792704741d08cbc41c9ac3c7ed63/libavcodec/h264_parser.c/#L146
d2a_code_trace_data_45166
PUT_HEVC_QPEL_HV(1, 1) libavcodec/hevcdsp_template.c:983: error: Buffer Overrun L3 Offset: [-64, +oo] (⇐ [0, +oo] + [-64, -61]) Size: 4544 by call to `put_hevc_qpel_h1v1_9`. libavcodec/hevcdsp_template.c:983:1: Call 981. QPEL(12) 982. QPEL(8) 983. QPEL(4) ^ 984. 985. static inline void FUNC(put_hevc_epel_pixels)(int16_t *dst, ptrdiff_t dststride, libavcodec/hevcdsp_template.c:901:1: <Offset trace> 899. PUT_HEVC_QPEL_V(2) 900. PUT_HEVC_QPEL_V(3) 901. PUT_HEVC_QPEL_HV(1, 1) ^ 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) libavcodec/hevcdsp_template.c:901:1: Assignment 899. PUT_HEVC_QPEL_V(2) 900. PUT_HEVC_QPEL_V(3) 901. PUT_HEVC_QPEL_HV(1, 1) ^ 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) libavcodec/hevcdsp_template.c:901:1: <Length trace> 899. PUT_HEVC_QPEL_V(2) 900. PUT_HEVC_QPEL_V(3) 901. PUT_HEVC_QPEL_HV(1, 1) ^ 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) libavcodec/hevcdsp_template.c:901:1: Array declaration 899. PUT_HEVC_QPEL_V(2) 900. PUT_HEVC_QPEL_V(3) 901. PUT_HEVC_QPEL_HV(1, 1) ^ 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) libavcodec/hevcdsp_template.c:901:1: Assignment 899. PUT_HEVC_QPEL_V(2) 900. PUT_HEVC_QPEL_V(3) 901. PUT_HEVC_QPEL_HV(1, 1) ^ 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) libavcodec/hevcdsp_template.c:901:1: Array access: Offset: [-64, +oo] (⇐ [0, +oo] + [-64, -61]) Size: 4544 by call to `put_hevc_qpel_h1v1_9` 899. PUT_HEVC_QPEL_V(2) 900. PUT_HEVC_QPEL_V(3) 901. PUT_HEVC_QPEL_HV(1, 1) ^ 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3)
https://github.com/libav/libav/blob/688417399c69aadd4c287bdb0dec82ef8799011c/libavcodec/hevcdsp_template.c/#L901
d2a_code_trace_data_45167
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:1330: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 28 steps of the trace crypto/bn/bn_exp.c:1280:1: Parameter `ctx->stack.depth` 1278. 1279. /* The old fallback, simple version :-) */ 1280. > int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1281. const BIGNUM *m, BN_CTX *ctx) 1282. { crypto/bn/bn_exp.c:1309:5: Call 1307. } 1308. 1309. BN_CTX_start(ctx); ^ 1310. d = BN_CTX_get(ctx); 1311. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:1315:10: Call 1313. goto err; 1314. 1315. if (!BN_nnmod(val[0], a, m, ctx)) ^ 1316. goto err; /* 1 */ 1317. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:137:1: Parameter `ctx->stack.depth` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/bn/bn_exp.c:1325:14: Call 1323. window = BN_window_bits_for_exponent_size(bits); 1324. if (window > 1) { 1325. if (!BN_mod_mul(d, val[0], val[0], m, ctx)) ^ 1326. goto err; /* 2 */ 1327. j = 1 << (window - 1); crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. /* slow but works */ 127. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 128. BN_CTX *ctx) 129. { crypto/bn/bn_mod.c:137:5: Call 135. bn_check_top(m); 136. 137. BN_CTX_start(ctx); ^ 138. if ((t = BN_CTX_get(ctx)) == NULL) 139. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:152:5: Call 150. ret = 1; 151. err: 152. BN_CTX_end(ctx); ^ 153. return ret; 154. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_exp.c:1330:18: Call 1328. for (i = 1; i < j; i++) { 1329. if (((val[i] = BN_CTX_get(ctx)) == NULL) || 1330. !BN_mod_mul(val[i], val[i - 1], d, m, ctx)) ^ 1331. goto err; 1332. } crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. /* slow but works */ 127. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 128. BN_CTX *ctx) 129. { crypto/bn/bn_mod.c:137:5: Call 135. bn_check_top(m); 136. 137. BN_CTX_start(ctx); ^ 138. if ((t = BN_CTX_get(ctx)) == NULL) 139. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:141:14: Call 139. goto err; 140. if (a == b) { 141. if (!BN_sqr(t, a, ctx)) ^ 142. goto err; 143. } else { crypto/bn/bn_sqr.c:32:5: Call 30. } 31. 32. BN_CTX_start(ctx); ^ 33. rr = (a != r) ? r : BN_CTX_get(ctx); 34. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqr.c:94:5: Call 92. bn_check_top(rr); 93. bn_check_top(tmp); 94. BN_CTX_end(ctx); ^ 95. return ret; 96. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:274:1: <Offset trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: <Length trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `*st->indexes` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_45168
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) { BN_ULONG *rr; if (na < nb) { int itmp; BN_ULONG *ltmp; itmp = na; na = nb; nb = itmp; ltmp = a; a = b; b = ltmp; } rr = &(r[na]); if (nb <= 0) { (void)bn_mul_words(r, a, na, 0); return; } else rr[0] = bn_mul_words(r, a, na, b[0]); for (;;) { if (--nb <= 0) return; rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); if (--nb <= 0) return; rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); if (--nb <= 0) return; rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); if (--nb <= 0) return; rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); rr += 4; r += 4; b += 4; } } crypto/rsa/rsa_chk.c:66: error: BUFFER_OVERRUN_L3 Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mul`. Showing all 19 steps of the trace crypto/rsa/rsa_chk.c:60:9: Call 58. 59. /* q prime? */ 60. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 61. ret = 0; 62. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:197:12: Call 195. BN_GENCB *cb) 196. { 197. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 198. } 199. crypto/bn/bn_prime.c:285:13: Call 283. /* now 1 <= check < A */ 284. 285. j = witness(check, A, A1, A1_odd, k, ctx, mont); ^ 286. if (j == -1) 287. goto err; crypto/bn/bn_prime.c:388:10: Call 386. BN_MONT_CTX *mont) 387. { 388. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 389. return -1; 390. if (BN_is_one(w)) crypto/bn/bn_exp.c:356:14: Call 354. 355. if (a->neg || BN_ucmp(a, m) >= 0) { 356. if (!BN_nnmod(val[0], a, m, ctx)) ^ 357. goto err; 358. aa = val[0]; crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:140:1: Parameter `*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. { crypto/rsa/rsa_chk.c:66:10: Call 64. 65. /* n = p*q? */ 66. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 67. ret = -1; 68. goto err; crypto/bn/bn_mul.c:829:1: Parameter `*r->d` 827. #endif /* BN_RECURSION */ 828. 829. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 830. { 831. int ret = 0; crypto/bn/bn_mul.c:908:21: Call 906. if (bn_wexpand(t, k * 4) == NULL) 907. goto err; 908. if (bn_wexpand(rr, k * 4) == NULL) ^ 909. goto err; 910. bn_mul_part_recursive(rr->d, a->d, b->d, 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_mul.c:910:17: Call 908. if (bn_wexpand(rr, k * 4) == NULL) 909. goto err; 910. bn_mul_part_recursive(rr->d, a->d, b->d, ^ 911. j, al - j, bl - j, t->d); 912. } else { /* al <= j || bl <= j */ crypto/bn/bn_mul.c:480:1: Parameter `*t` 478. */ 479. /* tnX may not be negative but less than n */ 480. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, 481. int tna, int tnb, BN_ULONG *t) 482. { crypto/bn/bn_mul.c:543:9: Call 541. } else { 542. p = &(t[n2 * 2]); 543. bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); ^ 544. bn_mul_recursive(r, a, b, n, 0, 0, p); 545. i = n / 2; crypto/bn/bn_mul.c:333:1: Parameter `*a` 331. */ 332. /* dnX may not be positive, but n2/2+dnX has to be */ 333. > void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, 334. int dna, int dnb, BN_ULONG *t) 335. { crypto/bn/bn_mul.c:359:9: Call 357. /* Else do normal multiply */ 358. if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) { 359. bn_mul_normal(r, a, n2 + dna, b, n2 + dnb); ^ 360. if ((dna + dnb) < 0) 361. memset(&r[2 * n2 + dna + dnb], 0, crypto/bn/bn_mul.c:983:1: <Length trace> 981. } 982. 983. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) 984. { 985. BN_ULONG *rr; crypto/bn/bn_mul.c:983:1: Parameter `*b` 981. } 982. 983. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) 984. { 985. BN_ULONG *rr; crypto/bn/bn_mul.c:1018:50: Array access: Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mul` 1016. if (--nb <= 0) 1017. return; 1018. rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); ^ 1019. rr += 4; 1020. r += 4;
https://github.com/openssl/openssl/blob/2f3930bc0edbfdc7718f709b856fa53f0ec57cde/crypto/bn/bn_mul.c/#L1018
d2a_code_trace_data_45169
void *lh_delete(_LHASH *lh, const 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); } apps/s_client.c:1313: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned64 by call to `SSL_new`. Showing all 27 steps of the trace apps/s_client.c:1280:7: Call 1278. ssl_ctx_add_crls(ctx, crls); 1279. 1280. if (!set_cert_key_stuff(ctx,cert,key, NULL, build_chain)) ^ 1281. goto end; 1282. apps/s_cb.c:263:6: Call 261. if (cert == NULL) 262. return 1; 263. if (SSL_CTX_use_certificate(ctx,cert) <= 0) ^ 264. { 265. BIO_printf(bio_err,"error setting certificate\n"); ssl/ssl_rsa.c:410:9: Call 408. return(0); 409. } 410. return(ssl_set_cert(ctx->cert, x)); ^ 411. } 412. ssl/ssl_rsa.c:418:7: Call 416. int i; 417. 418. pkey=X509_get_pubkey(x); ^ 419. if (pkey == NULL) 420. { crypto/x509/x509_cmp.c:304:9: Call 302. if ((x == NULL) || (x->cert_info == NULL)) 303. return(NULL); 304. return(X509_PUBKEY_get(x->cert_info->key)); ^ 305. } 306. crypto/asn1/x_pubkey.c:153:7: Call 151. } 152. 153. if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm))) ^ 154. { 155. X509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM); crypto/evp/p_lib.c:255:9: Call 253. int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) 254. { 255. return pkey_set_type(pkey, type, NULL, -1); ^ 256. } 257. crypto/evp/p_lib.c:232:11: Call 230. ameth = EVP_PKEY_asn1_find_str(&e, str, len); 231. else 232. ameth = EVP_PKEY_asn1_find(&e, type); ^ 233. #ifndef OPENSSL_NO_ENGINE 234. if (!pkey && e) crypto/asn1/ameth_lib.c:194:7: Call 192. ENGINE *e; 193. /* type will contain the final unaliased type */ 194. e = ENGINE_get_pkey_asn1_meth_engine(type); ^ 195. if (e) 196. { crypto/engine/tb_asnmth.c:118:9: Call 116. ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid) 117. { 118. return engine_table_select(&pkey_asn1_meth_table, nid); ^ 119. } 120. crypto/engine/eng_table.c:261:6: Call 259. /* Check again inside the lock otherwise we could race against cleanup 260. * operations. But don't worry about a fprintf(stderr). */ 261. if(!int_table_check(table, 0)) goto end; ^ 262. tmplate.nid = nid; 263. fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); crypto/engine/eng_table.c:122:11: Call 120. if(*t) return 1; 121. if(!create) return 0; 122. if((lh = lh_ENGINE_PILE_new()) == NULL) ^ 123. return 0; 124. *t = (ENGINE_TABLE *)lh; crypto/lhash/lhash.c:133:2: Assignment 131. ret->up_load=UP_LOAD; 132. ret->down_load=DOWN_LOAD; 133. ret->num_items=0; ^ 134. 135. ret->num_expands=0; apps/s_client.c:1313:6: Call 1311. #endif 1312. 1313. con=SSL_new(ctx); ^ 1314. if (sess_in) 1315. { ssl/ssl_lib.c:275:1: Parameter `ctx->sessions->num_items` 273. } 274. 275. > SSL *SSL_new(SSL_CTX *ctx) 276. { 277. SSL *s; ssl/ssl_lib.c:397:2: Call 395. s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1; 396. 397. SSL_clear(s); ^ 398. 399. CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data); ssl/ssl_lib.c:185:1: Parameter `s->ctx->sessions->num_items` 183. }; 184. 185. > int SSL_clear(SSL *s) 186. { 187. ssl/ssl_lib.c:194:6: Call 192. } 193. 194. if (ssl_clear_bad_session(s)) ^ 195. { 196. SSL_SESSION_free(s->session); ssl/ssl_sess.c:988:1: Parameter `s->ctx->sessions->num_items` 986. } 987. 988. > int ssl_clear_bad_session(SSL *s) 989. { 990. if ( (s->session != NULL) && ssl/ssl_sess.c:994:3: Call 992. !(SSL_in_init(s) || SSL_in_before(s))) 993. { 994. SSL_CTX_remove_session(s->ctx,s->session); ^ 995. return(1); 996. } ssl/ssl_sess.c:672:1: Parameter `ctx->sessions->num_items` 670. } 671. 672. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 673. { 674. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:674:9: Call 672. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 673. { 674. return remove_session_lock(ctx, c, 1); ^ 675. } 676. ssl/ssl_sess.c:677:1: Parameter `ctx->sessions->num_items` 675. } 676. 677. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 678. { 679. SSL_SESSION *r; ssl/ssl_sess.c:688:6: Call 686. { 687. ret=1; 688. r=lh_SSL_SESSION_delete(ctx->sessions,c); ^ 689. SSL_SESSION_list_remove(ctx,c); 690. } crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(_LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(_LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: (0 - 1):unsigned64 by call to `SSL_new` 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/0db46a7dd79cac420c08d68fc782d561e7927af1/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_45170
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:921: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:921:13: 919. 920. //check(x + dir,y + dia_size - dir,0, a0) 921. CHECK_MV(x + dir , y + dia_size - dir); ^ 922. } 923.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L921
d2a_code_trace_data_45171
static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) { VideoDemuxData *s = s1->priv_data; char filename[1024]; int i, res; int size[3] = { 0 }, ret[3] = { 0 }; AVIOContext *f[3] = { NULL }; AVCodecContext *codec = s1->streams[0]->codec; if (!s->is_pipe) { if (s->loop && s->img_number > s->img_last) { s->img_number = s->img_first; } if (s->img_number > s->img_last) return AVERROR_EOF; if (av_get_frame_filename(filename, sizeof(filename), s->path, s->img_number) < 0 && s->img_number > 1) return AVERROR(EIO); for (i = 0; i < 3; i++) { if (s1->io_open(s1, &f[i], filename, AVIO_FLAG_READ, NULL) < 0) { if (i >= 1) break; av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n", filename); return AVERROR(EIO); } size[i] = avio_size(f[i]); if (codec->codec_id != AV_CODEC_ID_RAWVIDEO) break; filename[strlen(filename) - 1] = 'U' + i; } if (codec->codec_id == AV_CODEC_ID_RAWVIDEO && !codec->width) infer_size(&codec->width, &codec->height, size[0]); } else { f[0] = s1->pb; if (f[0]->eof_reached) return AVERROR(EIO); size[0] = 4096; } res = av_new_packet(pkt, size[0] + size[1] + size[2]); if (res < 0) return res; pkt->stream_index = 0; pkt->flags |= AV_PKT_FLAG_KEY; pkt->size = 0; for (i = 0; i < 3; i++) { if (f[i]) { ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]); if (!s->is_pipe) ff_format_io_close(s1, &f[i]); if (ret[i] > 0) pkt->size += ret[i]; } } if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) { av_packet_unref(pkt); return AVERROR(EIO); } else { s->img_count++; s->img_number++; return 0; } } libavformat/img2dec.c:252: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64. libavformat/img2dec.c:220:1: <LHS trace> 218. } 219. 220. static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) ^ 221. { 222. VideoDemuxData *s = s1->priv_data; libavformat/img2dec.c:220:1: Array declaration 218. } 219. 220. static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) ^ 221. { 222. VideoDemuxData *s = s1->priv_data; libavformat/img2dec.c:252:13: Binary operation: ([0, +oo] - 1):unsigned64 250. if (codec->codec_id != AV_CODEC_ID_RAWVIDEO) 251. break; 252. filename[strlen(filename) - 1] = 'U' + i; ^ 253. } 254.
https://github.com/libav/libav/blob/611ba89b896a5286b6d8ad9bfdbb8b4f5c11df9c/libavformat/img2dec.c/#L252
d2a_code_trace_data_45172
static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->capabilities & CODEC_CAP_EXPERIMENTAL && strict > FF_COMPLIANCE_EXPERIMENTAL) { fprintf(stderr, "%s '%s' is experimental and might produce bad " "results.\nAdd '-strict experimental' if you want to use it.\n", codec_string, codec->name); codec = encoder ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) fprintf(stderr, "Or use the non experimental %s '%s'.\n", codec_string, codec->name); ffmpeg_exit(1); } return codec->id; } ffmpeg.c:3094: error: Null Dereference pointer `codec` last assigned on line 3087 could be null and is dereferenced at line 3094, column 8. ffmpeg.c:3080:1: start of procedure find_codec_or_die() 3078. } 3079. 3080. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) ^ 3081. { 3082. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:3082:32: Condition is true 3080. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3081. { 3082. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3083. AVCodec *codec; 3084. ffmpeg.c:3082:5: 3080. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3081. { 3082. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3083. AVCodec *codec; 3084. ffmpeg.c:3085:9: Taking false branch 3083. AVCodec *codec; 3084. 3085. if(!name) ^ 3086. return CODEC_ID_NONE; 3087. codec = encoder ? ffmpeg.c:3087:13: Condition is true 3085. if(!name) 3086. return CODEC_ID_NONE; 3087. codec = encoder ? ^ 3088. avcodec_find_encoder_by_name(name) : 3089. avcodec_find_decoder_by_name(name); ffmpeg.c:3087:5: 3085. if(!name) 3086. return CODEC_ID_NONE; 3087. codec = encoder ? ^ 3088. avcodec_find_encoder_by_name(name) : 3089. avcodec_find_decoder_by_name(name); ffmpeg.c:3090:9: Taking true branch 3088. avcodec_find_encoder_by_name(name) : 3089. avcodec_find_decoder_by_name(name); 3090. if(!codec) { ^ 3091. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3092. ffmpeg_exit(1); ffmpeg.c:3091:9: 3089. avcodec_find_decoder_by_name(name); 3090. if(!codec) { 3091. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 3092. ffmpeg_exit(1); 3093. } ffmpeg.c:3092:9: Skipping ffmpeg_exit(): empty list of specs 3090. if(!codec) { 3091. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3092. ffmpeg_exit(1); ^ 3093. } 3094. if(codec->type != type) { ffmpeg.c:3094:8: 3092. ffmpeg_exit(1); 3093. } 3094. if(codec->type != type) { ^ 3095. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 3096. ffmpeg_exit(1);
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/ffmpeg.c/#L3094
d2a_code_trace_data_45173
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); } libavfilter/vf_select.c:266: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/vf_select.c:266:5: Call 264. avfilter_end_frame(inlink->dst->outputs[0]); 265. } 266. avfilter_unref_buffer(picref); ^ 267. } 268. 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/753890d0dbb641af156706594dfb2dec39644f4a/libavfilter/avfilter.c/#L76
d2a_code_trace_data_45174
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:891: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:891:9: 889. CHECK_MV(best[0]+1, best[1]) 890. CHECK_MV(best[0], best[1]-1) 891. CHECK_MV(best[0], best[1]+1) ^ 892. } 893. return dmin;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L891
d2a_code_trace_data_45175
ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args) { ngx_http_core_srv_conf_t *cscf; r->uri_changes--; if (r->uri_changes == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "rewrite or internal redirection cycle " "while internal redirect to \"%V\"", uri); r->main->count++; ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_DONE; } r->uri = *uri; if (args) { r->args = *args; } else { r->args.len = 0; r->args.data = NULL; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "internal redirect: \"%V?%V\"", uri, &r->args); ngx_http_set_exten(r); ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); r->loc_conf = cscf->ctx->loc_conf; ngx_http_update_location_config(r); #if (NGX_HTTP_CACHE) r->cache = NULL; #endif r->internal = 1; r->main->count++; ngx_http_handler(r); return NGX_DONE; } src/http/ngx_http_core_module.c:998: error: Integer Overflow L1 (0 - 1):unsigned32 by call to `ngx_http_finalize_request`. src/http/ngx_http_core_module.c:966:1: Parameter `r->uri_changes` 964. 965. 966. ngx_int_t ^ 967. ngx_http_core_post_rewrite_phase(ngx_http_request_t *r, 968. ngx_http_phase_handler_t *ph) src/http/ngx_http_core_module.c:990:5: Assignment 988. */ 989. 990. r->uri_changes--; ^ 991. 992. if (r->uri_changes == 0) { src/http/ngx_http_core_module.c:998:9: Call 996. 997. r->main->count++; 998. ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); ^ 999. return NGX_OK; 1000. } src/http/ngx_http_request.c:1831:1: Parameter `r->uri_changes` 1829. 1830. 1831. void ^ 1832. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 1833. { src/http/ngx_http_request.c:2001:9: Call 1999. } 2000. 2001. if (ngx_http_post_action(r) == NGX_OK) { ^ 2002. return; 2003. } src/http/ngx_http_request.c:2809:1: Parameter `r->uri_changes` 2807. 2808. 2809. static ngx_int_t ^ 2810. ngx_http_post_action(ngx_http_request_t *r) 2811. { src/http/ngx_http_request.c:2832:9: Call 2830. 2831. if (clcf->post_action.data[0] == '/') { 2832. ngx_http_internal_redirect(r, &clcf->post_action, NULL); ^ 2833. 2834. } else { src/http/ngx_http_core_module.c:2163:1: <LHS trace> 2161. 2162. 2163. ngx_int_t ^ 2164. ngx_http_internal_redirect(ngx_http_request_t *r, 2165. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2163:1: Parameter `r->uri_changes` 2161. 2162. 2163. ngx_int_t ^ 2164. ngx_http_internal_redirect(ngx_http_request_t *r, 2165. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2169:5: Binary operation: (0 - 1):unsigned32 by call to `ngx_http_finalize_request` 2167. ngx_http_core_srv_conf_t *cscf; 2168. 2169. r->uri_changes--; ^ 2170. 2171. if (r->uri_changes == 0) {
https://github.com/nginx/nginx/blob/e5b2d3c6b2a132bbbbac0249566f0da7ff12bc39/src/http/ngx_http_core_module.c/#L2169
d2a_code_trace_data_45176
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; 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:2372: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 2371 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2372, column 9. Showing all 30 steps of the trace ssl/statem/statem_clnt.c:2353:1: start of procedure tls_construct_cke_rsa() 2351. } 2352. 2353. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) 2354. { 2355. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2356:5: 2354. { 2355. #ifndef OPENSSL_NO_RSA 2356. > unsigned char *encdata = NULL; 2357. EVP_PKEY *pkey = NULL; 2358. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2357:5: 2355. #ifndef OPENSSL_NO_RSA 2356. unsigned char *encdata = NULL; 2357. > EVP_PKEY *pkey = NULL; 2358. EVP_PKEY_CTX *pctx = NULL; 2359. size_t enclen; ssl/statem/statem_clnt.c:2358:5: 2356. unsigned char *encdata = NULL; 2357. EVP_PKEY *pkey = NULL; 2358. > EVP_PKEY_CTX *pctx = NULL; 2359. size_t enclen; 2360. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2360:5: 2358. EVP_PKEY_CTX *pctx = NULL; 2359. size_t enclen; 2360. > unsigned char *pms = NULL; 2361. size_t pmslen = 0; 2362. ssl/statem/statem_clnt.c:2361:5: 2359. size_t enclen; 2360. unsigned char *pms = NULL; 2361. > size_t pmslen = 0; 2362. 2363. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2363:9: Taking false branch 2361. size_t pmslen = 0; 2362. 2363. if (s->session->peer == NULL) { ^ 2364. /* 2365. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2371:5: 2369. } 2370. 2371. > pkey = X509_get0_pubkey(s->session->peer); 2372. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2373. 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 false branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:158:5: 156. * in the queue. 157. */ 158. > x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode() 101. 102. 103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs 103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); ^ 106. 107. if (pkey == NULL) { crypto/x509/x_pubkey.c:107:9: Taking true branch 105. EVP_PKEY *pkey = EVP_PKEY_new(); 106. 107. if (pkey == NULL) { ^ 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. return -1; crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs 106. 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); ^ 109. return -1; 110. } crypto/x509/x_pubkey.c:109:9: 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. > return -1; 110. } 111. crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode 136. EVP_PKEY_free(pkey); 137. return 0; 138. > } 139. 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) crypto/x509/x_pubkey.c:160:9: Taking false branch 158. x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { ^ 161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR); 162. EVP_PKEY_free(ret); crypto/x509/x_pubkey.c:165:5: 163. } 164. 165. > return NULL; 166. } 167. 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:2372:9: 2370. 2371. pkey = X509_get0_pubkey(s->session->peer); 2372. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2373. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2374. return 0; crypto/evp/p_lib.c:261:1: start of procedure EVP_PKEY_get0_RSA() 259. } 260. 261. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 262. { 263. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:263:9: 261. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 262. { 263. > if (pkey->type != EVP_PKEY_RSA) { 264. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 265. return NULL;
https://github.com/openssl/openssl/blob/0d9824c1712b6cacd9b0ecfba26fb66ae4badfb4/ssl/statem/statem_clnt.c/#L2372
d2a_code_trace_data_45177
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: [176+min(0, `c->synth_buf_offset[*]`), 177+max(511, `c->synth_buf_offset[*]`)] (⇐ [48+min(0, `c->synth_buf_offset[*]`), 49+max(511, `c->synth_buf_offset[*]`)] + 128) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:898:5: Assignment 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; ^ 899. SUM8(sum, -=, w + 32, p); 900. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:899:5: Array access: Offset: [176+min(0, c->synth_buf_offset[*]), 177+max(511, c->synth_buf_offset[*])] (⇐ [48+min(0, c->synth_buf_offset[*]), 49+max(511, c->synth_buf_offset[*])] + 128) Size: 2 by call to `ff_mpa_synth_filter` 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p); ^ 900. *samples = round_sample(&sum); 901. samples += incr;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L899
d2a_code_trace_data_45178
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec_lib.c:520: 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_lib.c:512:5: Call 510. return -1; 511. 512. BN_CTX_start(ctx); ^ 513. a1 = BN_CTX_get(ctx); 514. a2 = 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/ec_lib.c:520:9: Call 518. b3 = BN_CTX_get(ctx); 519. if (b3 == NULL) { 520. BN_CTX_end(ctx); ^ 521. BN_CTX_free(ctx_new); 522. return -1; 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_45179
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; } test/sslapitest.c:3849: error: BUFFER_OVERRUN_L3 Offset: 6 Size: [1, +oo] by call to `TXT_DB_read`. Showing all 11 steps of the trace test/sslapitest.c:3849:10: Call 3847. * in it! 3848. */ 3849. db = TXT_DB_read(dummy, DB_NUMBER); ^ 3850. if (!TEST_ptr(db)) 3851. goto end; 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:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. 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/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/txt_db/txt_db.c/#L111
d2a_code_trace_data_45180
static int mtu_test(SSL_CTX *ctx, const char *cs, int no_etm) { SSL *srvr_ssl = NULL, *clnt_ssl = NULL; BIO *sc_bio = NULL; int i; size_t s; size_t mtus[30]; unsigned char buf[600]; int rv = 0; memset(buf, 0x5a, sizeof(buf)); if (create_ssl_objects(ctx, ctx, &srvr_ssl, &clnt_ssl, NULL, NULL) != 1) goto out; if (no_etm) SSL_set_options(srvr_ssl, SSL_OP_NO_ENCRYPT_THEN_MAC); if (SSL_set_cipher_list(srvr_ssl, cs) != 1 || SSL_set_cipher_list(clnt_ssl, cs) != 1) { ERR_print_errors_fp(stdout); goto out; } sc_bio = SSL_get_rbio(srvr_ssl); if (create_ssl_connection(clnt_ssl, srvr_ssl) != 1) goto out; if (debug) printf("Channel established\n"); for (i = 0; i < 30; i++) { SSL_set_mtu(clnt_ssl, 500 + i); mtus[i] = DTLS_get_data_mtu(clnt_ssl); if (debug) printf("%s%s payload MTU for record mtu %d = %"OSSLzu"\n", cs, no_etm ? "-noEtM":"", 500 + i, mtus[i]); if (mtus[i] == 0) { fprintf(stderr, "payload MTU failed with record MTU %d for %s\n", 500 + i, cs); goto out; } } SSL_set_mtu(clnt_ssl, 1000); for (s = mtus[0]; s <= mtus[29]; s++) { size_t reclen; if (SSL_write(clnt_ssl, buf, s) != (int)s) { ERR_print_errors_fp(stdout); goto out; } reclen = BIO_read(sc_bio, buf, sizeof(buf)); if (debug) printf("record %"OSSLzu" for payload %"OSSLzu"\n", reclen, s); for (i = 0; i < 30; i++) { if (s <= mtus[i] && reclen > (size_t)(500 + i)) { fprintf(stderr, "%s: Payload MTU %"OSSLzu" reported for record MTU %d\n" "but sending a payload of %"OSSLzu" made a record of %"OSSLzu"(too large)\n", cs, mtus[i], 500 + i, s, reclen); goto out; } if (s > mtus[i] && reclen <= (size_t)(500 + i)) { fprintf(stderr, "%s: Payload MTU %"OSSLzu" reported for record MTU %d\n" "but sending a payload of %"OSSLzu" made a record of %"OSSLzu" (too small)\n", cs, mtus[i], 500 + i, s, reclen); goto out; } } } rv = 1; if (SSL_USE_ETM(clnt_ssl)) rv = 2; out: SSL_free(clnt_ssl); SSL_free(srvr_ssl); return rv; } test/dtls_mtu_test.c:101: error: UNINITIALIZED_VALUE The value read from mtus[_] was never initialized. Showing all 1 steps of the trace test/dtls_mtu_test.c:101:10: 99. * a payload of that size and see what actual record size 100. * we end up with. */ 101. > for (s = mtus[0]; s <= mtus[29]; s++) { 102. size_t reclen; 103. if (SSL_write(clnt_ssl, buf, s) != (int)s) {
https://github.com/openssl/openssl/blob/8aefa08cfbc7db7cc10765ee9684090e37983f45/test/dtls_mtu_test.c/#L101
d2a_code_trace_data_45181
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; } apps/apps.c:1355: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_rand`. Showing all 24 steps of the trace apps/apps.c:1346:1: Parameter `b->top` 1344. } 1345. 1346. > int rand_serial(BIGNUM *b, ASN1_INTEGER *ai) 1347. { 1348. BIGNUM *btmp; apps/apps.c:1355:10: Call 1353. return 0; 1354. 1355. if (!BN_rand(btmp, SERIAL_RAND_BITS, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) ^ 1356. goto error; 1357. if (ai && !BN_to_ASN1_INTEGER(btmp, ai)) crypto/bn/bn_rand.c:106:1: Parameter `rnd->top` 104. return bnrand(NORMAL, rnd, bits, top, bottom, ctx); 105. } 106. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:108:12: Call 106. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); ^ 109. } 110. crypto/bn/bn_rand.c:23:1: Parameter `rnd->top` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_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->top` 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->top` 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->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_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_45182
static void old_print_object_header(const char *name) { char *str, *p; if (!strcmp(name, "tags")) return; str = p = av_strdup(name); if (!str) return; while (*p) { *p = av_toupper(*p); p++; } avio_printf(probe_out, "[%s]\n", str); av_freep(&str); } avprobe.c:353: error: Memory Leak memory dynamically allocated by call to `av_strdup()` at line 344, column 15 is not reachable after line 353, column 5. avprobe.c:337:1: start of procedure old_print_object_header() 335. * old-style pseudo-INI 336. */ 337. static void old_print_object_header(const char *name) ^ 338. { 339. char *str, *p; avprobe.c:341:10: Taking false branch 339. char *str, *p; 340. 341. if (!strcmp(name, "tags")) ^ 342. return; 343. avprobe.c:344:5: 342. return; 343. 344. str = p = av_strdup(name); ^ 345. if (!str) 346. return; libavutil/mem.c:219:1: start of procedure av_strdup() 217. } 218. 219. char *av_strdup(const char *s) ^ 220. { 221. char *ptr = NULL; libavutil/mem.c:221:5: 219. char *av_strdup(const char *s) 220. { 221. char *ptr = NULL; ^ 222. if (s) { 223. int len = strlen(s) + 1; libavutil/mem.c:222:9: Taking true branch 220. { 221. char *ptr = NULL; 222. if (s) { ^ 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); libavutil/mem.c:223:9: 221. char *ptr = NULL; 222. if (s) { 223. int len = strlen(s) + 1; ^ 224. ptr = av_realloc(NULL, len); 225. if (ptr) libavutil/mem.c:224:9: 222. if (s) { 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); ^ 225. if (ptr) 226. memcpy(ptr, s, len); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:9: Taking false branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:136:5: 134. return _aligned_realloc(ptr, size, 32); 135. #else 136. return realloc(ptr, size); ^ 137. #endif 138. } libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:225:13: Taking true branch 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); 225. if (ptr) ^ 226. memcpy(ptr, s, len); 227. } libavutil/mem.c:226:13: 224. ptr = av_realloc(NULL, len); 225. if (ptr) 226. memcpy(ptr, s, len); ^ 227. } 228. return ptr; libavutil/mem.c:228:5: 226. memcpy(ptr, s, len); 227. } 228. return ptr; ^ 229. } 230. libavutil/mem.c:229:1: return from a call to av_strdup 227. } 228. return ptr; 229. } ^ 230. 231. char *av_strndup(const char *s, size_t len) avprobe.c:345:10: Taking false branch 343. 344. str = p = av_strdup(name); 345. if (!str) ^ 346. return; 347. while (*p) { avprobe.c:347:12: Loop condition is true. Entering loop body 345. if (!str) 346. return; 347. while (*p) { ^ 348. *p = av_toupper(*p); 349. p++; avprobe.c:348:9: 346. return; 347. while (*p) { 348. *p = av_toupper(*p); ^ 349. p++; 350. } libavutil/avstring.h:182:1: start of procedure av_toupper() 180. * Locale-independent conversion of ASCII characters to uppercase. 181. */ 182. static inline av_const int av_toupper(int c) ^ 183. { 184. if (c >= 'a' && c <= 'z') libavutil/avstring.h:184:9: Taking false branch 182. static inline av_const int av_toupper(int c) 183. { 184. if (c >= 'a' && c <= 'z') ^ 185. c ^= 0x20; 186. return c; libavutil/avstring.h:186:5: 184. if (c >= 'a' && c <= 'z') 185. c ^= 0x20; 186. return c; ^ 187. } 188. libavutil/avstring.h:187:1: return from a call to av_toupper 185. c ^= 0x20; 186. return c; 187. } ^ 188. 189. /** avprobe.c:349:9: 347. while (*p) { 348. *p = av_toupper(*p); 349. p++; ^ 350. } 351. avprobe.c:347:12: Loop condition is false. Leaving loop 345. if (!str) 346. return; 347. while (*p) { ^ 348. *p = av_toupper(*p); 349. p++; avprobe.c:352:5: 350. } 351. 352. avio_printf(probe_out, "[%s]\n", str); ^ 353. av_freep(&str); 354. } libavformat/aviobuf.c:963:1: start of procedure avio_printf() 961. } 962. 963. int avio_printf(AVIOContext *s, const char *fmt, ...) ^ 964. { 965. va_list ap; libavformat/aviobuf.c:969:5: 967. int ret; 968. 969. va_start(ap, fmt); ^ 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); libavformat/aviobuf.c:970:5: 968. 969. va_start(ap, fmt); 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); ^ 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); libavformat/aviobuf.c:971:5: 969. va_start(ap, fmt); 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); ^ 972. avio_write(s, buf, strlen(buf)); 973. return ret; libavformat/aviobuf.c:972:5: Skipping avio_write(): empty list of specs 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); ^ 973. return ret; 974. } libavformat/aviobuf.c:973:5: 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); 973. return ret; ^ 974. } 975. libavformat/aviobuf.c:974:1: return from a call to avio_printf 972. avio_write(s, buf, strlen(buf)); 973. return ret; 974. } ^ 975. 976. int avio_pause(AVIOContext *s, int pause) avprobe.c:353:5: Skipping av_freep(): empty list of specs 351. 352. avio_printf(probe_out, "[%s]\n", str); 353. av_freep(&str); ^ 354. } 355.
https://github.com/libav/libav/blob/7a6cf2771414c7ab8bca0811d589f6091a6e2b71/avprobe.c/#L353
d2a_code_trace_data_45183
AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h); if (link_dpad(link).get_video_buffer) ret = link_dpad(link).get_video_buffer(link, perms, w, h); if (!ret) ret = avfilter_default_get_video_buffer(link, perms, w, h); if (ret) ret->type = AVMEDIA_TYPE_VIDEO; FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); return ret; } libavfilter/avfilter.c:247: error: Null Dereference pointer `ret` last assigned on line 242 could be null and is dereferenced by call to `ff_dprintf_ref()` at line 247, column 109. libavfilter/avfilter.c:232:1: start of procedure avfilter_get_video_buffer() 230. } 231. 232. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) ^ 233. { 234. AVFilterBufferRef *ret = NULL; libavfilter/avfilter.c:234:5: 232. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) 233. { 234. AVFilterBufferRef *ret = NULL; ^ 235. 236. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h); libavfilter/avfilter.c:236:47: 234. AVFilterBufferRef *ret = NULL; 235. 236. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h); ^ 237. 238. if (link_dpad(link).get_video_buffer) libavfilter/avfilter.c:221:1: start of procedure ff_dprintf_link() 219. } 220. 221. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) ^ 222. { 223. dprintf(ctx, libavfilter/avfilter.c:230:1: return from a call to ff_dprintf_link 228. link->dst ? link->dst->filter->name : "", 229. end ? "\n" : ""); 230. } ^ 231. 232. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) libavfilter/avfilter.c:238:9: Taking true branch 236. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h); 237. 238. if (link_dpad(link).get_video_buffer) ^ 239. ret = link_dpad(link).get_video_buffer(link, perms, w, h); 240. libavfilter/avfilter.c:239:9: Skipping __function_pointer__(): unresolved function pointer 237. 238. if (link_dpad(link).get_video_buffer) 239. ret = link_dpad(link).get_video_buffer(link, perms, w, h); ^ 240. 241. if (!ret) libavfilter/avfilter.c:241:10: Taking true branch 239. ret = link_dpad(link).get_video_buffer(link, perms, w, h); 240. 241. if (!ret) ^ 242. ret = avfilter_default_get_video_buffer(link, perms, w, h); 243. libavfilter/avfilter.c:242:9: Skipping avfilter_default_get_video_buffer(): empty list of specs 240. 241. if (!ret) 242. ret = avfilter_default_get_video_buffer(link, perms, w, h); ^ 243. 244. if (ret) libavfilter/avfilter.c:244:9: Taking false branch 242. ret = avfilter_default_get_video_buffer(link, perms, w, h); 243. 244. if (ret) ^ 245. ret->type = AVMEDIA_TYPE_VIDEO; 246. libavfilter/avfilter.c:247:47: 245. ret->type = AVMEDIA_TYPE_VIDEO; 246. 247. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); ^ 248. 249. return ret; libavfilter/avfilter.c:221:1: start of procedure ff_dprintf_link() 219. } 220. 221. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) ^ 222. { 223. dprintf(ctx, libavfilter/avfilter.c:230:1: return from a call to ff_dprintf_link 228. link->dst ? link->dst->filter->name : "", 229. end ? "\n" : ""); 230. } ^ 231. 232. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) libavfilter/avfilter.c:247:109: 245. ret->type = AVMEDIA_TYPE_VIDEO; 246. 247. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); ^ 248. 249. return ret; libavfilter/avfilter.c:194:1: start of procedure ff_dprintf_ref() 192. } 193. 194. void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) ^ 195. { 196. dprintf(ctx, libavfilter/avfilter.c:202:9: Taking false branch 200. ref->pts, ref->pos); 201. 202. if (ref->video) { ^ 203. dprintf(ctx, " a:%d/%d s:%dx%d i:%c", 204. ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
https://github.com/libav/libav/blob/d1a991f23d45e58aa24b70a1c2f0618e642b2abe/libavfilter/avfilter.c/#L247
d2a_code_trace_data_45184
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:359: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top`. Showing all 22 steps of the trace crypto/bn/bn_exp.c:296:1: Parameter `ctx->stack.depth` 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:333:5: Call 331. } 332. 333. BN_CTX_start(ctx); ^ 334. d = BN_CTX_get(ctx); 335. r = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:334:9: Call 332. 333. BN_CTX_start(ctx); 334. d = BN_CTX_get(ctx); ^ 335. r = BN_CTX_get(ctx); 336. val[0] = 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_exp.c:335:9: Call 333. BN_CTX_start(ctx); 334. d = BN_CTX_get(ctx); 335. r = BN_CTX_get(ctx); ^ 336. val[0] = BN_CTX_get(ctx); 337. if (val[0] == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:336:14: Call 334. d = BN_CTX_get(ctx); 335. r = BN_CTX_get(ctx); 336. val[0] = BN_CTX_get(ctx); ^ 337. if (val[0] == NULL) 338. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:359:10: Call 357. } else 358. aa = a; 359. if (!bn_to_mont_fixed_top(val[0], aa, mont, ctx)) ^ 360. goto err; /* 1 */ 361. crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:60:5: Call 58. return 0; 59. 60. BN_CTX_start(ctx); ^ 61. tmp = BN_CTX_get(ctx); 62. if (tmp == NULL) crypto/bn/bn_ctx.c: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_mont.c:83:5: Call 81. ret = 1; 82. err: 83. BN_CTX_end(ctx); ^ 84. return ret; 85. } 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_to_mont_fixed_top` 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_45185
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; 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:2514: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 2464, column 11 is not reachable after line 2514, column 5. Showing all 66 steps of the trace ssl/statem/statem_clnt.c:2439:1: start of procedure tls_construct_cke_rsa() 2437. } 2438. 2439. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) 2440. { 2441. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2442:5: 2440. { 2441. #ifndef OPENSSL_NO_RSA 2442. > unsigned char *encdata = NULL; 2443. EVP_PKEY *pkey = NULL; 2444. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2443:5: 2441. #ifndef OPENSSL_NO_RSA 2442. unsigned char *encdata = NULL; 2443. > EVP_PKEY *pkey = NULL; 2444. EVP_PKEY_CTX *pctx = NULL; 2445. size_t enclen; ssl/statem/statem_clnt.c:2444:5: 2442. unsigned char *encdata = NULL; 2443. EVP_PKEY *pkey = NULL; 2444. > EVP_PKEY_CTX *pctx = NULL; 2445. size_t enclen; 2446. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2446:5: 2444. EVP_PKEY_CTX *pctx = NULL; 2445. size_t enclen; 2446. > unsigned char *pms = NULL; 2447. size_t pmslen = 0; 2448. ssl/statem/statem_clnt.c:2447:5: 2445. size_t enclen; 2446. unsigned char *pms = NULL; 2447. > size_t pmslen = 0; 2448. 2449. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2449:9: Taking false branch 2447. size_t pmslen = 0; 2448. 2449. if (s->session->peer == NULL) { ^ 2450. /* 2451. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2457:5: 2455. } 2456. 2457. > pkey = X509_get0_pubkey(s->session->peer); 2458. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2459. 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:2458:9: 2456. 2457. pkey = X509_get0_pubkey(s->session->peer); 2458. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2459. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2460. return 0; crypto/evp/p_lib.c:261:1: start of procedure EVP_PKEY_get0_RSA() 259. } 260. 261. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 262. { 263. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:263:9: Taking false branch 261. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 262. { 263. if (pkey->type != EVP_PKEY_RSA) { ^ 264. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 265. return NULL; crypto/evp/p_lib.c:267:5: 265. return NULL; 266. } 267. > return pkey->pkey.rsa; 268. } 269. crypto/evp/p_lib.c:268:1: return from a call to EVP_PKEY_get0_RSA 266. } 267. return pkey->pkey.rsa; 268. > } 269. 270. RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) ssl/statem/statem_clnt.c:2458:9: Taking false branch 2456. 2457. pkey = X509_get0_pubkey(s->session->peer); 2458. if (EVP_PKEY_get0_RSA(pkey) == NULL) { ^ 2459. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2460. return 0; ssl/statem/statem_clnt.c:2463:5: 2461. } 2462. 2463. > pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2464. pms = OPENSSL_malloc(pmslen); 2465. if (pms == NULL) { ssl/statem/statem_clnt.c:2464:5: 2462. 2463. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2464. > pms = OPENSSL_malloc(pmslen); 2465. if (pms == NULL) { 2466. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); 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) ssl/statem/statem_clnt.c:2465:9: Taking false branch 2463. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2464. pms = OPENSSL_malloc(pmslen); 2465. if (pms == NULL) { ^ 2466. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); 2467. *al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_clnt.c:2471:5: 2469. } 2470. 2471. > pms[0] = s->client_version >> 8; 2472. pms[1] = s->client_version & 0xff; 2473. /* TODO(size_t): Convert this function */ ssl/statem/statem_clnt.c:2472:5: 2470. 2471. pms[0] = s->client_version >> 8; 2472. > pms[1] = s->client_version & 0xff; 2473. /* TODO(size_t): Convert this function */ 2474. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ssl/statem/statem_clnt.c:2474:9: 2472. pms[1] = s->client_version & 0xff; 2473. /* TODO(size_t): Convert this function */ 2474. > if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { 2475. goto err; 2476. } 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:2474:9: Taking true branch 2472. pms[1] = s->client_version & 0xff; 2473. /* TODO(size_t): Convert this function */ 2474. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ^ 2475. goto err; 2476. } ssl/statem/statem_clnt.c:2513:2: 2511. 2512. return 1; 2513. > err: 2514. OPENSSL_clear_free(pms, pmslen); 2515. EVP_PKEY_CTX_free(pctx); ssl/statem/statem_clnt.c:2514:5: 2512. return 1; 2513. err: 2514. > OPENSSL_clear_free(pms, pmslen); 2515. EVP_PKEY_CTX_free(pctx); 2516. crypto/mem.c:183:1: start of procedure CRYPTO_clear_free() 181. } 182. 183. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 184. { 185. if (str == NULL) crypto/mem.c:185:9: Taking false branch 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 184. { 185. if (str == NULL) ^ 186. return; 187. if (num) crypto/mem.c:187:9: Taking true branch 185. if (str == NULL) 186. return; 187. if (num) ^ 188. OPENSSL_cleanse(str, num); 189. CRYPTO_free(str, file, line); crypto/mem.c:188:9: Skipping OPENSSL_cleanse(): method has no implementation 186. return; 187. if (num) 188. OPENSSL_cleanse(str, num); ^ 189. CRYPTO_free(str, file, line); 190. } crypto/mem.c:189:5: 187. if (num) 188. OPENSSL_cleanse(str, num); 189. > CRYPTO_free(str, file, line); 190. } crypto/mem.c:163:1: start of procedure CRYPTO_free() 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:165:9: Taking true branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:165:30: Taking true branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); ^ 167. return; 168. } crypto/mem.c:167:9: 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); 167. > return; 168. } 169. crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/mem.c:190:1: return from a call to CRYPTO_clear_free 188. OPENSSL_cleanse(str, num); 189. CRYPTO_free(str, file, line); 190. > }
https://github.com/openssl/openssl/blob/4954fd13b3c71f0f74677b78533f1176e13de032/ssl/statem/statem_clnt.c/#L2514
d2a_code_trace_data_45186
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:558: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 556 could be null and is dereferenced at line 558, column 9. Showing all 13 steps of the trace test/drbgtest.c:551:1: start of procedure get_entropy_hook() 549. 550. /* Intercepts and counts calls to the get_entropy() callback */ 551. > static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout, 552. int entropy, size_t min_len, size_t max_len, 553. int prediction_resistance) test/drbgtest.c:556:5: 554. { 555. size_t ret; 556. > HOOK_CTX *ctx = get_hook_ctx(drbg); 557. 558. if (ctx->fail != 0) test/drbgtest.c:545:1: start of procedure get_hook_ctx() 543. static HOOK_CTX master_ctx, public_ctx, private_ctx; 544. 545. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 546. { 547. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); test/drbgtest.c:547:5: 545. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 546. { 547. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 548. } 549. crypto/rand/drbg_lib.c:929:1: start of procedure RAND_DRBG_get_ex_data() 927. } 928. 929. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 930. { 931. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:931:5: 929. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 930. { 931. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 932. } 933. crypto/ex_data.c:429:1: start of procedure CRYPTO_get_ex_data() 427. * particular index in the class used by this variable 428. */ 429. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:431:9: Taking true branch 429. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 432. return NULL; 433. return sk_void_value(ad->sk, idx); crypto/ex_data.c:432:9: 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 432. > return NULL; 433. return sk_void_value(ad->sk, idx); 434. } crypto/ex_data.c:434:1: return from a call to CRYPTO_get_ex_data 432. return NULL; 433. return sk_void_value(ad->sk, idx); 434. > } crypto/rand/drbg_lib.c:932:1: return from a call to RAND_DRBG_get_ex_data 930. { 931. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 932. > } 933. 934. test/drbgtest.c:548:1: return from a call to get_hook_ctx 546. { 547. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 548. > } 549. 550. /* Intercepts and counts calls to the get_entropy() callback */ test/drbgtest.c:558:9: 556. HOOK_CTX *ctx = get_hook_ctx(drbg); 557. 558. > if (ctx->fail != 0) 559. return 0; 560.
https://github.com/openssl/openssl/blob/8d4f150f70d70d6c3e62661ed7cc16c2f751d8a1/test/drbgtest.c/#L558
d2a_code_trace_data_45187
int ff_wma_init(AVCodecContext * avctx, int flags2) { WMACodecContext *s = avctx->priv_data; int i; float *window; float bps1, high_freq; volatile float bps; int sample_rate1; int coef_vlc_table; if( avctx->sample_rate<=0 || avctx->sample_rate>50000 || avctx->channels<=0 || avctx->channels>8 || avctx->bit_rate<=0) return -1; s->sample_rate = avctx->sample_rate; s->nb_channels = avctx->channels; s->bit_rate = avctx->bit_rate; s->block_align = avctx->block_align; dsputil_init(&s->dsp, avctx); if (avctx->codec->id == CODEC_ID_WMAV1) { s->version = 1; } else { s->version = 2; } if (s->sample_rate <= 16000) { s->frame_len_bits = 9; } else if (s->sample_rate <= 22050 || (s->sample_rate <= 32000 && s->version == 1)) { s->frame_len_bits = 10; } else { s->frame_len_bits = 11; } s->frame_len = 1 << s->frame_len_bits; if (s->use_variable_block_len) { int nb_max, nb; nb = ((flags2 >> 3) & 3) + 1; if ((s->bit_rate / s->nb_channels) >= 32000) nb += 2; nb_max = s->frame_len_bits - BLOCK_MIN_BITS; if (nb > nb_max) nb = nb_max; s->nb_block_sizes = nb + 1; } else { s->nb_block_sizes = 1; } s->use_noise_coding = 1; high_freq = s->sample_rate * 0.5; sample_rate1 = s->sample_rate; if (s->version == 2) { if (sample_rate1 >= 44100) sample_rate1 = 44100; else if (sample_rate1 >= 22050) sample_rate1 = 22050; else if (sample_rate1 >= 16000) sample_rate1 = 16000; else if (sample_rate1 >= 11025) sample_rate1 = 11025; else if (sample_rate1 >= 8000) sample_rate1 = 8000; } bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate); s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2; bps1 = bps; if (s->nb_channels == 2) bps1 = bps * 1.6; if (sample_rate1 == 44100) { if (bps1 >= 0.61) s->use_noise_coding = 0; else high_freq = high_freq * 0.4; } else if (sample_rate1 == 22050) { if (bps1 >= 1.16) s->use_noise_coding = 0; else if (bps1 >= 0.72) high_freq = high_freq * 0.7; else high_freq = high_freq * 0.6; } else if (sample_rate1 == 16000) { if (bps > 0.5) high_freq = high_freq * 0.5; else high_freq = high_freq * 0.3; } else if (sample_rate1 == 11025) { high_freq = high_freq * 0.7; } else if (sample_rate1 == 8000) { if (bps <= 0.625) { high_freq = high_freq * 0.5; } else if (bps > 0.75) { s->use_noise_coding = 0; } else { high_freq = high_freq * 0.65; } } else { if (bps >= 0.8) { high_freq = high_freq * 0.75; } else if (bps >= 0.6) { high_freq = high_freq * 0.6; } else { high_freq = high_freq * 0.5; } } dprintf(s->avctx, "flags2=0x%x\n", flags2); dprintf(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", s->version, s->nb_channels, s->sample_rate, s->bit_rate, s->block_align); dprintf(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", bps, bps1, high_freq, s->byte_offset_bits); dprintf(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes); { int a, b, pos, lpos, k, block_len, i, j, n; const uint8_t *table; if (s->version == 1) { s->coefs_start = 3; } else { s->coefs_start = 0; } for(k = 0; k < s->nb_block_sizes; k++) { block_len = s->frame_len >> k; if (s->version == 1) { lpos = 0; for(i=0;i<25;i++) { a = wma_critical_freqs[i]; b = s->sample_rate; pos = ((block_len * 2 * a) + (b >> 1)) / b; if (pos > block_len) pos = block_len; s->exponent_bands[0][i] = pos - lpos; if (pos >= block_len) { i++; break; } lpos = pos; } s->exponent_sizes[0] = i; } else { table = NULL; a = s->frame_len_bits - BLOCK_MIN_BITS - k; if (a < 3) { if (s->sample_rate >= 44100) table = exponent_band_44100[a]; else if (s->sample_rate >= 32000) table = exponent_band_32000[a]; else if (s->sample_rate >= 22050) table = exponent_band_22050[a]; } if (table) { n = *table++; for(i=0;i<n;i++) s->exponent_bands[k][i] = table[i]; s->exponent_sizes[k] = n; } else { j = 0; lpos = 0; for(i=0;i<25;i++) { a = wma_critical_freqs[i]; b = s->sample_rate; pos = ((block_len * 2 * a) + (b << 1)) / (4 * b); pos <<= 2; if (pos > block_len) pos = block_len; if (pos > lpos) s->exponent_bands[k][j++] = pos - lpos; if (pos >= block_len) break; lpos = pos; } s->exponent_sizes[k] = j; } } s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k; s->high_band_start[k] = (int)((block_len * 2 * high_freq) / s->sample_rate + 0.5); n = s->exponent_sizes[k]; j = 0; pos = 0; for(i=0;i<n;i++) { int start, end; start = pos; pos += s->exponent_bands[k][i]; end = pos; if (start < s->high_band_start[k]) start = s->high_band_start[k]; if (end > s->coefs_end[k]) end = s->coefs_end[k]; if (end > start) s->exponent_high_bands[k][j++] = end - start; } s->exponent_high_sizes[k] = j; #if 0 tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ", s->frame_len >> k, s->coefs_end[k], s->high_band_start[k], s->exponent_high_sizes[k]); for(j=0;j<s->exponent_high_sizes[k];j++) tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]); tprintf(s->avctx, "\n"); #endif } } #ifdef TRACE { int i, j; for(i = 0; i < s->nb_block_sizes; i++) { tprintf(s->avctx, "%5d: n=%2d:", s->frame_len >> i, s->exponent_sizes[i]); for(j=0;j<s->exponent_sizes[i];j++) tprintf(s->avctx, " %d", s->exponent_bands[i][j]); tprintf(s->avctx, "\n"); } } #endif for(i = 0; i < s->nb_block_sizes; i++) { int n, j; float alpha; n = 1 << (s->frame_len_bits - i); window = av_malloc(sizeof(float) * n); alpha = M_PI / (2.0 * n); for(j=0;j<n;j++) { window[j] = sin((j + 0.5) * alpha); } s->windows[i] = window; } s->reset_block_lengths = 1; if (s->use_noise_coding) { if (s->use_exp_vlc) s->noise_mult = 0.02; else s->noise_mult = 0.04; #ifdef TRACE for(i=0;i<NOISE_TAB_SIZE;i++) s->noise_table[i] = 1.0 * s->noise_mult; #else { unsigned int seed; float norm; seed = 1; norm = (1.0 / (float)(1LL << 31)) * sqrt(3) * s->noise_mult; for(i=0;i<NOISE_TAB_SIZE;i++) { seed = seed * 314159 + 1; s->noise_table[i] = (float)((int)seed) * norm; } } #endif } coef_vlc_table = 2; if (s->sample_rate >= 32000) { if (bps1 < 0.72) coef_vlc_table = 0; else if (bps1 < 1.16) coef_vlc_table = 1; } s->coef_vlcs[0]= &coef_vlcs[coef_vlc_table * 2 ]; s->coef_vlcs[1]= &coef_vlcs[coef_vlc_table * 2 + 1]; init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0], s->coef_vlcs[0]); init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1], s->coef_vlcs[1]); return 0; } libavcodec/wma.c:223: error: Buffer Overrun L3 Offset: [-2, 2] Size: 3. libavcodec/wma.c:95:9: <Offset trace> 93. /* compute MDCT block size */ 94. if (s->sample_rate <= 16000) { 95. s->frame_len_bits = 9; ^ 96. } else if (s->sample_rate <= 22050 || 97. (s->sample_rate <= 32000 && s->version == 1)) { libavcodec/wma.c:95:9: Assignment 93. /* compute MDCT block size */ 94. if (s->sample_rate <= 16000) { 95. s->frame_len_bits = 9; ^ 96. } else if (s->sample_rate <= 22050 || 97. (s->sample_rate <= 32000 && s->version == 1)) { libavcodec/wma.c:220:17: Assignment 218. /* hardcoded tables */ 219. table = NULL; 220. a = s->frame_len_bits - BLOCK_MIN_BITS - k; ^ 221. if (a < 3) { 222. if (s->sample_rate >= 44100) libavcodec/wmadata.h:53:1: <Length trace> 51. }; 52. 53. static const uint8_t exponent_band_44100[3][25] = { ^ 54. { 12, 4, 4, 4, 4, 4, 8, 8, 8, 12, 16, 20, 36, }, 55. { 15, 4, 8, 4, 8, 8, 4, 8, 8, 12, 12, 12, 24, 28, 40, 76, }, libavcodec/wmadata.h:53:1: Array declaration 51. }; 52. 53. static const uint8_t exponent_band_44100[3][25] = { ^ 54. { 12, 4, 4, 4, 4, 4, 8, 8, 8, 12, 16, 20, 36, }, 55. { 15, 4, 8, 4, 8, 8, 4, 8, 8, 12, 12, 12, 24, 28, 40, 76, }, libavcodec/wma.c:223:25: Array access: Offset: [-2, 2] Size: 3 221. if (a < 3) { 222. if (s->sample_rate >= 44100) 223. table = exponent_band_44100[a]; ^ 224. else if (s->sample_rate >= 32000) 225. table = exponent_band_32000[a];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/wma.c/#L223
d2a_code_trace_data_45188
static int init_output_stream_streamcopy(OutputStream *ost) { OutputFile *of = output_files[ost->file_index]; InputStream *ist = get_input_stream(ost); AVCodecParameters *par_dst = ost->st->codecpar; AVCodecParameters *par_src = ist->st->codecpar; AVRational sar; int i; uint64_t extra_size; extra_size = (uint64_t)par_src->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; if (extra_size > INT_MAX) { return AVERROR(EINVAL); } ost->st->disposition = ist->st->disposition; par_dst->codec_id = par_src->codec_id; par_dst->codec_type = par_src->codec_type; if (!par_dst->codec_tag) { if (!of->ctx->oformat->codec_tag || av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_dst->codec_id || av_codec_get_tag(of->ctx->oformat->codec_tag, par_src->codec_id) <= 0) par_dst->codec_tag = par_src->codec_tag; } par_dst->bit_rate = par_src->bit_rate; par_dst->field_order = par_src->field_order; par_dst->chroma_location = par_src->chroma_location; if (par_src->extradata) { par_dst->extradata = av_mallocz(extra_size); if (!par_dst->extradata) { return AVERROR(ENOMEM); } memcpy(par_dst->extradata, par_src->extradata, par_src->extradata_size); par_dst->extradata_size = par_src->extradata_size; } ost->st->time_base = ist->st->time_base; if (ist->st->nb_side_data) { ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data, sizeof(*ist->st->side_data)); if (!ost->st->side_data) return AVERROR(ENOMEM); for (i = 0; i < ist->st->nb_side_data; i++) { const AVPacketSideData *sd_src = &ist->st->side_data[i]; AVPacketSideData *sd_dst = &ost->st->side_data[i]; sd_dst->data = av_malloc(sd_src->size); if (!sd_dst->data) return AVERROR(ENOMEM); memcpy(sd_dst->data, sd_src->data, sd_src->size); sd_dst->size = sd_src->size; sd_dst->type = sd_src->type; ost->st->nb_side_data++; } } ost->parser = av_parser_init(par_dst->codec_id); ost->parser_avctx = avcodec_alloc_context3(NULL); if (!ost->parser_avctx) return AVERROR(ENOMEM); switch (par_dst->codec_type) { case AVMEDIA_TYPE_AUDIO: if (audio_volume != 256) { av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n"); exit_program(1); } par_dst->channel_layout = par_src->channel_layout; par_dst->sample_rate = par_src->sample_rate; par_dst->channels = par_src->channels; par_dst->block_align = par_src->block_align; break; case AVMEDIA_TYPE_VIDEO: par_dst->format = par_src->format; par_dst->width = par_src->width; par_dst->height = par_src->height; if (ost->frame_aspect_ratio) sar = av_d2q(ost->frame_aspect_ratio * par_dst->height / par_dst->width, 255); else if (ist->st->sample_aspect_ratio.num) sar = ist->st->sample_aspect_ratio; else sar = par_src->sample_aspect_ratio; ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar; break; case AVMEDIA_TYPE_SUBTITLE: par_dst->width = par_src->width; par_dst->height = par_src->height; break; case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_ATTACHMENT: break; default: abort(); } return 0; } avconv.c:1717: error: Buffer Overrun L3 Offset: 0 Size: [0, 2147483631]. avconv.c:1715:14: <Offset trace> 1713. return AVERROR(ENOMEM); 1714. 1715. for (i = 0; i < ist->st->nb_side_data; i++) { ^ 1716. const AVPacketSideData *sd_src = &ist->st->side_data[i]; 1717. AVPacketSideData *sd_dst = &ost->st->side_data[i]; avconv.c:1715:14: Assignment 1713. return AVERROR(ENOMEM); 1714. 1715. for (i = 0; i < ist->st->nb_side_data; i++) { ^ 1716. const AVPacketSideData *sd_src = &ist->st->side_data[i]; 1717. AVPacketSideData *sd_dst = &ost->st->side_data[i]; avconv.c:1710:30: <Length trace> 1708. 1709. if (ist->st->nb_side_data) { 1710. ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data, ^ 1711. sizeof(*ist->st->side_data)); 1712. if (!ost->st->side_data) avconv.c:1710:30: Call 1708. 1709. if (ist->st->nb_side_data) { 1710. ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data, ^ 1711. sizeof(*ist->st->side_data)); 1712. if (!ost->st->side_data) libavutil/mem.c:164:9: Assignment 162. { 163. if (!size || nmemb >= INT_MAX / size) 164. return NULL; ^ 165. return av_realloc(ptr, nmemb * size); 166. } avconv.c:1710:9: Assignment 1708. 1709. if (ist->st->nb_side_data) { 1710. ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data, ^ 1711. sizeof(*ist->st->side_data)); 1712. if (!ost->st->side_data) avconv.c:1717:13: Array access: Offset: 0 Size: [0, 2147483631] 1715. for (i = 0; i < ist->st->nb_side_data; i++) { 1716. const AVPacketSideData *sd_src = &ist->st->side_data[i]; 1717. AVPacketSideData *sd_dst = &ost->st->side_data[i]; ^ 1718. 1719. sd_dst->data = av_malloc(sd_src->size);
https://github.com/libav/libav/blob/11b8030309ee93d79b3a6cd4b83bf00757db1598/avconv.c/#L1717
d2a_code_trace_data_45189
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/s_server.c:2639: error: BUFFER_OVERRUN_L3 Offset added: [200, 8192] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/s_server.c:2639:9: Call 2637. BIO_printf(bio_s_out, "Client certificate\n"); 2638. PEM_write_bio_X509(bio_s_out, peer); 2639. X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf); ^ 2640. BIO_printf(bio_s_out, "subject=%s\n", buf); 2641. X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf); 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: [200, 8192] 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_45190
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) { const char *p; char tag[128], *q; p = info; if (*p == '?') p++; for(;;) { q = tag; while (*p != '\0' && *p != '=' && *p != '&') { if ((q - tag) < sizeof(tag) - 1) *q++ = *p; p++; } *q = '\0'; q = arg; if (*p == '=') { p++; while (*p != '&' && *p != '\0') { if ((q - arg) < arg_size - 1) { if (*p == '+') *q++ = ' '; else *q++ = *p; } p++; } *q = '\0'; } if (!strcmp(tag, tag1)) return 1; if (*p != '&') break; p++; } return 0; } ffserver.c:489: error: Buffer Overrun L1 Offset: [1, +oo] Size: 1 by call to `open_input_stream`. ffserver.c:489:17: Call 487. continue; 488. 489. if (open_input_stream(rtp_c, "") < 0) { ^ 490. fprintf(stderr, "Could not open input stream for stream '%s'\n", 491. stream->filename); ffserver.c:1882:1: Parameter `*info` 1880. } 1881. 1882. static int open_input_stream(HTTPContext *c, const char *info) ^ 1883. { 1884. char buf[128]; ffserver.c:1895:13: Call 1893. buf_size = FFM_PACKET_SIZE; 1894. /* compute position (absolute time) */ 1895. if (find_info_tag(buf, sizeof(buf), "date", info)) ^ 1896. { 1897. stream_pos = parse_date(buf, 0); libavformat/utils.c:2810:1: <Length trace> 2808. } 2809. 2810. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) ^ 2811. { 2812. const char *p; libavformat/utils.c:2810:1: Parameter `*info` 2808. } 2809. 2810. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) ^ 2811. { 2812. const char *p; libavformat/utils.c:2815:5: Assignment 2813. char tag[128], *q; 2814. 2815. p = info; ^ 2816. if (*p == '?') 2817. p++; libavformat/utils.c:2828:13: Assignment 2826. q = arg; 2827. if (*p == '=') { 2828. p++; ^ 2829. while (*p != '&' && *p != '\0') { 2830. if ((q - arg) < arg_size - 1) { libavformat/utils.c:2829:20: Array access: Offset: [1, +oo] Size: 1 by call to `open_input_stream` 2827. if (*p == '=') { 2828. p++; 2829. while (*p != '&' && *p != '\0') { ^ 2830. if ((q - arg) < arg_size - 1) { 2831. if (*p == '+')
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2829
d2a_code_trace_data_45191
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/sm2/sm2_sign.c:118: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`. Showing all 26 steps of the trace crypto/sm2/sm2_sign.c:115:14: Call 113. } 114. 115. if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx) ^ 116. || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL, 117. ctx) 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 `r->Z->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/sm2/sm2_sign.c:118:21: Call 116. || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL, 117. ctx) 118. || !BN_mod_add(r, e, x1, order, ctx)) { ^ 119. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR); 120. goto done; crypto/bn/bn_mod.c:28:1: Parameter `r->top` 26. } 27. 28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 29. BN_CTX *ctx) 30. { crypto/bn/bn_mod.c:31:10: Call 29. BN_CTX *ctx) 30. { 31. if (!BN_add(r, a, b)) ^ 32. return 0; 33. return BN_nnmod(r, r, m, ctx); crypto/bn/bn_add.c:14:1: Parameter `r->top` 12. 13. /* signed add of b to a. */ 14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 15. { 16. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:28:19: Call 26. if (cmp_res > 0) { 27. r_neg = a->neg; 28. ret = BN_usub(r, a, b); ^ 29. } else if (cmp_res < 0) { 30. r_neg = b->neg; crypto/bn/bn_add.c:125:1: Parameter `r->top` 123. 124. /* unsigned subtraction of b from a, a must be larger than b. */ 125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 126. { 127. int max, min, dif; crypto/bn/bn_add.c:143:9: Call 141. } 142. 143. if (bn_wexpand(r, max) == NULL) ^ 144. return 0; 145. crypto/bn/bn_lib.c:941:1: Parameter `a->top` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:943:37: Call 941. BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 944. } 945. crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `words` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:225:13: Call 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:225:9: Assignment 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_45192
int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt, int saltlen, int iter, const EVP_MD *digest, int keylen, unsigned char *out) { const char *empty = ""; unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; int cplen, j, k, tkeylen, mdlen; unsigned long i = 1; HMAC_CTX *hctx_tpl = NULL, *hctx = NULL; mdlen = EVP_MD_size(digest); if (mdlen < 0) return 0; hctx_tpl = HMAC_CTX_new(); if (hctx_tpl == NULL) return 0; p = out; tkeylen = keylen; if (pass == NULL) { pass = empty; passlen = 0; } else if (passlen == -1) { passlen = strlen(pass); } if (!HMAC_Init_ex(hctx_tpl, pass, passlen, digest, NULL)) { HMAC_CTX_free(hctx_tpl); return 0; } hctx = HMAC_CTX_new(); if (hctx == NULL) { HMAC_CTX_free(hctx_tpl); return 0; } while (tkeylen) { if (tkeylen > mdlen) cplen = mdlen; else cplen = tkeylen; itmp[0] = (unsigned char)((i >> 24) & 0xff); itmp[1] = (unsigned char)((i >> 16) & 0xff); itmp[2] = (unsigned char)((i >> 8) & 0xff); itmp[3] = (unsigned char)(i & 0xff); if (!HMAC_CTX_copy(hctx, hctx_tpl)) { HMAC_CTX_free(hctx); HMAC_CTX_free(hctx_tpl); return 0; } if (!HMAC_Update(hctx, salt, saltlen) || !HMAC_Update(hctx, itmp, 4) || !HMAC_Final(hctx, digtmp, NULL)) { HMAC_CTX_free(hctx); HMAC_CTX_free(hctx_tpl); return 0; } memcpy(p, digtmp, cplen); for (j = 1; j < iter; j++) { if (!HMAC_CTX_copy(hctx, hctx_tpl)) { HMAC_CTX_free(hctx); HMAC_CTX_free(hctx_tpl); return 0; } if (!HMAC_Update(hctx, digtmp, mdlen) || !HMAC_Final(hctx, digtmp, NULL)) { HMAC_CTX_free(hctx); HMAC_CTX_free(hctx_tpl); return 0; } for (k = 0; k < cplen; k++) p[k] ^= digtmp[k]; } tkeylen -= cplen; i++; p += cplen; } HMAC_CTX_free(hctx); HMAC_CTX_free(hctx_tpl); # ifdef OPENSSL_DEBUG_PKCS5V2 fprintf(stderr, "Password:\n"); h__dump(pass, passlen); fprintf(stderr, "Salt:\n"); h__dump(salt, saltlen); fprintf(stderr, "Iteration count %d\n", iter); fprintf(stderr, "Key:\n"); h__dump(out, keylen); # endif return 1; } crypto/evp/p5_crpt2.c:249: error: INTEGER_OVERFLOW_L2 ([1, 9223372036854775806] + 1):signed32 by call to `PKCS5_PBKDF2_HMAC`. Showing all 7 steps of the trace crypto/evp/p5_crpt2.c:248:12: Call 246. salt = kdf->salt->value.octet_string->data; 247. saltlen = kdf->salt->value.octet_string->length; 248. iter = ASN1_INTEGER_get(kdf->iter); ^ 249. if (!PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, prfmd, 250. keylen, key)) crypto/asn1/a_int.c:564:9: Assignment 562. int64_t r; 563. if (a == NULL) 564. return 0; ^ 565. i = ASN1_INTEGER_get_int64(&r, a); 566. if (i == 0) crypto/evp/p5_crpt2.c:248:5: Assignment 246. salt = kdf->salt->value.octet_string->data; 247. saltlen = kdf->salt->value.octet_string->length; 248. iter = ASN1_INTEGER_get(kdf->iter); ^ 249. if (!PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, prfmd, 250. keylen, key)) crypto/evp/p5_crpt2.c:249:10: Call 247. saltlen = kdf->salt->value.octet_string->length; 248. iter = ASN1_INTEGER_get(kdf->iter); 249. if (!PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, prfmd, ^ 250. keylen, key)) 251. goto err; crypto/evp/p5_crpt2.c:32:1: <LHS trace> 30. */ 31. 32. > int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, 33. const unsigned char *salt, int saltlen, int iter, 34. const EVP_MD *digest, int keylen, unsigned char *out) crypto/evp/p5_crpt2.c:32:1: Parameter `iter` 30. */ 31. 32. > int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, 33. const unsigned char *salt, int saltlen, int iter, 34. const EVP_MD *digest, int keylen, unsigned char *out) crypto/evp/p5_crpt2.c:92:31: Binary operation: ([1, 9223372036854775806] + 1):signed32 by call to `PKCS5_PBKDF2_HMAC` 90. } 91. memcpy(p, digtmp, cplen); 92. for (j = 1; j < iter; j++) { ^ 93. if (!HMAC_CTX_copy(hctx, hctx_tpl)) { 94. HMAC_CTX_free(hctx);
https://github.com/openssl/openssl/blob/1bc563caa144a568fc505f210568f5ac5b66315e/crypto/evp/p5_crpt2.c/#L92
d2a_code_trace_data_45193
static void decode(Real288_internal *glob, unsigned int input) { unsigned int x,y; float f; double sum,sumsum; float *p1,*p2; float buffer[5]; const float *table; for (x=36;x--;glob->sb[x+5]=glob->sb[x]); for (x=5;x--;) { p1=glob->sb+x;p2=glob->pr1; for (sum=0,y=36;y--;sum-=(*(++p1))*(*(p2++))); glob->sb[x]=sum; } f=amptable[input&7]; table=codetable+(input>>3)*5; for (sum=32,x=10;x--;sum-=glob->pr2[x]*glob->lhist[x]); if (sum<0) sum=0; else if (sum>60) sum=60; sumsum=exp(sum*0.1151292546497)*f; for (sum=0,x=5;x--;) { buffer[x]=table[x]*sumsum; sum+=buffer[x]*buffer[x]; } if ((sum/=5)<1) sum=1; for (x=10;--x;glob->lhist[x]=glob->lhist[x-1]); *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); for (x=0;x<5;x++) { f=glob->sb[4-x]+buffer[x]; if (f>4095) f=4095; else if (f<-4095) f=-4095; glob->output[glob->phasep+x]=glob->sb[4-x]=f; } } libavcodec/ra288.c:122: error: Uninitialized Value The value read from buffer[_] was never initialized. libavcodec/ra288.c:122:34: 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra288.c/#L122
d2a_code_trace_data_45194
static int decode_mb_i(AVSContext *h, int cbp_code) { GetBitContext *gb = &h->s.gb; int block, pred_mode_uv; uint8_t top[18]; uint8_t *left = NULL; uint8_t *d; ff_cavs_init_mb(h); for(block=0;block<4;block++) { int nA,nB,predpred; int pos = ff_cavs_scan3x3[block]; nA = h->pred_mode_Y[pos-1]; nB = h->pred_mode_Y[pos-3]; predpred = FFMIN(nA,nB); if(predpred == NOT_AVAIL) predpred = INTRA_L_LP; if(!get_bits1(gb)){ int rem_mode= get_bits(gb, 2); predpred = rem_mode + (rem_mode >= predpred); } h->pred_mode_Y[pos] = predpred; } pred_mode_uv = get_ue_golomb(gb); if(pred_mode_uv > 6) { av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n"); return -1; } ff_cavs_modify_mb_i(h, &pred_mode_uv); if(h->pic_type == FF_I_TYPE) cbp_code = get_ue_golomb(gb); if(cbp_code > 63){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n"); return -1; } h->cbp = cbp_tab[cbp_code][0]; if(h->cbp && !h->qp_fixed) h->qp = (h->qp + get_se_golomb(gb)) & 63; for(block=0;block<4;block++) { d = h->cy + h->luma_scan[block]; ff_cavs_load_intra_pred_luma(h, top, &left, block); h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]] (d, top, left, h->l_stride); if(h->cbp & (1<<block)) decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride); } ff_cavs_load_intra_pred_chroma(h); h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10], h->left_border_u, h->c_stride); h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10], h->left_border_v, h->c_stride); decode_residual_chroma(h); ff_cavs_filter(h,I_8X8); set_mv_intra(h); return 0; } libavcodec/cavsdec.c:529: error: Buffer Overrun L3 Offset: [-3, +oo] Size: 9 by call to `decode_mb_i`. libavcodec/cavsdec.c:529:13: Call 527. if(h->pic_type == FF_I_TYPE) { 528. do { 529. decode_mb_i(h, 0); ^ 530. } while(ff_cavs_next_mb(h)); 531. } else if(h->pic_type == FF_P_TYPE) { libavcodec/cavsdec.c:189:1: <Offset trace> 187. ****************************************************************************/ 188. 189. static int decode_mb_i(AVSContext *h, int cbp_code) { ^ 190. GetBitContext *gb = &h->s.gb; 191. int block, pred_mode_uv; libavcodec/cavsdec.c:189:1: Global `ff_cavs_scan3x3` 187. ****************************************************************************/ 188. 189. static int decode_mb_i(AVSContext *h, int cbp_code) { ^ 190. GetBitContext *gb = &h->s.gb; 191. int block, pred_mode_uv; libavcodec/cavsdec.c:201:9: Assignment 199. for(block=0;block<4;block++) { 200. int nA,nB,predpred; 201. int pos = ff_cavs_scan3x3[block]; ^ 202. 203. nA = h->pred_mode_Y[pos-1]; libavcodec/cavsdec.c:189:1: <Length trace> 187. ****************************************************************************/ 188. 189. static int decode_mb_i(AVSContext *h, int cbp_code) { ^ 190. GetBitContext *gb = &h->s.gb; 191. int block, pred_mode_uv; libavcodec/cavsdec.c:189:1: Parameter `h->pred_mode_Y[*]` 187. ****************************************************************************/ 188. 189. static int decode_mb_i(AVSContext *h, int cbp_code) { ^ 190. GetBitContext *gb = &h->s.gb; 191. int block, pred_mode_uv; libavcodec/cavsdec.c:204:14: Array access: Offset: [-3, +oo] Size: 9 by call to `decode_mb_i` 202. 203. nA = h->pred_mode_Y[pos-1]; 204. nB = h->pred_mode_Y[pos-3]; ^ 205. predpred = FFMIN(nA,nB); 206. if(predpred == NOT_AVAIL) // if either is not available
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/cavsdec.c/#L204
d2a_code_trace_data_45195
static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) { int i; LHASH_NODE *a,*n; if (lh == NULL) return; for (i=lh->num_nodes-1; i>=0; i--) { a=lh->b[i]; while (a != NULL) { n=a->next; if(use_arg) func_arg(a->data,arg); else func(a->data); a=n; } } } apps/s_client.c:1899: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 15 steps of the trace apps/s_client.c:1104:6: Call 1102. #endif 1103. 1104. ctx=SSL_CTX_new(meth); ^ 1105. if (ctx == NULL) 1106. { ssl/ssl_lib.c:1759:16: Call 1757. ret->app_verify_cookie_cb=0; 1758. 1759. ret->sessions=lh_SSL_SESSION_new(); ^ 1760. if (ret->sessions == NULL) goto err; 1761. ret->cert_store=X509_STORE_new(); crypto/lhash/lhash.c:127:2: Assignment 125. ret->comp=((c == NULL)?(LHASH_COMP_FN_TYPE)strcmp:c); 126. ret->hash=((h == NULL)?(LHASH_HASH_FN_TYPE)lh_strhash:h); 127. ret->num_nodes=MIN_NODES/2; ^ 128. ret->num_alloc_nodes=MIN_NODES; 129. ret->p=0; apps/s_client.c:1899:3: Call 1897. if (prexit != 0) 1898. print_stuff(bio_c_out,con,1); 1899. SSL_free(con); ^ 1900. } 1901. #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) ssl/ssl_lib.c:505:1: Parameter `s->initial_ctx->sessions->num_nodes` 503. } 504. 505. > void SSL_free(SSL *s) 506. { 507. int i; ssl/ssl_lib.c:568:22: Call 566. if (s->tlsext_hostname) 567. OPENSSL_free(s->tlsext_hostname); 568. if (s->initial_ctx) SSL_CTX_free(s->initial_ctx); ^ 569. #ifndef OPENSSL_NO_EC 570. if (s->tlsext_ecpointformatlist) OPENSSL_free(s->tlsext_ecpointformatlist); ssl/ssl_lib.c:1899:1: Parameter `a->sessions->num_nodes` 1897. #endif 1898. 1899. > void SSL_CTX_free(SSL_CTX *a) 1900. { 1901. int i; ssl/ssl_lib.c:1931:3: Call 1929. */ 1930. if (a->sessions != NULL) 1931. SSL_CTX_flush_sessions(a,0); ^ 1932. 1933. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes` 983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM) 984. 985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 986. { 987. unsigned long i; ssl/ssl_sess.c:997:2: Call 995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; 996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0; 997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), ^ 998. TIMEOUT_PARAM, &tp); 999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i; crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes` 303. } 304. 305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); crypto/lhash/lhash.c:307:2: Call 305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); ^ 308. } 309. crypto/lhash/lhash.c:270:1: <LHS trace> 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes` 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:281:7: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 279. /* reverse the order so we search from 'top to bottom' 280. * We were having memory leaks otherwise */ 281. for (i=lh->num_nodes-1; i>=0; i--) ^ 282. { 283. a=lh->b[i];
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281
d2a_code_trace_data_45196
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; EightBpsContext * const c = avctx->priv_data; const unsigned char *encoded = buf; unsigned char *pixptr, *pixptr_end; unsigned int height = avctx->height; unsigned int dlen, p, row; const unsigned char *lp, *dp, *ep; unsigned char count; unsigned int px_inc; unsigned int planes = c->planes; unsigned char *planemap = c->planemap; int ret; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } ep = encoded + buf_size; dp = encoded + planes * (height << 1); if (planes == 4) planes--; px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_RGB32); for (p = 0; p < planes; p++) { lp = encoded + p * (height << 1); for (row = 0; row < height; row++) { pixptr = frame->data[0] + row * frame->linesize[0] + planemap[p]; pixptr_end = pixptr + frame->linesize[0]; if (ep - lp < row * 2 + 2) return AVERROR_INVALIDDATA; dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2)); while (dlen > 0) { if (ep - dp <= 1) return AVERROR_INVALIDDATA; if ((count = *dp++) <= 127) { count++; dlen -= count + 1; if (pixptr_end - pixptr < count * px_inc) break; if (ep - dp < count) return AVERROR_INVALIDDATA; while (count--) { *pixptr = *dp++; pixptr += px_inc; } } else { count = 257 - count; if (pixptr_end - pixptr < count * px_inc) break; while (count--) { *pixptr = *dp; pixptr += px_inc; } dp++; dlen -= 2; } } } } if (avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { frame->palette_has_changed = 1; memcpy(c->pal, pal, AVPALETTE_SIZE); } memcpy (frame->data[1], c->pal, AVPALETTE_SIZE); } *got_frame = 1; return buf_size; } libavcodec/8bps.c:107: error: Integer Overflow L2 ([1, +oo] - [`*avpkt->data` + 2, 2+min(127, `*avpkt->data`)]):unsigned32. libavcodec/8bps.c:56:1: <LHS trace> 54. } EightBpsContext; 55. 56. static int decode_frame(AVCodecContext *avctx, void *data, ^ 57. int *got_frame, AVPacket *avpkt) 58. { libavcodec/8bps.c:56:1: Parameter `*avpkt->data` 54. } EightBpsContext; 55. 56. static int decode_frame(AVCodecContext *avctx, void *data, ^ 57. int *got_frame, AVPacket *avpkt) 58. { libavcodec/8bps.c:105:22: Assignment 103. if (ep - dp <= 1) 104. return AVERROR_INVALIDDATA; 105. if ((count = *dp++) <= 127) { ^ 106. count++; 107. dlen -= count + 1; libavcodec/8bps.c:106:21: Assignment 104. return AVERROR_INVALIDDATA; 105. if ((count = *dp++) <= 127) { 106. count++; ^ 107. dlen -= count + 1; 108. if (pixptr_end - pixptr < count * px_inc) libavcodec/8bps.c:107:21: Assignment 105. if ((count = *dp++) <= 127) { 106. count++; 107. dlen -= count + 1; ^ 108. if (pixptr_end - pixptr < count * px_inc) 109. break; libavcodec/8bps.c:56:1: <RHS trace> 54. } EightBpsContext; 55. 56. static int decode_frame(AVCodecContext *avctx, void *data, ^ 57. int *got_frame, AVPacket *avpkt) 58. { libavcodec/8bps.c:56:1: Parameter `*avpkt->data` 54. } EightBpsContext; 55. 56. static int decode_frame(AVCodecContext *avctx, void *data, ^ 57. int *got_frame, AVPacket *avpkt) 58. { libavcodec/8bps.c:105:22: Assignment 103. if (ep - dp <= 1) 104. return AVERROR_INVALIDDATA; 105. if ((count = *dp++) <= 127) { ^ 106. count++; 107. dlen -= count + 1; libavcodec/8bps.c:106:21: Assignment 104. return AVERROR_INVALIDDATA; 105. if ((count = *dp++) <= 127) { 106. count++; ^ 107. dlen -= count + 1; 108. if (pixptr_end - pixptr < count * px_inc) libavcodec/8bps.c:107:21: Binary operation: ([1, +oo] - [*avpkt->data + 2, 2+min(127, *avpkt->data)]):unsigned32 105. if ((count = *dp++) <= 127) { 106. count++; 107. dlen -= count + 1; ^ 108. if (pixptr_end - pixptr < count * px_inc) 109. break;
https://github.com/libav/libav/blob/582963a8156522582e55466be4a59974a8d909a5/libavcodec/8bps.c/#L107
d2a_code_trace_data_45197
int test_div(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_zero(b); if (BN_div(d, c, a, b, ctx)) { fprintf(stderr, "Division by zero succeeded!\n"); return 0; } 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_div(d, c, a, b, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, 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, "Division test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:509: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 457, column 9 is not reachable after line 509, column 5. Showing all 186 steps of the trace test/bntest.c:449:1: start of procedure test_div() 447. } 448. 449. > int test_div(BIO *bp, BN_CTX *ctx) 450. { 451. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:454:5: 452. int i; 453. 454. > a = BN_new(); 455. b = BN_new(); 456. 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:455:5: 453. 454. a = BN_new(); 455. > b = BN_new(); 456. c = BN_new(); 457. 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:456:5: 454. a = BN_new(); 455. b = BN_new(); 456. > c = BN_new(); 457. d = BN_new(); 458. 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:457:5: 455. b = BN_new(); 456. c = BN_new(); 457. > d = BN_new(); 458. e = BN_new(); 459. 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:458:5: 456. c = BN_new(); 457. d = BN_new(); 458. > e = BN_new(); 459. 460. BN_one(a); 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:460:5: 458. e = BN_new(); 459. 460. > BN_one(a); 461. BN_zero(b); 462. 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:461:5: 459. 460. BN_one(a); 461. > BN_zero(b); 462. 463. if (BN_div(d, c, a, b, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:463:9: Taking false branch 461. BN_zero(b); 462. 463. if (BN_div(d, c, a, b, ctx)) { ^ 464. fprintf(stderr, "Division by zero succeeded!\n"); 465. return 0; test/bntest.c:468:10: 466. } 467. 468. > for (i = 0; i < num0 + num1; i++) { 469. if (i < num1) { 470. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:468:17: Loop condition is false. Leaving loop 466. } 467. 468. for (i = 0; i < num0 + num1; i++) { ^ 469. if (i < num1) { 470. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:506:5: 504. } 505. } 506. > BN_free(a); 507. BN_free(b); 508. 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:507:5: 505. } 506. BN_free(a); 507. > BN_free(b); 508. BN_free(c); 509. 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:508:5: 506. BN_free(a); 507. BN_free(b); 508. > BN_free(c); 509. BN_free(d); 510. 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) test/bntest.c:509:5: 507. BN_free(b); 508. BN_free(c); 509. > BN_free(d); 510. BN_free(e); 511. return (1); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L509
d2a_code_trace_data_45198
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1074: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 21]):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:1074:14: Call 1072. /* Add SRP username if there is one */ 1073. if (s->srp_ctx.login != NULL) { 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) ^ 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:242:1: Parameter `pkt->written` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/packet.c:250:17: Call 248. 249. if (size > sizeof(unsigned int) 250. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 251. || !put_value(data, val, size)) 252. return 0; ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->tlsext_hostname->strlen + 21]):unsigned64 by call to `WPACKET_put_bytes__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25
d2a_code_trace_data_45199
static void BN_POOL_release(BN_POOL *p, unsigned int num) { unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; p->used -= num; while (num--) { bn_check_top(p->current->vals + offset); if (offset == 0) { offset = BN_CTX_POOL_SIZE - 1; p->current = p->current->prev; } else offset--; } } crypto/rsa/rsa_sp800_56b_gen.c:208: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 40 steps of the trace crypto/rsa/rsa_sp800_56b_gen.c:196:9: Call 194. 195. /* LCM((p-1, q-1)) */ 196. if (rsa_get_lcm(ctx, rsa->p, rsa->q, lcm, gcd, p1, q1, p1q1) != 1) ^ 197. goto err; 198. crypto/rsa/rsa_sp800_56b_check.c:220:1: Parameter `ctx->pool.used` 218. 219. /* return LCM(p-1, q-1) */ 220. > int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q, 221. BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1, 222. BIGNUM *p1q1) crypto/rsa/rsa_sp800_56b_gen.c:208:27: Call 206. /* (Step 3) d = (e^-1) mod (LCM(p-1, q-1)) */ 207. rsa->d = BN_secure_new(); 208. if (rsa->d == NULL || BN_mod_inverse(rsa->d, e, lcm, ctx) == NULL) ^ 209. goto err; 210. crypto/bn/bn_gcd.c:124:1: Parameter `ctx->pool.used` 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->pool.used` 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->pool.used` 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: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->pool.used` 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->pool.used` 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->pool.used` 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->pool.used` 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->pool.used` 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->pool.used` 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->pool.used` 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->pool.used` 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->pool.used` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `ctx->pool.used` 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:282:11: Call 280. BN_CTX_start(ctx); 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); ^ 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:283:12: Call 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); ^ 284. sdiv = BN_CTX_get(ctx); 285. if (sdiv == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:284:12: Call 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); ^ 285. if (sdiv == NULL) 286. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:194:13: Call 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) 194. BN_POOL_release(&ctx->pool, ctx->used - fp); ^ 195. ctx->used = fp; 196. /* Unjam "too_many" in case "get" had failed */ crypto/bn/bn_ctx.c:338:1: <LHS trace> 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:338:1: Parameter `p->used` 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:340:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse` 338. static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; ^ 341. 342. p->used -= num;
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L340
d2a_code_trace_data_45200
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:1819: error: Buffer Overrun L1 Offset: 8 Size: 4 by call to `ff_epzs_motion_search`. libavcodec/motion_est.c:1819:12: Call 1817. } 1818. 1819. dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, mv_table, 1<<(16-shift), 0, 16); ^ 1820. if(c->sub_flags&FLAG_QPEL) 1821. dmin = qpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); libavcodec/motion_est_template.c:1116:1: Parameter `ref_index` 1114. 1115. //this function is dedicated to the braindamaged gcc 1116. inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 1117. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 1118. int ref_mv_scale, int size, int h) libavcodec/motion_est_template.c:1123:16: Call 1121. //FIXME convert other functions in the same way if faster 1122. if(c->flags==0 && h==16 && size==0){ 1123. return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16); ^ 1124. // case FLAG_QPEL: 1125. // return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, FLAG_QPEL); libavcodec/motion_est_template.c:999:1: Parameter `ref_index` 997. optimal mv. 998. */ 999. static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 1000. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 1001. int ref_mv_scale, int flags, int size, int h) libavcodec/motion_est_template.c:1105:11: Call 1103. 1104. //check(best[0],best[1],0, b0) 1105. dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 1106. 1107. //check(best[0],best[1],0, b1) libavcodec/motion_est_template.c:973:1: Parameter `ref_index` 971. } 972. 973. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, ^ 974. int src_index, int ref_index, int const penalty_factor, 975. int size, int h, int flags){ libavcodec/motion_est_template.c:990:18: Call 988. return l2s_dia_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); 989. else 990. return var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 991. } 992. libavcodec/motion_est_template.c:896:1: Parameter `ref_index` 894. } 895. 896. static int var_diamond_search(MpegEncContext * s, int *best, int dmin, ^ 897. int src_index, int ref_index, int const penalty_factor, 898. int size, int h, int flags) libavcodec/motion_est_template.c:921:13: Call 919. 920. //check(x + dir,y + dia_size - dir,0, a0) 921. CHECK_MV(x + dir , y + dia_size - dir); ^ 922. } 923. 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 Size: 4 by call to `ff_epzs_motion_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_45201
DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], long length, int out_count, des_cblock *seed) { DES_LONG z0,z1,t0,t1; int i; long l; const unsigned char *cp; #ifdef _CRAY short *lp; #else DES_LONG *lp; #endif if (out_count < 1) out_count=1; lp = (DES_LONG *) &(output[0])[0]; z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); for (i=0; ((i<4)&&(i<out_count)); i++) { cp=input; l=length; while (l > 0) { if (l > 1) { t0= (DES_LONG)(*(cp++)); t0|=(DES_LONG)Q_B1(*(cp++)); l--; } else t0= (DES_LONG)(*(cp++)); l--; t0+=z0; t0&=0xffffffffL; t1=z1; z0=((((t0*t0)&0xffffffffL)+((t1*t1)&0xffffffffL)) &0xffffffffL)%0x7fffffffL; z1=((t0*((t1+NOISE)&0xffffffffL))&0xffffffffL)%0x7fffffffL; } if (lp != NULL) { *lp++ = z0; *lp++ = z1; } } return(z0); } crypto/des/qud_cksm.c:124: error: BUFFER_OVERRUN_L1 Offset: [1, +oo] Size: 1. Showing all 5 steps of the trace crypto/des/qud_cksm.c:76:1: <Length trace> 74. #define NOISE ((DES_LONG)83653421L) 75. 76. > DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], 77. long length, int out_count, des_cblock *seed) 78. { crypto/des/qud_cksm.c:76:1: Parameter `(*output)[*]` 74. #define NOISE ((DES_LONG)83653421L) 75. 76. > DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], 77. long length, int out_count, des_cblock *seed) 78. { crypto/des/qud_cksm.c:90:2: Assignment 88. 89. if (out_count < 1) out_count=1; 90. lp = (DES_LONG *) &(output[0])[0]; ^ 91. 92. z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); crypto/des/qud_cksm.c:123:5: Assignment 121. /* The MIT library assumes that the checksum is 122. * composed of 2*out_count 32 bit ints */ 123. *lp++ = z0; ^ 124. *lp++ = z1; 125. } crypto/des/qud_cksm.c:124:4: Array access: Offset: [1, +oo] Size: 1 122. * composed of 2*out_count 32 bit ints */ 123. *lp++ = z0; 124. *lp++ = z1; ^ 125. } 126. }
https://github.com/openssl/openssl/blob/1f39d082c64e2fa8367b93bbf50a622f33fb7061/crypto/des/qud_cksm.c/#L124
d2a_code_trace_data_45202
static void info_cb(const SSL *s, int where, int ret) { if (where & SSL_CB_ALERT) { HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (where & SSL_CB_WRITE) { ex_data->alert_sent = ret; } else { ex_data->alert_received = ret; } } } test/handshake_helper.c:71: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 68 could be null and is dereferenced at line 71, column 13. Showing all 12 steps of the trace test/handshake_helper.c:65:1: start of procedure info_cb() 63. static int ex_data_idx; 64. 65. > static void info_cb(const SSL *s, int where, int ret) 66. { 67. if (where & SSL_CB_ALERT) { test/handshake_helper.c:67:9: Taking true branch 65. static void info_cb(const SSL *s, int where, int ret) 66. { 67. if (where & SSL_CB_ALERT) { ^ 68. HANDSHAKE_EX_DATA *ex_data = 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); test/handshake_helper.c:68:9: 66. { 67. if (where & SSL_CB_ALERT) { 68. > HANDSHAKE_EX_DATA *ex_data = 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 70. if (where & SSL_CB_WRITE) { ssl/ssl_lib.c:3496:1: start of procedure SSL_get_ex_data() 3494. } 3495. 3496. > void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3498:5: 3496. void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. } 3500. crypto/ex_data.c:369:1: start of procedure CRYPTO_get_ex_data() 367. * particular index in the class used by this variable 368. */ 369. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:371:9: Taking true branch 369. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 372. return NULL; 373. return sk_void_value(ad->sk, idx); crypto/ex_data.c:372:9: 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 372. > return NULL; 373. return sk_void_value(ad->sk, idx); 374. } crypto/ex_data.c:374:1: return from a call to CRYPTO_get_ex_data 372. return NULL; 373. return sk_void_value(ad->sk, idx); 374. > } ssl/ssl_lib.c:3499:1: return from a call to SSL_get_ex_data 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. > } 3500. 3501. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:70:13: Taking true branch 68. HANDSHAKE_EX_DATA *ex_data = 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 70. if (where & SSL_CB_WRITE) { ^ 71. ex_data->alert_sent = ret; 72. } else { test/handshake_helper.c:71:13: 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 70. if (where & SSL_CB_WRITE) { 71. > ex_data->alert_sent = ret; 72. } else { 73. ex_data->alert_received = ret;
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L71
d2a_code_trace_data_45203
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_oct.c:86: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add_quick`. Showing all 16 steps of the trace crypto/ec/ecp_oct.c:62:14: Call 60. if (!BN_mod_sqr(tmp2, x_, group->field, ctx)) 61. goto err; 62. if (!BN_mod_mul(tmp1, tmp2, x_, group->field, ctx)) ^ 63. goto err; 64. } crypto/bn/bn_mod.c:127:1: Parameter `r->top` 125. 126. /* slow but works */ 127. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 128. BN_CTX *ctx) 129. { crypto/ec/ecp_oct.c:86:14: Call 84. } 85. 86. if (!BN_mod_add_quick(tmp1, tmp1, tmp2, group->field)) ^ 87. goto err; 88. } crypto/bn/bn_mod.c:93:1: Parameter `*r->d` 91. } 92. 93. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 94. const BIGNUM *m) 95. { crypto/bn/bn_mod.c:96:15: Call 94. const BIGNUM *m) 95. { 96. int ret = bn_mod_add_fixed_top(r, a, b, m); ^ 97. 98. if (ret) crypto/bn/bn_mod.c:48:1: Parameter `*r->d` 46. * move depending on whether or not subtraction borrowed. 47. */ 48. > int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 49. const BIGNUM *m) 50. { crypto/bn/bn_mod.c:56:9: Call 54. const BN_ULONG *ap, *bp; 55. 56. if (bn_wexpand(r, mtop) == NULL) ^ 57. return 0; 58. crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:245:1: Parameter `*b->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_mod_add_quick` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45204
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:1098: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1098:20: 1096. int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; 1097. 1098. if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; ^ 1099. CHECK_MV(mx,my) 1100. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1098
d2a_code_trace_data_45205
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) { if(min_size < *size) return ptr; *size= FFMAX(17*min_size/16 + 32, min_size); ptr= av_realloc(ptr, *size); if(!ptr) *size= 0; return ptr; } libavformat/utils.c:1058: error: Integer Overflow L2 ([0, 73014443352] + 32):unsigned32 by call to `av_fast_realloc`. libavformat/utils.c:1049:1: Parameter `st->nb_index_entries` 1047. } 1048. 1049. int av_add_index_entry(AVStream *st, ^ 1050. int64_t pos, int64_t timestamp, int size, int distance, int flags) 1051. { libavformat/utils.c:1058:15: Call 1056. return -1; 1057. 1058. entries = av_fast_realloc(st->index_entries, ^ 1059. &st->index_entries_allocated_size, 1060. (st->nb_index_entries + 1) * libavcodec/utils.c:62:1: <LHS trace> 60. static int volatile entangled_thread_counter=0; 61. 62. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) ^ 63. { 64. if(min_size < *size) libavcodec/utils.c:62:1: Parameter `min_size` 60. static int volatile entangled_thread_counter=0; 61. 62. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) ^ 63. { 64. if(min_size < *size) libavcodec/utils.c:67:12: Binary operation: ([0, 73014443352] + 32):unsigned32 by call to `av_fast_realloc` 65. return ptr; 66. 67. *size= FFMAX(17*min_size/16 + 32, min_size); ^ 68. 69. ptr= av_realloc(ptr, *size);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/utils.c/#L67
d2a_code_trace_data_45206
static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx, AVCodecContext *avctx) { int p, luma_width, luma_height, chroma_width, chroma_height; int luma_pitch, chroma_pitch, luma_size, chroma_size; luma_width = ctx->width; luma_height = ctx->height; if (luma_width < 16 || luma_width > 640 || luma_height < 16 || luma_height > 480 || luma_width & 3 || luma_height & 3) { av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n", luma_width, luma_height); return AVERROR_INVALIDDATA; } chroma_width = FFALIGN(luma_width >> 2, 4); chroma_height = FFALIGN(luma_height >> 2, 4); luma_pitch = FFALIGN(luma_width, 16); chroma_pitch = FFALIGN(chroma_width, 16); luma_size = luma_pitch * (luma_height + 1); chroma_size = chroma_pitch * (chroma_height + 1); for (p = 0; p < 3; p++) { ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; ctx->planes[p].width = !p ? luma_width : chroma_width; ctx->planes[p].height = !p ? luma_height : chroma_height; ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); memset(ctx->planes[p].buffers[0], 0x40, ctx->planes[p].pitch); memset(ctx->planes[p].buffers[1], 0x40, ctx->planes[p].pitch); ctx->planes[p].pixels[0] = ctx->planes[p].buffers[0] + ctx->planes[p].pitch; ctx->planes[p].pixels[1] = ctx->planes[p].buffers[1] + ctx->planes[p].pitch; } return 0; } libavcodec/indeo3.c:191: error: Null Dereference pointer `ctx->planes[p].buffers[1]` last assigned on line 187 could be null and is dereferenced by call to `memset()` at line 191, column 9. libavcodec/indeo3.c:149:1: start of procedure allocate_frame_buffers() 147. 148. 149. static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx, ^ 150. AVCodecContext *avctx) 151. { libavcodec/indeo3.c:155:5: 153. int luma_pitch, chroma_pitch, luma_size, chroma_size; 154. 155. luma_width = ctx->width; ^ 156. luma_height = ctx->height; 157. libavcodec/indeo3.c:156:5: 154. 155. luma_width = ctx->width; 156. luma_height = ctx->height; ^ 157. 158. if (luma_width < 16 || luma_width > 640 || libavcodec/indeo3.c:158:9: Taking false branch 156. luma_height = ctx->height; 157. 158. if (luma_width < 16 || luma_width > 640 || ^ 159. luma_height < 16 || luma_height > 480 || 160. luma_width & 3 || luma_height & 3) { libavcodec/indeo3.c:158:29: Taking false branch 156. luma_height = ctx->height; 157. 158. if (luma_width < 16 || luma_width > 640 || ^ 159. luma_height < 16 || luma_height > 480 || 160. luma_width & 3 || luma_height & 3) { libavcodec/indeo3.c:159:9: Taking false branch 157. 158. if (luma_width < 16 || luma_width > 640 || 159. luma_height < 16 || luma_height > 480 || ^ 160. luma_width & 3 || luma_height & 3) { 161. av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n", libavcodec/indeo3.c:159:29: Taking false branch 157. 158. if (luma_width < 16 || luma_width > 640 || 159. luma_height < 16 || luma_height > 480 || ^ 160. luma_width & 3 || luma_height & 3) { 161. av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n", libavcodec/indeo3.c:160:9: Taking false branch 158. if (luma_width < 16 || luma_width > 640 || 159. luma_height < 16 || luma_height > 480 || 160. luma_width & 3 || luma_height & 3) { ^ 161. av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n", 162. luma_width, luma_height); libavcodec/indeo3.c:160:29: Taking false branch 158. if (luma_width < 16 || luma_width > 640 || 159. luma_height < 16 || luma_height > 480 || 160. luma_width & 3 || luma_height & 3) { ^ 161. av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n", 162. luma_width, luma_height); libavcodec/indeo3.c:166:5: 164. } 165. 166. chroma_width = FFALIGN(luma_width >> 2, 4); ^ 167. chroma_height = FFALIGN(luma_height >> 2, 4); 168. libavcodec/indeo3.c:167:5: 165. 166. chroma_width = FFALIGN(luma_width >> 2, 4); 167. chroma_height = FFALIGN(luma_height >> 2, 4); ^ 168. 169. luma_pitch = FFALIGN(luma_width, 16); libavcodec/indeo3.c:169:5: 167. chroma_height = FFALIGN(luma_height >> 2, 4); 168. 169. luma_pitch = FFALIGN(luma_width, 16); ^ 170. chroma_pitch = FFALIGN(chroma_width, 16); 171. libavcodec/indeo3.c:170:5: 168. 169. luma_pitch = FFALIGN(luma_width, 16); 170. chroma_pitch = FFALIGN(chroma_width, 16); ^ 171. 172. /* Calculate size of the luminance plane. */ libavcodec/indeo3.c:174:5: 172. /* Calculate size of the luminance plane. */ 173. /* Add one line more for INTRA prediction. */ 174. luma_size = luma_pitch * (luma_height + 1); ^ 175. 176. /* Calculate size of a chrominance planes. */ libavcodec/indeo3.c:178:5: 176. /* Calculate size of a chrominance planes. */ 177. /* Add one line more for INTRA prediction. */ 178. chroma_size = chroma_pitch * (chroma_height + 1); ^ 179. 180. /* allocate frame buffers */ libavcodec/indeo3.c:181:10: 179. 180. /* allocate frame buffers */ 181. for (p = 0; p < 3; p++) { ^ 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; libavcodec/indeo3.c:181:17: Loop condition is true. Entering loop body 179. 180. /* allocate frame buffers */ 181. for (p = 0; p < 3; p++) { ^ 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; libavcodec/indeo3.c:182:34: Condition is true 180. /* allocate frame buffers */ 181. for (p = 0; p < 3; p++) { 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; ^ 183. ctx->planes[p].width = !p ? luma_width : chroma_width; 184. ctx->planes[p].height = !p ? luma_height : chroma_height; libavcodec/indeo3.c:182:33: 180. /* allocate frame buffers */ 181. for (p = 0; p < 3; p++) { 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; ^ 183. ctx->planes[p].width = !p ? luma_width : chroma_width; 184. ctx->planes[p].height = !p ? luma_height : chroma_height; libavcodec/indeo3.c:182:9: 180. /* allocate frame buffers */ 181. for (p = 0; p < 3; p++) { 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; ^ 183. ctx->planes[p].width = !p ? luma_width : chroma_width; 184. ctx->planes[p].height = !p ? luma_height : chroma_height; libavcodec/indeo3.c:183:34: Condition is true 181. for (p = 0; p < 3; p++) { 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; ^ 184. ctx->planes[p].height = !p ? luma_height : chroma_height; 185. libavcodec/indeo3.c:183:33: 181. for (p = 0; p < 3; p++) { 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; ^ 184. ctx->planes[p].height = !p ? luma_height : chroma_height; 185. libavcodec/indeo3.c:183:9: 181. for (p = 0; p < 3; p++) { 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; ^ 184. ctx->planes[p].height = !p ? luma_height : chroma_height; 185. libavcodec/indeo3.c:184:34: Condition is true 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; 184. ctx->planes[p].height = !p ? luma_height : chroma_height; ^ 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); libavcodec/indeo3.c:184:33: 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; 184. ctx->planes[p].height = !p ? luma_height : chroma_height; ^ 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); libavcodec/indeo3.c:184:9: 182. ctx->planes[p].pitch = !p ? luma_pitch : chroma_pitch; 183. ctx->planes[p].width = !p ? luma_width : chroma_width; 184. ctx->planes[p].height = !p ? luma_height : chroma_height; ^ 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); libavcodec/indeo3.c:186:48: Condition is true 184. ctx->planes[p].height = !p ? luma_height : chroma_height; 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); ^ 187. ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); 188. libavcodec/indeo3.c:186:47: 184. ctx->planes[p].height = !p ? luma_height : chroma_height; 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); ^ 187. ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); 188. libavcodec/indeo3.c:186:9: 184. ctx->planes[p].height = !p ? luma_height : chroma_height; 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); ^ 187. ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); 188. libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking true branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(32,size); libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/indeo3.c:187:48: Condition is true 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); 187. ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); ^ 188. 189. /* fill the INTRA prediction lines with the middle pixel value = 64 */ libavcodec/indeo3.c:187:47: 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); 187. ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); ^ 188. 189. /* fill the INTRA prediction lines with the middle pixel value = 64 */ libavcodec/indeo3.c:187:9: 185. 186. ctx->planes[p].buffers[0] = av_malloc(!p ? luma_size : chroma_size); 187. ctx->planes[p].buffers[1] = av_malloc(!p ? luma_size : chroma_size); ^ 188. 189. /* fill the INTRA prediction lines with the middle pixel value = 64 */ libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/indeo3.c:190:9: 188. 189. /* fill the INTRA prediction lines with the middle pixel value = 64 */ 190. memset(ctx->planes[p].buffers[0], 0x40, ctx->planes[p].pitch); ^ 191. memset(ctx->planes[p].buffers[1], 0x40, ctx->planes[p].pitch); 192. libavcodec/indeo3.c:191:9: 189. /* fill the INTRA prediction lines with the middle pixel value = 64 */ 190. memset(ctx->planes[p].buffers[0], 0x40, ctx->planes[p].pitch); 191. memset(ctx->planes[p].buffers[1], 0x40, ctx->planes[p].pitch); ^ 192. 193. /* set buffer pointers = buf_ptr + pitch and thus skip the INTRA prediction line */
https://github.com/libav/libav/blob/594b54b51e9f3af8aac18184d634b85a836b42b6/libavcodec/indeo3.c/#L191
d2a_code_trace_data_45207
static void imdct36(int *out, int *buf, int *in, int *win) { int i, j, t0, t1, t2, t3, s0, s1, s2, s3; int tmp[18], *tmp1, *in1; for(i=17;i>=1;i--) in[i] += in[i-1]; for(i=17;i>=3;i-=2) in[i] += in[i-2]; for(j=0;j<2;j++) { tmp1 = tmp + j; in1 = in + j; #if 0 int64_t t0, t1, t2, t3; t2 = in1[2*4] + in1[2*8] - in1[2*2]; t3 = (in1[2*0] + (int64_t)(in1[2*6]>>1))<<32; t1 = in1[2*0] - in1[2*6]; tmp1[ 6] = t1 - (t2>>1); tmp1[16] = t1 + t2; t0 = MUL64(2*(in1[2*2] + in1[2*4]), C2); t1 = MUL64( in1[2*4] - in1[2*8] , -2*C8); t2 = MUL64(2*(in1[2*2] + in1[2*8]), -C4); tmp1[10] = (t3 - t0 - t2) >> 32; tmp1[ 2] = (t3 + t0 + t1) >> 32; tmp1[14] = (t3 + t2 - t1) >> 32; tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3); t2 = MUL64(2*(in1[2*1] + in1[2*5]), C1); t3 = MUL64( in1[2*5] - in1[2*7] , -2*C7); t0 = MUL64(2*in1[2*3], C3); t1 = MUL64(2*(in1[2*1] + in1[2*7]), -C5); tmp1[ 0] = (t2 + t3 + t0) >> 32; tmp1[12] = (t2 + t1 - t0) >> 32; tmp1[ 8] = (t3 - t1 - t0) >> 32; #else t2 = in1[2*4] + in1[2*8] - in1[2*2]; t3 = in1[2*0] + (in1[2*6]>>1); t1 = in1[2*0] - in1[2*6]; tmp1[ 6] = t1 - (t2>>1); tmp1[16] = t1 + t2; t0 = MULH(2*(in1[2*2] + in1[2*4]), C2); t1 = MULH( in1[2*4] - in1[2*8] , -2*C8); t2 = MULH(2*(in1[2*2] + in1[2*8]), -C4); tmp1[10] = t3 - t0 - t2; tmp1[ 2] = t3 + t0 + t1; tmp1[14] = t3 + t2 - t1; tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3); t2 = MULH(2*(in1[2*1] + in1[2*5]), C1); t3 = MULH( in1[2*5] - in1[2*7] , -2*C7); t0 = MULH(2*in1[2*3], C3); t1 = MULH(2*(in1[2*1] + in1[2*7]), -C5); tmp1[ 0] = t2 + t3 + t0; tmp1[12] = t2 + t1 - t0; tmp1[ 8] = t3 - t1 - t0; #endif } i = 0; for(j=0;j<4;j++) { t0 = tmp[i]; t1 = tmp[i + 2]; s0 = t1 + t0; s2 = t1 - t0; t2 = tmp[i + 1]; t3 = tmp[i + 3]; s1 = MULH(2*(t3 + t2), icos36h[j]); s3 = MULL(t3 - t2, icos36[8 - j]); t0 = s0 + s1; t1 = s0 - s1; out[(9 + j)*SBLIMIT] = MULH(t1, win[9 + j]) + buf[9 + j]; out[(8 - j)*SBLIMIT] = MULH(t1, win[8 - j]) + buf[8 - j]; buf[9 + j] = MULH(t0, win[18 + 9 + j]); buf[8 - j] = MULH(t0, win[18 + 8 - j]); t0 = s2 + s3; t1 = s2 - s3; out[(9 + 8 - j)*SBLIMIT] = MULH(t1, win[9 + 8 - j]) + buf[9 + 8 - j]; out[( j)*SBLIMIT] = MULH(t1, win[ j]) + buf[ j]; buf[9 + 8 - j] = MULH(t0, win[18 + 9 + 8 - j]); buf[ + j] = MULH(t0, win[18 + j]); i += 4; } s0 = tmp[16]; s1 = MULH(2*tmp[17], icos36h[4]); t0 = s0 + s1; t1 = s0 - s1; out[(9 + 4)*SBLIMIT] = MULH(t1, win[9 + 4]) + buf[9 + 4]; out[(8 - 4)*SBLIMIT] = MULH(t1, win[8 - 4]) + buf[8 - 4]; buf[9 + 4] = MULH(t0, win[18 + 9 + 4]); buf[8 - 4] = MULH(t0, win[18 + 8 - 4]); } libavcodec/mpegaudiodec.c:1087: error: Uninitialized Value The value read from tmp[_] was never initialized. libavcodec/mpegaudiodec.c:1087:9: 1085. for(j=0;j<4;j++) { 1086. t0 = tmp[i]; 1087. t1 = tmp[i + 2]; ^ 1088. s0 = t1 + t0; 1089. s2 = t1 - t0;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L1087
d2a_code_trace_data_45208
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_gen.c:355: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 69 steps of the trace crypto/rsa/rsa_sp800_56b_gen.c:342:1: Parameter `ctx->stack.depth` 340. * Returns 1 if the RSA key passes the pairwise test or 0 it it fails. 341. */ 342. > int rsa_sp800_56b_pairwise_test(RSA *rsa, BN_CTX *ctx) 343. { 344. int ret = 0; crypto/rsa/rsa_sp800_56b_gen.c:347:5: Call 345. BIGNUM *k, *tmp; 346. 347. BN_CTX_start(ctx); ^ 348. tmp = BN_CTX_get(ctx); 349. k = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/rsa/rsa_sp800_56b_gen.c:348:11: Call 346. 347. BN_CTX_start(ctx); 348. tmp = BN_CTX_get(ctx); ^ 349. k = BN_CTX_get(ctx); 350. if (k == 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/rsa/rsa_sp800_56b_gen.c:349:9: Call 347. BN_CTX_start(ctx); 348. tmp = BN_CTX_get(ctx); 349. k = BN_CTX_get(ctx); ^ 350. if (k == NULL) 351. 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/rsa/rsa_sp800_56b_gen.c:354:14: Call 352. 353. ret = (BN_set_word(k, 2) 354. && BN_mod_exp(tmp, k, rsa->e, rsa->n, ctx) ^ 355. && BN_mod_exp(tmp, tmp, rsa->d, rsa->n, ctx) 356. && BN_cmp(k, tmp) == 0); crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:141:19: Call 139. && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) { 140. BN_ULONG A = a->d[0]; 141. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); ^ 142. } else 143. # endif crypto/bn/bn_exp.c:1129:1: Parameter `ctx->stack.depth` 1127. } 1128. 1129. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1130. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1131. { crypto/rsa/rsa_sp800_56b_gen.c:355:14: Call 353. ret = (BN_set_word(k, 2) 354. && BN_mod_exp(tmp, k, rsa->e, rsa->n, ctx) 355. && BN_mod_exp(tmp, tmp, rsa->d, rsa->n, ctx) ^ 356. && BN_cmp(k, tmp) == 0); 357. if (ret == 0) crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:141:19: Call 139. && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) { 140. BN_ULONG A = a->d[0]; 141. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); ^ 142. } else 143. # endif crypto/bn/bn_exp.c:1129:1: Parameter `ctx->stack.depth` 1127. } 1128. 1129. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1130. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1131. { crypto/bn/bn_exp.c:1189:5: Call 1187. } 1188. 1189. BN_CTX_start(ctx); ^ 1190. r = BN_CTX_get(ctx); 1191. t = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:1190:9: Call 1188. 1189. BN_CTX_start(ctx); 1190. r = BN_CTX_get(ctx); ^ 1191. t = BN_CTX_get(ctx); 1192. if (t == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:1191:9: Call 1189. BN_CTX_start(ctx); 1190. r = BN_CTX_get(ctx); 1191. t = BN_CTX_get(ctx); ^ 1192. if (t == NULL) 1193. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:1200:14: Call 1198. if ((mont = BN_MONT_CTX_new()) == NULL) 1199. goto err; 1200. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 1201. goto err; 1202. } crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `ctx->stack.depth` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:282:11: Call 280. BN_CTX_start(ctx); 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); ^ 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:283:12: Call 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); ^ 284. sdiv = BN_CTX_get(ctx); 285. if (sdiv == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:284:12: Call 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); ^ 285. if (sdiv == NULL) 286. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45209
int speed_main(int argc, char **argv) { ENGINE *e = NULL; loopargs_t *loopargs = NULL; const char *prog; const char *engine_id = NULL; const EVP_CIPHER *evp_cipher = NULL; double d = 0.0; OPTION_CHOICE o; int async_init = 0, multiblock = 0, pr_header = 0; int doit[ALGOR_NUM] = { 0 }; int ret = 1, misalign = 0, lengths_single = 0, aead = 0; long count = 0; unsigned int size_num = OSSL_NELEM(lengths_list); unsigned int i, k, loop, loopargs_len = 0, async_jobs = 0; int keylen; int buflen; #ifndef NO_FORK int multi = 0; #endif #if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) \ || !defined(OPENSSL_NO_EC) long rsa_count = 1; #endif openssl_speed_sec_t seconds = { SECONDS, RSA_SECONDS, DSA_SECONDS, ECDSA_SECONDS, ECDH_SECONDS, EdDSA_SECONDS }; #ifndef OPENSSL_NO_RC5 RC5_32_KEY rc5_ks; #endif #ifndef OPENSSL_NO_RC2 RC2_KEY rc2_ks; #endif #ifndef OPENSSL_NO_IDEA IDEA_KEY_SCHEDULE idea_ks; #endif #ifndef OPENSSL_NO_SEED SEED_KEY_SCHEDULE seed_ks; #endif #ifndef OPENSSL_NO_BF BF_KEY bf_ks; #endif #ifndef OPENSSL_NO_CAST CAST_KEY cast_ks; #endif static const unsigned char key16[16] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; static const unsigned char key24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char key32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; #ifndef OPENSSL_NO_CAMELLIA static const unsigned char ckey24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char ckey32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; #endif #ifndef OPENSSL_NO_DES static DES_cblock key = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }; static DES_cblock key2 = { 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; static DES_cblock key3 = { 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; #endif #ifndef OPENSSL_NO_RSA static const unsigned int rsa_bits[RSA_NUM] = { 512, 1024, 2048, 3072, 4096, 7680, 15360 }; static const unsigned char *rsa_data[RSA_NUM] = { test512, test1024, test2048, test3072, test4096, test7680, test15360 }; static const int rsa_data_length[RSA_NUM] = { sizeof(test512), sizeof(test1024), sizeof(test2048), sizeof(test3072), sizeof(test4096), sizeof(test7680), sizeof(test15360) }; int rsa_doit[RSA_NUM] = { 0 }; int primes = RSA_DEFAULT_PRIME_NUM; #endif #ifndef OPENSSL_NO_DSA static const unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 }; int dsa_doit[DSA_NUM] = { 0 }; #endif #ifndef OPENSSL_NO_EC static const struct { const char *name; unsigned int nid; unsigned int bits; } test_curves[] = { {"secp160r1", NID_secp160r1, 160}, {"nistp192", NID_X9_62_prime192v1, 192}, {"nistp224", NID_secp224r1, 224}, {"nistp256", NID_X9_62_prime256v1, 256}, {"nistp384", NID_secp384r1, 384}, {"nistp521", NID_secp521r1, 521}, {"nistk163", NID_sect163k1, 163}, {"nistk233", NID_sect233k1, 233}, {"nistk283", NID_sect283k1, 283}, {"nistk409", NID_sect409k1, 409}, {"nistk571", NID_sect571k1, 571}, {"nistb163", NID_sect163r2, 163}, {"nistb233", NID_sect233r1, 233}, {"nistb283", NID_sect283r1, 283}, {"nistb409", NID_sect409r1, 409}, {"nistb571", NID_sect571r1, 571}, {"brainpoolP256r1", NID_brainpoolP256r1, 256}, {"brainpoolP256t1", NID_brainpoolP256t1, 256}, {"brainpoolP384r1", NID_brainpoolP384r1, 384}, {"brainpoolP384t1", NID_brainpoolP384t1, 384}, {"brainpoolP512r1", NID_brainpoolP512r1, 512}, {"brainpoolP512t1", NID_brainpoolP512t1, 512}, {"X25519", NID_X25519, 253}, {"X448", NID_X448, 448} }; static const struct { const char *name; unsigned int nid; unsigned int bits; unsigned int siglen; } test_ed_curves[] = { {"Ed25519", NID_ED25519, 253, 64}, {"Ed448", NID_ED448, 456, 114} }; int ecdsa_doit[ECDSA_NUM] = { 0 }; int ecdh_doit[EC_NUM] = { 0 }; int eddsa_doit[EdDSA_NUM] = { 0 }; OPENSSL_assert(OSSL_NELEM(test_curves) >= EC_NUM); OPENSSL_assert(OSSL_NELEM(test_ed_curves) >= EdDSA_NUM); #endif prog = opt_init(argc, argv, speed_options); while ((o = opt_next()) != OPT_EOF) { switch (o) { case OPT_EOF: case OPT_ERR: opterr: BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); goto end; case OPT_HELP: opt_help(speed_options); ret = 0; goto end; case OPT_ELAPSED: usertime = 0; break; case OPT_EVP: evp_md = NULL; evp_cipher = EVP_get_cipherbyname(opt_arg()); if (evp_cipher == NULL) evp_md = EVP_get_digestbyname(opt_arg()); if (evp_cipher == NULL && evp_md == NULL) { BIO_printf(bio_err, "%s: %s is an unknown cipher or digest\n", prog, opt_arg()); goto end; } doit[D_EVP] = 1; break; case OPT_DECRYPT: decrypt = 1; break; case OPT_ENGINE: engine_id = opt_arg(); break; case OPT_MULTI: #ifndef NO_FORK multi = atoi(opt_arg()); #endif break; case OPT_ASYNCJOBS: #ifndef OPENSSL_NO_ASYNC async_jobs = atoi(opt_arg()); if (!ASYNC_is_capable()) { BIO_printf(bio_err, "%s: async_jobs specified but async not supported\n", prog); goto opterr; } if (async_jobs > 99999) { BIO_printf(bio_err, "%s: too many async_jobs\n", prog); goto opterr; } #endif break; case OPT_MISALIGN: if (!opt_int(opt_arg(), &misalign)) goto end; if (misalign > MISALIGN) { BIO_printf(bio_err, "%s: Maximum offset is %d\n", prog, MISALIGN); goto opterr; } break; case OPT_MR: mr = 1; break; case OPT_MB: multiblock = 1; #ifdef OPENSSL_NO_MULTIBLOCK BIO_printf(bio_err, "%s: -mb specified but multi-block support is disabled\n", prog); goto end; #endif break; case OPT_R_CASES: if (!opt_rand(o)) goto end; break; case OPT_PRIMES: if (!opt_int(opt_arg(), &primes)) goto end; break; case OPT_SECONDS: seconds.sym = seconds.rsa = seconds.dsa = seconds.ecdsa = seconds.ecdh = seconds.eddsa = atoi(opt_arg()); break; case OPT_BYTES: lengths_single = atoi(opt_arg()); lengths = &lengths_single; size_num = 1; break; case OPT_AEAD: aead = 1; break; } } argc = opt_num_rest(); argv = opt_rest(); for (; *argv; argv++) { if (found(*argv, doit_choices, &i)) { doit[i] = 1; continue; } #ifndef OPENSSL_NO_DES if (strcmp(*argv, "des") == 0) { doit[D_CBC_DES] = doit[D_EDE3_DES] = 1; continue; } #endif if (strcmp(*argv, "sha") == 0) { doit[D_SHA1] = doit[D_SHA256] = doit[D_SHA512] = 1; continue; } #ifndef OPENSSL_NO_RSA if (strcmp(*argv, "openssl") == 0) continue; if (strcmp(*argv, "rsa") == 0) { for (loop = 0; loop < OSSL_NELEM(rsa_doit); loop++) rsa_doit[loop] = 1; continue; } if (found(*argv, rsa_choices, &i)) { rsa_doit[i] = 1; continue; } #endif #ifndef OPENSSL_NO_DSA if (strcmp(*argv, "dsa") == 0) { dsa_doit[R_DSA_512] = dsa_doit[R_DSA_1024] = dsa_doit[R_DSA_2048] = 1; continue; } if (found(*argv, dsa_choices, &i)) { dsa_doit[i] = 2; continue; } #endif if (strcmp(*argv, "aes") == 0) { doit[D_CBC_128_AES] = doit[D_CBC_192_AES] = doit[D_CBC_256_AES] = 1; continue; } #ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia") == 0) { doit[D_CBC_128_CML] = doit[D_CBC_192_CML] = doit[D_CBC_256_CML] = 1; continue; } #endif #ifndef OPENSSL_NO_EC if (strcmp(*argv, "ecdsa") == 0) { for (loop = 0; loop < OSSL_NELEM(ecdsa_doit); loop++) ecdsa_doit[loop] = 1; continue; } if (found(*argv, ecdsa_choices, &i)) { ecdsa_doit[i] = 2; continue; } if (strcmp(*argv, "ecdh") == 0) { for (loop = 0; loop < OSSL_NELEM(ecdh_doit); loop++) ecdh_doit[loop] = 1; continue; } if (found(*argv, ecdh_choices, &i)) { ecdh_doit[i] = 2; continue; } if (strcmp(*argv, "eddsa") == 0) { for (loop = 0; loop < OSSL_NELEM(eddsa_doit); loop++) eddsa_doit[loop] = 1; continue; } if (found(*argv, eddsa_choices, &i)) { eddsa_doit[i] = 2; continue; } #endif BIO_printf(bio_err, "%s: Unknown algorithm %s\n", prog, *argv); goto end; } if (aead) { if (evp_cipher == NULL) { BIO_printf(bio_err, "-aead can be used only with an AEAD cipher\n"); goto end; } else if (!(EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) { BIO_printf(bio_err, "%s is not an AEAD cipher\n", OBJ_nid2ln(EVP_CIPHER_nid(evp_cipher))); goto end; } } if (multiblock) { if (evp_cipher == NULL) { BIO_printf(bio_err,"-mb can be used only with a multi-block" " capable cipher\n"); goto end; } else if (!(EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) { BIO_printf(bio_err, "%s is not a multi-block capable\n", OBJ_nid2ln(EVP_CIPHER_nid(evp_cipher))); goto end; } else if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with -mb"); goto end; } } if (async_jobs > 0) { async_init = ASYNC_init_thread(async_jobs, async_jobs); if (!async_init) { BIO_printf(bio_err, "Error creating the ASYNC job pool\n"); goto end; } } loopargs_len = (async_jobs == 0 ? 1 : async_jobs); loopargs = app_malloc(loopargs_len * sizeof(loopargs_t), "array of loopargs"); memset(loopargs, 0, loopargs_len * sizeof(loopargs_t)); for (i = 0; i < loopargs_len; i++) { if (async_jobs > 0) { loopargs[i].wait_ctx = ASYNC_WAIT_CTX_new(); if (loopargs[i].wait_ctx == NULL) { BIO_printf(bio_err, "Error creating the ASYNC_WAIT_CTX\n"); goto end; } } buflen = lengths[size_num - 1]; if (buflen < 36) buflen = 36; buflen += MAX_MISALIGNMENT + 1; loopargs[i].buf_malloc = app_malloc(buflen, "input buffer"); loopargs[i].buf2_malloc = app_malloc(buflen, "input buffer"); memset(loopargs[i].buf_malloc, 0, buflen); memset(loopargs[i].buf2_malloc, 0, buflen); loopargs[i].buf = loopargs[i].buf_malloc + misalign; loopargs[i].buf2 = loopargs[i].buf2_malloc + misalign; #ifndef OPENSSL_NO_EC loopargs[i].secret_a = app_malloc(MAX_ECDH_SIZE, "ECDH secret a"); loopargs[i].secret_b = app_malloc(MAX_ECDH_SIZE, "ECDH secret b"); #endif } #ifndef NO_FORK if (multi && do_multi(multi, size_num)) goto show_res; #endif e = setup_engine(engine_id, 0); if ((argc == 0) && !doit[D_EVP]) { for (i = 0; i < ALGOR_NUM; i++) if (i != D_EVP) doit[i] = 1; #ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 1; #endif #ifndef OPENSSL_NO_DSA for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 1; #endif #ifndef OPENSSL_NO_EC for (loop = 0; loop < OSSL_NELEM(ecdsa_doit); loop++) ecdsa_doit[loop] = 1; for (loop = 0; loop < OSSL_NELEM(ecdh_doit); loop++) ecdh_doit[loop] = 1; for (loop = 0; loop < OSSL_NELEM(eddsa_doit); loop++) eddsa_doit[loop] = 1; #endif } for (i = 0; i < ALGOR_NUM; i++) if (doit[i]) pr_header++; if (usertime == 0 && !mr) BIO_printf(bio_err, "You have chosen to measure elapsed time " "instead of user CPU time.\n"); #ifndef OPENSSL_NO_RSA for (i = 0; i < loopargs_len; i++) { if (primes > RSA_DEFAULT_PRIME_NUM) { break; } for (k = 0; k < RSA_NUM; k++) { const unsigned char *p; p = rsa_data[k]; loopargs[i].rsa_key[k] = d2i_RSAPrivateKey(NULL, &p, rsa_data_length[k]); if (loopargs[i].rsa_key[k] == NULL) { BIO_printf(bio_err, "internal error loading RSA key number %d\n", k); goto end; } } } #endif #ifndef OPENSSL_NO_DSA for (i = 0; i < loopargs_len; i++) { loopargs[i].dsa_key[0] = get_dsa(512); loopargs[i].dsa_key[1] = get_dsa(1024); loopargs[i].dsa_key[2] = get_dsa(2048); } #endif #ifndef OPENSSL_NO_DES DES_set_key_unchecked(&key, &sch); DES_set_key_unchecked(&key2, &sch2); DES_set_key_unchecked(&key3, &sch3); #endif AES_set_encrypt_key(key16, 128, &aes_ks1); AES_set_encrypt_key(key24, 192, &aes_ks2); AES_set_encrypt_key(key32, 256, &aes_ks3); #ifndef OPENSSL_NO_CAMELLIA Camellia_set_key(key16, 128, &camellia_ks1); Camellia_set_key(ckey24, 192, &camellia_ks2); Camellia_set_key(ckey32, 256, &camellia_ks3); #endif #ifndef OPENSSL_NO_IDEA IDEA_set_encrypt_key(key16, &idea_ks); #endif #ifndef OPENSSL_NO_SEED SEED_set_key(key16, &seed_ks); #endif #ifndef OPENSSL_NO_RC4 RC4_set_key(&rc4_ks, 16, key16); #endif #ifndef OPENSSL_NO_RC2 RC2_set_key(&rc2_ks, 16, key16, 128); #endif #ifndef OPENSSL_NO_RC5 RC5_32_set_key(&rc5_ks, 16, key16, 12); #endif #ifndef OPENSSL_NO_BF BF_set_key(&bf_ks, 16, key16); #endif #ifndef OPENSSL_NO_CAST CAST_set_key(&cast_ks, 16, key16); #endif #ifndef SIGALRM # ifndef OPENSSL_NO_DES BIO_printf(bio_err, "First we calculate the approximate speed ...\n"); count = 10; do { long it; count *= 2; Time_F(START); for (it = count; it; it--) DES_ecb_encrypt((DES_cblock *)loopargs[0].buf, (DES_cblock *)loopargs[0].buf, &sch, DES_ENCRYPT); d = Time_F(STOP); } while (d < 3); save_count = count; c[D_MD2][0] = count / 10; c[D_MDC2][0] = count / 10; c[D_MD4][0] = count; c[D_MD5][0] = count; c[D_HMAC][0] = count; c[D_SHA1][0] = count; c[D_RMD160][0] = count; c[D_RC4][0] = count * 5; c[D_CBC_DES][0] = count; c[D_EDE3_DES][0] = count / 3; c[D_CBC_IDEA][0] = count; c[D_CBC_SEED][0] = count; c[D_CBC_RC2][0] = count; c[D_CBC_RC5][0] = count; c[D_CBC_BF][0] = count; c[D_CBC_CAST][0] = count; c[D_CBC_128_AES][0] = count; c[D_CBC_192_AES][0] = count; c[D_CBC_256_AES][0] = count; c[D_CBC_128_CML][0] = count; c[D_CBC_192_CML][0] = count; c[D_CBC_256_CML][0] = count; c[D_SHA256][0] = count; c[D_SHA512][0] = count; c[D_WHIRLPOOL][0] = count; c[D_IGE_128_AES][0] = count; c[D_IGE_192_AES][0] = count; c[D_IGE_256_AES][0] = count; c[D_GHASH][0] = count; c[D_RAND][0] = count; for (i = 1; i < size_num; i++) { long l0, l1; l0 = (long)lengths[0]; l1 = (long)lengths[i]; c[D_MD2][i] = c[D_MD2][0] * 4 * l0 / l1; c[D_MDC2][i] = c[D_MDC2][0] * 4 * l0 / l1; c[D_MD4][i] = c[D_MD4][0] * 4 * l0 / l1; c[D_MD5][i] = c[D_MD5][0] * 4 * l0 / l1; c[D_HMAC][i] = c[D_HMAC][0] * 4 * l0 / l1; c[D_SHA1][i] = c[D_SHA1][0] * 4 * l0 / l1; c[D_RMD160][i] = c[D_RMD160][0] * 4 * l0 / l1; c[D_SHA256][i] = c[D_SHA256][0] * 4 * l0 / l1; c[D_SHA512][i] = c[D_SHA512][0] * 4 * l0 / l1; c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * l0 / l1; c[D_GHASH][i] = c[D_GHASH][0] * 4 * l0 / l1; c[D_RAND][i] = c[D_RAND][0] * 4 * l0 / l1; l0 = (long)lengths[i - 1]; c[D_RC4][i] = c[D_RC4][i - 1] * l0 / l1; c[D_CBC_DES][i] = c[D_CBC_DES][i - 1] * l0 / l1; c[D_EDE3_DES][i] = c[D_EDE3_DES][i - 1] * l0 / l1; c[D_CBC_IDEA][i] = c[D_CBC_IDEA][i - 1] * l0 / l1; c[D_CBC_SEED][i] = c[D_CBC_SEED][i - 1] * l0 / l1; c[D_CBC_RC2][i] = c[D_CBC_RC2][i - 1] * l0 / l1; c[D_CBC_RC5][i] = c[D_CBC_RC5][i - 1] * l0 / l1; c[D_CBC_BF][i] = c[D_CBC_BF][i - 1] * l0 / l1; c[D_CBC_CAST][i] = c[D_CBC_CAST][i - 1] * l0 / l1; c[D_CBC_128_AES][i] = c[D_CBC_128_AES][i - 1] * l0 / l1; c[D_CBC_192_AES][i] = c[D_CBC_192_AES][i - 1] * l0 / l1; c[D_CBC_256_AES][i] = c[D_CBC_256_AES][i - 1] * l0 / l1; c[D_CBC_128_CML][i] = c[D_CBC_128_CML][i - 1] * l0 / l1; c[D_CBC_192_CML][i] = c[D_CBC_192_CML][i - 1] * l0 / l1; c[D_CBC_256_CML][i] = c[D_CBC_256_CML][i - 1] * l0 / l1; c[D_IGE_128_AES][i] = c[D_IGE_128_AES][i - 1] * l0 / l1; c[D_IGE_192_AES][i] = c[D_IGE_192_AES][i - 1] * l0 / l1; c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1; } # ifndef OPENSSL_NO_RSA rsa_c[R_RSA_512][0] = count / 2000; rsa_c[R_RSA_512][1] = count / 400; for (i = 1; i < RSA_NUM; i++) { rsa_c[i][0] = rsa_c[i - 1][0] / 8; rsa_c[i][1] = rsa_c[i - 1][1] / 4; if (rsa_doit[i] <= 1 && rsa_c[i][0] == 0) rsa_doit[i] = 0; else { if (rsa_c[i][0] == 0) { rsa_c[i][0] = 1; rsa_c[i][1] = 20; } } } # endif # ifndef OPENSSL_NO_DSA dsa_c[R_DSA_512][0] = count / 1000; dsa_c[R_DSA_512][1] = count / 1000 / 2; for (i = 1; i < DSA_NUM; i++) { dsa_c[i][0] = dsa_c[i - 1][0] / 4; dsa_c[i][1] = dsa_c[i - 1][1] / 4; if (dsa_doit[i] <= 1 && dsa_c[i][0] == 0) dsa_doit[i] = 0; else { if (dsa_c[i][0] == 0) { dsa_c[i][0] = 1; dsa_c[i][1] = 1; } } } # endif # ifndef OPENSSL_NO_EC ecdsa_c[R_EC_P160][0] = count / 1000; ecdsa_c[R_EC_P160][1] = count / 1000 / 2; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if (ecdsa_doit[i] <= 1 && ecdsa_c[i][0] == 0) ecdsa_doit[i] = 0; else { if (ecdsa_c[i][0] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_K163][0] = count / 1000; ecdsa_c[R_EC_K163][1] = count / 1000 / 2; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if (ecdsa_doit[i] <= 1 && ecdsa_c[i][0] == 0) ecdsa_doit[i] = 0; else { if (ecdsa_c[i][0] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_B163][0] = count / 1000; ecdsa_c[R_EC_B163][1] = count / 1000 / 2; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if (ecdsa_doit[i] <= 1 && ecdsa_c[i][0] == 0) ecdsa_doit[i] = 0; else { if (ecdsa_c[i][0] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdh_c[R_EC_P160][0] = count / 1000; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; if (ecdh_doit[i] <= 1 && ecdh_c[i][0] == 0) ecdh_doit[i] = 0; else { if (ecdh_c[i][0] == 0) { ecdh_c[i][0] = 1; } } } ecdh_c[R_EC_K163][0] = count / 1000; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; if (ecdh_doit[i] <= 1 && ecdh_c[i][0] == 0) ecdh_doit[i] = 0; else { if (ecdh_c[i][0] == 0) { ecdh_c[i][0] = 1; } } } ecdh_c[R_EC_B163][0] = count / 1000; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; if (ecdh_doit[i] <= 1 && ecdh_c[i][0] == 0) ecdh_doit[i] = 0; else { if (ecdh_c[i][0] == 0) { ecdh_c[i][0] = 1; } } } ecdh_c[R_EC_BRP256R1][0] = count / 1000; for (i = R_EC_BRP384R1; i <= R_EC_BRP512R1; i += 2) { ecdh_c[i][0] = ecdh_c[i - 2][0] / 2; if (ecdh_doit[i] <= 1 && ecdh_c[i][0] == 0) ecdh_doit[i] = 0; else { if (ecdh_c[i][0] == 0) { ecdh_c[i][0] = 1; } } } ecdh_c[R_EC_BRP256T1][0] = count / 1000; for (i = R_EC_BRP384T1; i <= R_EC_BRP512T1; i += 2) { ecdh_c[i][0] = ecdh_c[i - 2][0] / 2; if (ecdh_doit[i] <= 1 && ecdh_c[i][0] == 0) ecdh_doit[i] = 0; else { if (ecdh_c[i][0] == 0) { ecdh_c[i][0] = 1; } } } ecdh_c[R_EC_X25519][0] = count / 1800; ecdh_c[R_EC_X448][0] = count / 7200; eddsa_c[R_EC_Ed25519][0] = count / 1800; eddsa_c[R_EC_Ed448][0] = count / 7200; # endif # else # error "You cannot disable DES on systems without SIGALRM." # endif #elif SIGALRM > 0 signal(SIGALRM, alarmed); #endif #ifndef OPENSSL_NO_MD2 if (doit[D_MD2]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_MD2], c[D_MD2][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, EVP_Digest_MD2_loop, loopargs); d = Time_F(STOP); print_result(D_MD2, testnum, count, d); } } #endif #ifndef OPENSSL_NO_MDC2 if (doit[D_MDC2]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_MDC2], c[D_MDC2][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, EVP_Digest_MDC2_loop, loopargs); d = Time_F(STOP); print_result(D_MDC2, testnum, count, d); } } #endif #ifndef OPENSSL_NO_MD4 if (doit[D_MD4]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_MD4], c[D_MD4][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, EVP_Digest_MD4_loop, loopargs); d = Time_F(STOP); print_result(D_MD4, testnum, count, d); } } #endif #ifndef OPENSSL_NO_MD5 if (doit[D_MD5]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_MD5], c[D_MD5][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, MD5_loop, loopargs); d = Time_F(STOP); print_result(D_MD5, testnum, count, d); } } if (doit[D_HMAC]) { static const char hmac_key[] = "This is a key..."; int len = strlen(hmac_key); for (i = 0; i < loopargs_len; i++) { loopargs[i].hctx = HMAC_CTX_new(); if (loopargs[i].hctx == NULL) { BIO_printf(bio_err, "HMAC malloc failure, exiting..."); exit(1); } HMAC_Init_ex(loopargs[i].hctx, hmac_key, len, EVP_md5(), NULL); } for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_HMAC], c[D_HMAC][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, HMAC_loop, loopargs); d = Time_F(STOP); print_result(D_HMAC, testnum, count, d); } for (i = 0; i < loopargs_len; i++) { HMAC_CTX_free(loopargs[i].hctx); } } #endif if (doit[D_SHA1]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_SHA1], c[D_SHA1][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, SHA1_loop, loopargs); d = Time_F(STOP); print_result(D_SHA1, testnum, count, d); } } if (doit[D_SHA256]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_SHA256], c[D_SHA256][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, SHA256_loop, loopargs); d = Time_F(STOP); print_result(D_SHA256, testnum, count, d); } } if (doit[D_SHA512]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_SHA512], c[D_SHA512][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, SHA512_loop, loopargs); d = Time_F(STOP); print_result(D_SHA512, testnum, count, d); } } #ifndef OPENSSL_NO_WHIRLPOOL if (doit[D_WHIRLPOOL]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, WHIRLPOOL_loop, loopargs); d = Time_F(STOP); print_result(D_WHIRLPOOL, testnum, count, d); } } #endif #ifndef OPENSSL_NO_RMD160 if (doit[D_RMD160]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_RMD160], c[D_RMD160][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, EVP_Digest_RMD160_loop, loopargs); d = Time_F(STOP); print_result(D_RMD160, testnum, count, d); } } #endif #ifndef OPENSSL_NO_RC4 if (doit[D_RC4]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_RC4], c[D_RC4][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, RC4_loop, loopargs); d = Time_F(STOP); print_result(D_RC4, testnum, count, d); } } #endif #ifndef OPENSSL_NO_DES if (doit[D_CBC_DES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_CBC_DES], c[D_CBC_DES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, DES_ncbc_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_CBC_DES, testnum, count, d); } } if (doit[D_EDE3_DES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_EDE3_DES], c[D_EDE3_DES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, DES_ede3_cbc_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_EDE3_DES, testnum, count, d); } } #endif if (doit[D_CBC_128_AES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, AES_cbc_128_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_CBC_128_AES, testnum, count, d); } } if (doit[D_CBC_192_AES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, AES_cbc_192_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_CBC_192_AES, testnum, count, d); } } if (doit[D_CBC_256_AES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, AES_cbc_256_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_CBC_256_AES, testnum, count, d); } } if (doit[D_IGE_128_AES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, AES_ige_128_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_IGE_128_AES, testnum, count, d); } } if (doit[D_IGE_192_AES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, AES_ige_192_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_IGE_192_AES, testnum, count, d); } } if (doit[D_IGE_256_AES]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, AES_ige_256_encrypt_loop, loopargs); d = Time_F(STOP); print_result(D_IGE_256_AES, testnum, count, d); } } if (doit[D_GHASH]) { for (i = 0; i < loopargs_len; i++) { loopargs[i].gcm_ctx = CRYPTO_gcm128_new(&aes_ks1, (block128_f) AES_encrypt); CRYPTO_gcm128_setiv(loopargs[i].gcm_ctx, (unsigned char *)"0123456789ab", 12); } for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_GHASH], c[D_GHASH][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, CRYPTO_gcm128_aad_loop, loopargs); d = Time_F(STOP); print_result(D_GHASH, testnum, count, d); } for (i = 0; i < loopargs_len; i++) CRYPTO_gcm128_release(loopargs[i].gcm_ctx); } #ifndef OPENSSL_NO_CAMELLIA if (doit[D_CBC_128_CML]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_128_CML]); doit[D_CBC_128_CML] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][testnum], lengths[testnum], seconds.sym); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_CML][testnum]); count++) Camellia_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &camellia_ks1, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_CML, testnum, count, d); } } if (doit[D_CBC_192_CML]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_192_CML]); doit[D_CBC_192_CML] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][testnum], lengths[testnum], seconds.sym); if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported, exiting..."); exit(1); } Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_CML][testnum]); count++) Camellia_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &camellia_ks2, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_CML, testnum, count, d); } } if (doit[D_CBC_256_CML]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_256_CML]); doit[D_CBC_256_CML] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][testnum], lengths[testnum], seconds.sym); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_CML][testnum]); count++) Camellia_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &camellia_ks3, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_CML, testnum, count, d); } } #endif #ifndef OPENSSL_NO_IDEA if (doit[D_CBC_IDEA]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_IDEA]); doit[D_CBC_IDEA] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][testnum], lengths[testnum], seconds.sym); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_IDEA][testnum]); count++) IDEA_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &idea_ks, iv, IDEA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_IDEA, testnum, count, d); } } #endif #ifndef OPENSSL_NO_SEED if (doit[D_CBC_SEED]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_SEED]); doit[D_CBC_SEED] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_SEED], c[D_CBC_SEED][testnum], lengths[testnum], seconds.sym); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_SEED][testnum]); count++) SEED_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &seed_ks, iv, 1); d = Time_F(STOP); print_result(D_CBC_SEED, testnum, count, d); } } #endif #ifndef OPENSSL_NO_RC2 if (doit[D_CBC_RC2]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_RC2]); doit[D_CBC_RC2] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_RC2], c[D_CBC_RC2][testnum], lengths[testnum], seconds.sym); if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported, exiting..."); exit(1); } Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC2][testnum]); count++) RC2_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &rc2_ks, iv, RC2_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC2, testnum, count, d); } } #endif #ifndef OPENSSL_NO_RC5 if (doit[D_CBC_RC5]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_RC5]); doit[D_CBC_RC5] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_RC5], c[D_CBC_RC5][testnum], lengths[testnum], seconds.sym); if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported, exiting..."); exit(1); } Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC5][testnum]); count++) RC5_32_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &rc5_ks, iv, RC5_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC5, testnum, count, d); } } #endif #ifndef OPENSSL_NO_BF if (doit[D_CBC_BF]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_BF]); doit[D_CBC_BF] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_BF], c[D_CBC_BF][testnum], lengths[testnum], seconds.sym); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_BF][testnum]); count++) BF_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &bf_ks, iv, BF_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_BF, testnum, count, d); } } #endif #ifndef OPENSSL_NO_CAST if (doit[D_CBC_CAST]) { if (async_jobs > 0) { BIO_printf(bio_err, "Async mode is not supported with %s\n", names[D_CBC_CAST]); doit[D_CBC_CAST] = 0; } for (testnum = 0; testnum < size_num && async_init == 0; testnum++) { print_message(names[D_CBC_CAST], c[D_CBC_CAST][testnum], lengths[testnum], seconds.sym); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_CAST][testnum]); count++) CAST_cbc_encrypt(loopargs[0].buf, loopargs[0].buf, (size_t)lengths[testnum], &cast_ks, iv, CAST_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_CAST, testnum, count, d); } } #endif if (doit[D_RAND]) { for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_RAND], c[D_RAND][testnum], lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, RAND_bytes_loop, loopargs); d = Time_F(STOP); print_result(D_RAND, testnum, count, d); } } if (doit[D_EVP]) { if (evp_cipher != NULL) { int (*loopfunc)(void *args) = EVP_Update_loop; if (multiblock && (EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) { multiblock_speed(evp_cipher, lengths_single, &seconds); ret = 0; goto end; } names[D_EVP] = OBJ_nid2ln(EVP_CIPHER_nid(evp_cipher)); if (EVP_CIPHER_mode(evp_cipher) == EVP_CIPH_CCM_MODE) { loopfunc = EVP_Update_loop_ccm; } else if (aead && (EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) { loopfunc = EVP_Update_loop_aead; if (lengths == lengths_list) { lengths = aead_lengths_list; size_num = OSSL_NELEM(aead_lengths_list); } } for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_EVP], save_count, lengths[testnum], seconds.sym); for (k = 0; k < loopargs_len; k++) { loopargs[k].ctx = EVP_CIPHER_CTX_new(); EVP_CipherInit_ex(loopargs[k].ctx, evp_cipher, NULL, NULL, iv, decrypt ? 0 : 1); EVP_CIPHER_CTX_set_padding(loopargs[k].ctx, 0); keylen = EVP_CIPHER_CTX_key_length(loopargs[k].ctx); loopargs[k].key = app_malloc(keylen, "evp_cipher key"); EVP_CIPHER_CTX_rand_key(loopargs[k].ctx, loopargs[k].key); EVP_CipherInit_ex(loopargs[k].ctx, NULL, NULL, loopargs[k].key, NULL, -1); OPENSSL_clear_free(loopargs[k].key, keylen); } Time_F(START); count = run_benchmark(async_jobs, loopfunc, loopargs); d = Time_F(STOP); for (k = 0; k < loopargs_len; k++) { EVP_CIPHER_CTX_free(loopargs[k].ctx); } print_result(D_EVP, testnum, count, d); } } else if (evp_md != NULL) { names[D_EVP] = OBJ_nid2ln(EVP_MD_type(evp_md)); for (testnum = 0; testnum < size_num; testnum++) { print_message(names[D_EVP], save_count, lengths[testnum], seconds.sym); Time_F(START); count = run_benchmark(async_jobs, EVP_Digest_loop, loopargs); d = Time_F(STOP); print_result(D_EVP, testnum, count, d); } } } for (i = 0; i < loopargs_len; i++) if (RAND_bytes(loopargs[i].buf, 36) <= 0) goto end; #ifndef OPENSSL_NO_RSA for (testnum = 0; testnum < RSA_NUM; testnum++) { int st = 0; if (!rsa_doit[testnum]) continue; for (i = 0; i < loopargs_len; i++) { if (primes > 2) { BIGNUM *bn = BN_new(); if (bn == NULL) goto end; if (!BN_set_word(bn, RSA_F4)) { BN_free(bn); goto end; } BIO_printf(bio_err, "Generate multi-prime RSA key for %s\n", rsa_choices[testnum].name); loopargs[i].rsa_key[testnum] = RSA_new(); if (loopargs[i].rsa_key[testnum] == NULL) { BN_free(bn); goto end; } if (!RSA_generate_multi_prime_key(loopargs[i].rsa_key[testnum], rsa_bits[testnum], primes, bn, NULL)) { BN_free(bn); goto end; } BN_free(bn); } st = RSA_sign(NID_md5_sha1, loopargs[i].buf, 36, loopargs[i].buf2, &loopargs[i].siglen, loopargs[i].rsa_key[testnum]); if (st == 0) break; } if (st == 0) { BIO_printf(bio_err, "RSA sign failure. No RSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("private", "rsa", rsa_c[testnum][0], rsa_bits[testnum], seconds.rsa); Time_F(START); count = run_benchmark(async_jobs, RSA_sign_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" : "%ld %u bits private RSA's in %.2fs\n", count, rsa_bits[testnum], d); rsa_results[testnum][0] = (double)count / d; rsa_count = count; } for (i = 0; i < loopargs_len; i++) { st = RSA_verify(NID_md5_sha1, loopargs[i].buf, 36, loopargs[i].buf2, loopargs[i].siglen, loopargs[i].rsa_key[testnum]); if (st <= 0) break; } if (st <= 0) { BIO_printf(bio_err, "RSA verify failure. No RSA verify will be done.\n"); ERR_print_errors(bio_err); rsa_doit[testnum] = 0; } else { pkey_print_message("public", "rsa", rsa_c[testnum][1], rsa_bits[testnum], seconds.rsa); Time_F(START); count = run_benchmark(async_jobs, RSA_verify_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" : "%ld %u bits public RSA's in %.2fs\n", count, rsa_bits[testnum], d); rsa_results[testnum][1] = (double)count / d; } if (rsa_count <= 1) { for (testnum++; testnum < RSA_NUM; testnum++) rsa_doit[testnum] = 0; } } #endif for (i = 0; i < loopargs_len; i++) if (RAND_bytes(loopargs[i].buf, 36) <= 0) goto end; #ifndef OPENSSL_NO_DSA for (testnum = 0; testnum < DSA_NUM; testnum++) { int st = 0; if (!dsa_doit[testnum]) continue; for (i = 0; i < loopargs_len; i++) { st = DSA_sign(0, loopargs[i].buf, 20, loopargs[i].buf2, &loopargs[i].siglen, loopargs[i].dsa_key[testnum]); if (st == 0) break; } if (st == 0) { BIO_printf(bio_err, "DSA sign failure. No DSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "dsa", dsa_c[testnum][0], dsa_bits[testnum], seconds.dsa); Time_F(START); count = run_benchmark(async_jobs, DSA_sign_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R3:%ld:%u:%.2f\n" : "%ld %u bits DSA signs in %.2fs\n", count, dsa_bits[testnum], d); dsa_results[testnum][0] = (double)count / d; rsa_count = count; } for (i = 0; i < loopargs_len; i++) { st = DSA_verify(0, loopargs[i].buf, 20, loopargs[i].buf2, loopargs[i].siglen, loopargs[i].dsa_key[testnum]); if (st <= 0) break; } if (st <= 0) { BIO_printf(bio_err, "DSA verify failure. No DSA verify will be done.\n"); ERR_print_errors(bio_err); dsa_doit[testnum] = 0; } else { pkey_print_message("verify", "dsa", dsa_c[testnum][1], dsa_bits[testnum], seconds.dsa); Time_F(START); count = run_benchmark(async_jobs, DSA_verify_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R4:%ld:%u:%.2f\n" : "%ld %u bits DSA verify in %.2fs\n", count, dsa_bits[testnum], d); dsa_results[testnum][1] = (double)count / d; } if (rsa_count <= 1) { for (testnum++; testnum < DSA_NUM; testnum++) dsa_doit[testnum] = 0; } } #endif #ifndef OPENSSL_NO_EC for (testnum = 0; testnum < ECDSA_NUM; testnum++) { int st = 1; if (!ecdsa_doit[testnum]) continue; for (i = 0; i < loopargs_len; i++) { loopargs[i].ecdsa[testnum] = EC_KEY_new_by_curve_name(test_curves[testnum].nid); if (loopargs[i].ecdsa[testnum] == NULL) { st = 0; break; } } if (st == 0) { BIO_printf(bio_err, "ECDSA failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { for (i = 0; i < loopargs_len; i++) { EC_KEY_precompute_mult(loopargs[i].ecdsa[testnum], NULL); EC_KEY_generate_key(loopargs[i].ecdsa[testnum]); st = ECDSA_sign(0, loopargs[i].buf, 20, loopargs[i].buf2, &loopargs[i].siglen, loopargs[i].ecdsa[testnum]); if (st == 0) break; } if (st == 0) { BIO_printf(bio_err, "ECDSA sign failure. No ECDSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "ecdsa", ecdsa_c[testnum][0], test_curves[testnum].bits, seconds.ecdsa); Time_F(START); count = run_benchmark(async_jobs, ECDSA_sign_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R5:%ld:%u:%.2f\n" : "%ld %u bits ECDSA signs in %.2fs \n", count, test_curves[testnum].bits, d); ecdsa_results[testnum][0] = (double)count / d; rsa_count = count; } for (i = 0; i < loopargs_len; i++) { st = ECDSA_verify(0, loopargs[i].buf, 20, loopargs[i].buf2, loopargs[i].siglen, loopargs[i].ecdsa[testnum]); if (st != 1) break; } if (st != 1) { BIO_printf(bio_err, "ECDSA verify failure. No ECDSA verify will be done.\n"); ERR_print_errors(bio_err); ecdsa_doit[testnum] = 0; } else { pkey_print_message("verify", "ecdsa", ecdsa_c[testnum][1], test_curves[testnum].bits, seconds.ecdsa); Time_F(START); count = run_benchmark(async_jobs, ECDSA_verify_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R6:%ld:%u:%.2f\n" : "%ld %u bits ECDSA verify in %.2fs\n", count, test_curves[testnum].bits, d); ecdsa_results[testnum][1] = (double)count / d; } if (rsa_count <= 1) { for (testnum++; testnum < EC_NUM; testnum++) ecdsa_doit[testnum] = 0; } } } for (testnum = 0; testnum < EC_NUM; testnum++) { int ecdh_checks = 1; if (!ecdh_doit[testnum]) continue; for (i = 0; i < loopargs_len; i++) { EVP_PKEY_CTX *kctx = NULL; EVP_PKEY_CTX *test_ctx = NULL; EVP_PKEY_CTX *ctx = NULL; EVP_PKEY *key_A = NULL; EVP_PKEY *key_B = NULL; size_t outlen; size_t test_outlen; if (ERR_peek_error()) { BIO_printf(bio_err, "WARNING: the error queue contains previous unhandled errors.\n"); ERR_print_errors(bio_err); } kctx = EVP_PKEY_CTX_new_id(test_curves[testnum].nid, NULL); if (!kctx) { EVP_PKEY_CTX *pctx = NULL; EVP_PKEY *params = NULL; unsigned long error = ERR_peek_error(); if (error == ERR_peek_last_error() && ERR_GET_LIB(error) == ERR_LIB_EVP && ERR_GET_FUNC(error) == EVP_F_INT_CTX_NEW && ERR_GET_REASON(error) == EVP_R_UNSUPPORTED_ALGORITHM) ERR_get_error(); if (ERR_peek_error()) { BIO_printf(bio_err, "Unhandled error in the error queue during ECDH init.\n"); ERR_print_errors(bio_err); rsa_count = 1; break; } if ( !(pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) || !EVP_PKEY_paramgen_init(pctx) || !EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, test_curves [testnum].nid) || !EVP_PKEY_paramgen(pctx, &params)) { ecdh_checks = 0; BIO_printf(bio_err, "ECDH EC params init failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; break; } kctx = EVP_PKEY_CTX_new(params, NULL); EVP_PKEY_free(params); params = NULL; EVP_PKEY_CTX_free(pctx); pctx = NULL; } if (kctx == NULL || !EVP_PKEY_keygen_init(kctx) ) { ecdh_checks = 0; BIO_printf(bio_err, "ECDH keygen failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; break; } if (!EVP_PKEY_keygen(kctx, &key_A) || !EVP_PKEY_keygen(kctx, &key_B) || !(ctx = EVP_PKEY_CTX_new(key_A, NULL)) || !EVP_PKEY_derive_init(ctx) || !EVP_PKEY_derive_set_peer(ctx, key_B) || !EVP_PKEY_derive(ctx, NULL, &outlen) || outlen == 0 || outlen > MAX_ECDH_SIZE ) { ecdh_checks = 0; BIO_printf(bio_err, "ECDH key generation failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; break; } if (!(test_ctx = EVP_PKEY_CTX_new(key_B, NULL)) || !EVP_PKEY_derive_init(test_ctx) || !EVP_PKEY_derive_set_peer(test_ctx, key_A) || !EVP_PKEY_derive(test_ctx, NULL, &test_outlen) || !EVP_PKEY_derive(ctx, loopargs[i].secret_a, &outlen) || !EVP_PKEY_derive(test_ctx, loopargs[i].secret_b, &test_outlen) || test_outlen != outlen ) { ecdh_checks = 0; BIO_printf(bio_err, "ECDH computation failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; break; } if (CRYPTO_memcmp(loopargs[i].secret_a, loopargs[i].secret_b, outlen)) { ecdh_checks = 0; BIO_printf(bio_err, "ECDH computations don't match.\n"); ERR_print_errors(bio_err); rsa_count = 1; break; } loopargs[i].ecdh_ctx[testnum] = ctx; loopargs[i].outlen[testnum] = outlen; EVP_PKEY_free(key_A); EVP_PKEY_free(key_B); EVP_PKEY_CTX_free(kctx); kctx = NULL; EVP_PKEY_CTX_free(test_ctx); test_ctx = NULL; } if (ecdh_checks != 0) { pkey_print_message("", "ecdh", ecdh_c[testnum][0], test_curves[testnum].bits, seconds.ecdh); Time_F(START); count = run_benchmark(async_jobs, ECDH_EVP_derive_key_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" : "%ld %u-bits ECDH ops in %.2fs\n", count, test_curves[testnum].bits, d); ecdh_results[testnum][0] = (double)count / d; rsa_count = count; } if (rsa_count <= 1) { for (testnum++; testnum < OSSL_NELEM(ecdh_doit); testnum++) ecdh_doit[testnum] = 0; } } for (testnum = 0; testnum < EdDSA_NUM; testnum++) { int st = 1; EVP_PKEY *ed_pkey = NULL; EVP_PKEY_CTX *ed_pctx = NULL; if (!eddsa_doit[testnum]) continue; for (i = 0; i < loopargs_len; i++) { loopargs[i].eddsa_ctx[testnum] = EVP_MD_CTX_new(); if (loopargs[i].eddsa_ctx[testnum] == NULL) { st = 0; break; } if ((ed_pctx = EVP_PKEY_CTX_new_id(test_ed_curves[testnum].nid, NULL)) == NULL || !EVP_PKEY_keygen_init(ed_pctx) || !EVP_PKEY_keygen(ed_pctx, &ed_pkey)) { st = 0; EVP_PKEY_CTX_free(ed_pctx); break; } EVP_PKEY_CTX_free(ed_pctx); if (!EVP_DigestSignInit(loopargs[i].eddsa_ctx[testnum], NULL, NULL, NULL, ed_pkey)) { st = 0; EVP_PKEY_free(ed_pkey); break; } EVP_PKEY_free(ed_pkey); } if (st == 0) { BIO_printf(bio_err, "EdDSA failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { for (i = 0; i < loopargs_len; i++) { loopargs[i].siglen = test_ed_curves[testnum].siglen; st = EVP_DigestSign(loopargs[i].eddsa_ctx[testnum], loopargs[i].buf2, (size_t *)&loopargs[i].siglen, loopargs[i].buf, 20); if (st == 0) break; } if (st == 0) { BIO_printf(bio_err, "EdDSA sign failure. No EdDSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", test_ed_curves[testnum].name, eddsa_c[testnum][0], test_ed_curves[testnum].bits, seconds.eddsa); Time_F(START); count = run_benchmark(async_jobs, EdDSA_sign_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R8:%ld:%u:%s:%.2f\n" : "%ld %u bits %s signs in %.2fs \n", count, test_ed_curves[testnum].bits, test_ed_curves[testnum].name, d); eddsa_results[testnum][0] = (double)count / d; rsa_count = count; } for (i = 0; i < loopargs_len; i++) { st = EVP_DigestVerify(loopargs[i].eddsa_ctx[testnum], loopargs[i].buf2, loopargs[i].siglen, loopargs[i].buf, 20); if (st != 1) break; } if (st != 1) { BIO_printf(bio_err, "EdDSA verify failure. No EdDSA verify will be done.\n"); ERR_print_errors(bio_err); eddsa_doit[testnum] = 0; } else { pkey_print_message("verify", test_ed_curves[testnum].name, eddsa_c[testnum][1], test_ed_curves[testnum].bits, seconds.eddsa); Time_F(START); count = run_benchmark(async_jobs, EdDSA_verify_loop, loopargs); d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R9:%ld:%u:%s:%.2f\n" : "%ld %u bits %s verify in %.2fs\n", count, test_ed_curves[testnum].bits, test_ed_curves[testnum].name, d); eddsa_results[testnum][1] = (double)count / d; } if (rsa_count <= 1) { for (testnum++; testnum < EdDSA_NUM; testnum++) eddsa_doit[testnum] = 0; } } } #endif #ifndef NO_FORK show_res: #endif if (!mr) { printf("%s\n", OpenSSL_version(OPENSSL_VERSION)); printf("%s\n", OpenSSL_version(OPENSSL_BUILT_ON)); printf("options:"); printf("%s ", BN_options()); #ifndef OPENSSL_NO_MD2 printf("%s ", MD2_options()); #endif #ifndef OPENSSL_NO_RC4 printf("%s ", RC4_options()); #endif #ifndef OPENSSL_NO_DES printf("%s ", DES_options()); #endif printf("%s ", AES_options()); #ifndef OPENSSL_NO_IDEA printf("%s ", IDEA_options()); #endif #ifndef OPENSSL_NO_BF printf("%s ", BF_options()); #endif printf("\n%s\n", OpenSSL_version(OPENSSL_CFLAGS)); } if (pr_header) { if (mr) printf("+H"); else { printf ("The 'numbers' are in 1000s of bytes per second processed.\n"); printf("type "); } for (testnum = 0; testnum < size_num; testnum++) printf(mr ? ":%d" : "%7d bytes", lengths[testnum]); printf("\n"); } for (k = 0; k < ALGOR_NUM; k++) { if (!doit[k]) continue; if (mr) printf("+F:%u:%s", k, names[k]); else printf("%-13s", names[k]); for (testnum = 0; testnum < size_num; testnum++) { if (results[k][testnum] > 10000 && !mr) printf(" %11.2fk", results[k][testnum] / 1e3); else printf(mr ? ":%.2f" : " %11.2f ", results[k][testnum]); } printf("\n"); } #ifndef OPENSSL_NO_RSA testnum = 1; for (k = 0; k < RSA_NUM; k++) { if (!rsa_doit[k]) continue; if (testnum && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); testnum = 0; } if (mr) printf("+F2:%u:%u:%f:%f\n", k, rsa_bits[k], rsa_results[k][0], rsa_results[k][1]); else printf("rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", rsa_bits[k], 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1], rsa_results[k][0], rsa_results[k][1]); } #endif #ifndef OPENSSL_NO_DSA testnum = 1; for (k = 0; k < DSA_NUM; k++) { if (!dsa_doit[k]) continue; if (testnum && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); testnum = 0; } if (mr) printf("+F3:%u:%u:%f:%f\n", k, dsa_bits[k], dsa_results[k][0], dsa_results[k][1]); else printf("dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", dsa_bits[k], 1.0 / dsa_results[k][0], 1.0 / dsa_results[k][1], dsa_results[k][0], dsa_results[k][1]); } #endif #ifndef OPENSSL_NO_EC testnum = 1; for (k = 0; k < OSSL_NELEM(ecdsa_doit); k++) { if (!ecdsa_doit[k]) continue; if (testnum && !mr) { printf("%30ssign verify sign/s verify/s\n", " "); testnum = 0; } if (mr) printf("+F4:%u:%u:%f:%f\n", k, test_curves[k].bits, ecdsa_results[k][0], ecdsa_results[k][1]); else printf("%4u bits ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n", test_curves[k].bits, test_curves[k].name, 1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1], ecdsa_results[k][0], ecdsa_results[k][1]); } testnum = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdh_doit[k]) continue; if (testnum && !mr) { printf("%30sop op/s\n", " "); testnum = 0; } if (mr) printf("+F5:%u:%u:%f:%f\n", k, test_curves[k].bits, ecdh_results[k][0], 1.0 / ecdh_results[k][0]); else printf("%4u bits ecdh (%s) %8.4fs %8.1f\n", test_curves[k].bits, test_curves[k].name, 1.0 / ecdh_results[k][0], ecdh_results[k][0]); } testnum = 1; for (k = 0; k < OSSL_NELEM(eddsa_doit); k++) { if (!eddsa_doit[k]) continue; if (testnum && !mr) { printf("%30ssign verify sign/s verify/s\n", " "); testnum = 0; } if (mr) printf("+F6:%u:%u:%s:%f:%f\n", k, test_ed_curves[k].bits, test_ed_curves[k].name, eddsa_results[k][0], eddsa_results[k][1]); else printf("%4u bits EdDSA (%s) %8.4fs %8.4fs %8.1f %8.1f\n", test_ed_curves[k].bits, test_ed_curves[k].name, 1.0 / eddsa_results[k][0], 1.0 / eddsa_results[k][1], eddsa_results[k][0], eddsa_results[k][1]); } #endif ret = 0; end: ERR_print_errors(bio_err); for (i = 0; i < loopargs_len; i++) { OPENSSL_free(loopargs[i].buf_malloc); OPENSSL_free(loopargs[i].buf2_malloc); #ifndef OPENSSL_NO_RSA for (k = 0; k < RSA_NUM; k++) RSA_free(loopargs[i].rsa_key[k]); #endif #ifndef OPENSSL_NO_DSA for (k = 0; k < DSA_NUM; k++) DSA_free(loopargs[i].dsa_key[k]); #endif #ifndef OPENSSL_NO_EC for (k = 0; k < ECDSA_NUM; k++) EC_KEY_free(loopargs[i].ecdsa[k]); for (k = 0; k < EC_NUM; k++) EVP_PKEY_CTX_free(loopargs[i].ecdh_ctx[k]); for (k = 0; k < EdDSA_NUM; k++) EVP_MD_CTX_free(loopargs[i].eddsa_ctx[k]); OPENSSL_free(loopargs[i].secret_a); OPENSSL_free(loopargs[i].secret_b); #endif } if (async_jobs > 0) { for (i = 0; i < loopargs_len; i++) ASYNC_WAIT_CTX_free(loopargs[i].wait_ctx); } if (async_init) { ASYNC_cleanup_thread(); } OPENSSL_free(loopargs); release_engine(e); return ret; } apps/speed.c:1773: error: BUFFER_OVERRUN_L3 Offset: [0, 99998] Size: [1, 75999240]. Showing all 13 steps of the trace apps/speed.c:1771:10: <Offset trace> 1769. memset(loopargs, 0, loopargs_len * sizeof(loopargs_t)); 1770. 1771. for (i = 0; i < loopargs_len; i++) { ^ 1772. if (async_jobs > 0) { 1773. loopargs[i].wait_ctx = ASYNC_WAIT_CTX_new(); apps/speed.c:1771:10: Assignment 1769. memset(loopargs, 0, loopargs_len * sizeof(loopargs_t)); 1770. 1771. for (i = 0; i < loopargs_len; i++) { ^ 1772. if (async_jobs > 0) { 1773. loopargs[i].wait_ctx = ASYNC_WAIT_CTX_new(); apps/speed.c:1766:21: <Length trace> 1764. } 1765. 1766. loopargs_len = (async_jobs == 0 ? 1 : async_jobs); ^ 1767. loopargs = 1768. app_malloc(loopargs_len * sizeof(loopargs_t), "array of loopargs"); apps/speed.c:1766:21: Assignment 1764. } 1765. 1766. loopargs_len = (async_jobs == 0 ? 1 : async_jobs); ^ 1767. loopargs = 1768. app_malloc(loopargs_len * sizeof(loopargs_t), "array of loopargs"); apps/speed.c:1766:5: Assignment 1764. } 1765. 1766. loopargs_len = (async_jobs == 0 ? 1 : async_jobs); ^ 1767. loopargs = 1768. app_malloc(loopargs_len * sizeof(loopargs_t), "array of loopargs"); apps/speed.c:1768:9: Call 1766. loopargs_len = (async_jobs == 0 ? 1 : async_jobs); 1767. loopargs = 1768. app_malloc(loopargs_len * sizeof(loopargs_t), "array of loopargs"); ^ 1769. memset(loopargs, 0, loopargs_len * sizeof(loopargs_t)); 1770. apps/apps.c:948:1: Parameter `sz` 946. } 947. 948. > void* app_malloc(int sz, const char *what) 949. { 950. void *vp = OPENSSL_malloc(sz); apps/apps.c:950:16: Call 948. void* app_malloc(int sz, const char *what) 949. { 950. void *vp = OPENSSL_malloc(sz); ^ 951. 952. if (vp == NULL) { crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); apps/apps.c:950:5: Assignment 948. void* app_malloc(int sz, const char *what) 949. { 950. void *vp = OPENSSL_malloc(sz); ^ 951. 952. if (vp == NULL) { apps/apps.c:958:5: Assignment 956. exit(1); 957. } 958. return vp; ^ 959. } 960. apps/speed.c:1767:5: Assignment 1765. 1766. loopargs_len = (async_jobs == 0 ? 1 : async_jobs); 1767. loopargs = ^ 1768. app_malloc(loopargs_len * sizeof(loopargs_t), "array of loopargs"); 1769. memset(loopargs, 0, loopargs_len * sizeof(loopargs_t)); apps/speed.c:1773:13: Array access: Offset: [0, 99998] Size: [1, 75999240] 1771. for (i = 0; i < loopargs_len; i++) { 1772. if (async_jobs > 0) { 1773. loopargs[i].wait_ctx = ASYNC_WAIT_CTX_new(); ^ 1774. if (loopargs[i].wait_ctx == NULL) { 1775. BIO_printf(bio_err, "Error creating the ASYNC_WAIT_CTX\n");
https://github.com/openssl/openssl/blob/571286b0a463b02ef2f9040a7e5d602635854832/apps/speed.c/#L1773
d2a_code_trace_data_45210
void ff_MPV_frame_end(MpegEncContext *s) { int i; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ff_xvmc_field_end(s); } else FF_ENABLE_DEPRECATION_WARNINGS #endif if ((s->er.error_count || s->encoding) && !s->avctx->hwaccel && s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags & CODEC_FLAG_EMU_EDGE)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality; if (s->pict_type!= AV_PICTURE_TYPE_B) { s->last_non_b_pict_type = s->pict_type; } #if 0 for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) { s->picture[i] = s->current_picture; break; } } assert(i < MAX_PICTURE_COUNT); #endif if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s, &s->picture[i]); } } #if 0 memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->next_picture, 0, sizeof(Picture)); memset(&s->current_picture, 0, sizeof(Picture)); #endif s->avctx->coded_frame = &s->current_picture_ptr->f; if (s->current_picture.reference) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); } libavcodec/mpegvideo.c:1720: error: Null Dereference pointer `desc` last assigned on line 1719 could be null and is dereferenced at line 1720, column 22. libavcodec/mpegvideo.c:1700:1: start of procedure ff_MPV_frame_end() 1698. /* generic function for encode/decode called after a 1699. * frame has been coded/decoded. */ 1700. void ff_MPV_frame_end(MpegEncContext *s) ^ 1701. { 1702. int i; libavcodec/mpegvideo.c:1708:9: Taking false branch 1706. /* redraw edges for the frame if decoding didn't complete */ 1707. // just to make sure that all data is rendered. 1708. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ^ 1709. ff_xvmc_field_end(s); 1710. } else libavcodec/mpegvideo.c:1713:10: Taking false branch 1711. FF_ENABLE_DEPRECATION_WARNINGS 1712. #endif /* FF_API_XVMC */ 1713. if ((s->er.error_count || s->encoding) && ^ 1714. !s->avctx->hwaccel && 1715. s->unrestricted_mv && libavcodec/mpegvideo.c:1713:31: Taking true branch 1711. FF_ENABLE_DEPRECATION_WARNINGS 1712. #endif /* FF_API_XVMC */ 1713. if ((s->er.error_count || s->encoding) && ^ 1714. !s->avctx->hwaccel && 1715. s->unrestricted_mv && libavcodec/mpegvideo.c:1714:10: Taking true branch 1712. #endif /* FF_API_XVMC */ 1713. if ((s->er.error_count || s->encoding) && 1714. !s->avctx->hwaccel && ^ 1715. s->unrestricted_mv && 1716. s->current_picture.reference && libavcodec/mpegvideo.c:1715:9: Taking true branch 1713. if ((s->er.error_count || s->encoding) && 1714. !s->avctx->hwaccel && 1715. s->unrestricted_mv && ^ 1716. s->current_picture.reference && 1717. !s->intra_only && libavcodec/mpegvideo.c:1716:9: Taking true branch 1714. !s->avctx->hwaccel && 1715. s->unrestricted_mv && 1716. s->current_picture.reference && ^ 1717. !s->intra_only && 1718. !(s->flags & CODEC_FLAG_EMU_EDGE)) { libavcodec/mpegvideo.c:1717:10: Taking true branch 1715. s->unrestricted_mv && 1716. s->current_picture.reference && 1717. !s->intra_only && ^ 1718. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1719. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo.c:1718:11: Taking true branch 1716. s->current_picture.reference && 1717. !s->intra_only && 1718. !(s->flags & CODEC_FLAG_EMU_EDGE)) { ^ 1719. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1720. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo.c:1719:9: 1717. !s->intra_only && 1718. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1719. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1720. int hshift = desc->log2_chroma_w; 1721. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get() 1505. } 1506. 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1509:9: Taking false branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1509:24: Taking true branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1510:9: 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1510. return NULL; ^ 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } ^ 1513. 1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:1720:9: 1718. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1719. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1720. int hshift = desc->log2_chroma_w; ^ 1721. int vshift = desc->log2_chroma_h; 1722. s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
https://github.com/libav/libav/blob/16e7b189c548b4075ff4b5dd62af10e2acae260b/libavcodec/mpegvideo.c/#L1720
d2a_code_trace_data_45211
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *A, *a = NULL; const BN_ULONG *B; int i; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b,BN_FLG_SECURE)) a = A = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = A = OPENSSL_zalloc(words * sizeof(*a)); if (A == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } #if 1 B = b->d; if (B != NULL) { for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) { BN_ULONG a0, a1, a2, a3; a0 = B[0]; a1 = B[1]; a2 = B[2]; a3 = B[3]; A[0] = a0; A[1] = a1; A[2] = a2; A[3] = a3; } switch (b->top & 3) { case 3: A[2] = B[2]; case 2: A[1] = B[1]; case 1: A[0] = B[0]; case 0: ; } } #else memset(A, 0, sizeof(*A) * words); memcpy(A, b->d, sizeof(b->d[0]) * b->top); #endif return (a); } crypto/srp/srp_vfy.c:546: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_bin2bn`. Showing all 13 steps of the trace crypto/srp/srp_vfy.c:542:22: Call 540. if ((len = t_fromb64(tmp, N)) == 0) 541. goto err; 542. N_bn_alloc = BN_bin2bn(tmp, len, NULL); ^ 543. N_bn = N_bn_alloc; 544. if ((len = t_fromb64(tmp, g)) == 0) crypto/bn/bn_lib.c:475:1: Parameter `*ret->d` 473. } 474. 475. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 476. { 477. unsigned int i, m; crypto/srp/srp_vfy.c:546:22: Call 544. if ((len = t_fromb64(tmp, g)) == 0) 545. goto err; 546. g_bn_alloc = BN_bin2bn(tmp, len, NULL); ^ 547. g_bn = g_bn_alloc; 548. defgNid = "*"; crypto/bn/bn_lib.c:475:1: Parameter `*ret->d` 473. } 474. 475. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 476. { 477. unsigned int i, m; crypto/bn/bn_lib.c:497:9: Call 495. i = ((n - 1) / BN_BYTES) + 1; 496. m = ((n - 1) % (BN_BYTES)); 497. if (bn_wexpand(ret, (int)i) == NULL) { ^ 498. BN_free(bn); 499. return NULL; 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_lib.c:1018:37: Call 1016. BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 1019. } 1020. crypto/bn/bn_lib.c:323:1: Parameter `*b->d` 321. */ 322. 323. > BIGNUM *bn_expand2(BIGNUM *b, int words) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:328:23: Call 326. 327. if (words > b->dmax) { 328. BN_ULONG *a = bn_expand_internal(b, words); ^ 329. if (!a) 330. return NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:272:5: Assignment 270. 271. #if 1 272. B = b->d; ^ 273. /* Check if the previous number needs to be copied */ 274. if (B != NULL) { crypto/bn/bn_lib.c:289:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_bin2bn` 287. a1 = B[1]; 288. a2 = B[2]; 289. a3 = B[3]; ^ 290. A[0] = a0; 291. A[1] = a1;
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_lib.c/#L289
d2a_code_trace_data_45212
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1126: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont_consttime`. Showing all 31 steps of the trace test/bntest.c:1101:1: Parameter `ctx->stack.depth` 1099. * x86_64 cause a different code branch to be taken. 1100. */ 1101. > int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx) 1102. { 1103. BIGNUM *a, *p, *m, *d, *e; test/bntest.c:1117:10: Call 1115. BN_bntest_rand(a, 1024, 0, 0); 1116. BN_zero(p); 1117. if (!BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)) ^ 1118. return 0; 1119. if (!BN_is_one(d)) { crypto/bn/bn_exp.c:644:1: Parameter `ctx->stack.depth` 642. * http://www.daemong-consideredperthreading-considered-harmful/) 643. */ 644. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 645. const BIGNUM *m, BN_CTX *ctx, 646. BN_MONT_CTX *in_mont) test/bntest.c:1126:10: Call 1124. BN_bntest_rand(p, 1024, 0, 0); 1125. BN_zero(a); 1126. if (!BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)) ^ 1127. return 0; 1128. if (!BN_is_zero(d)) { crypto/bn/bn_exp.c:644:1: Parameter `ctx->stack.depth` 642. * http://www.daemong-consideredperthreading-considered-harmful/) 643. */ 644. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 645. const BIGNUM *m, BN_CTX *ctx, 646. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:678:5: Call 676. } 677. 678. BN_CTX_start(ctx); ^ 679. 680. /* crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:689:14: Call 687. if ((mont = BN_MONT_CTX_new()) == NULL) 688. goto err; 689. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 690. goto err; 691. } crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:428:14: Call 426. tmod.top = buf[0] != 0 ? 1 : 0; 427. /* Ri = R^-1 mod N */ 428. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 429. goto err; 430. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont_consttime` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_45213
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_blind.c:343: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `int_bn_mod_inverse`. Showing all 19 steps of the trace crypto/bn/bn_blind.c:301:1: Parameter `ctx->stack.depth` 299. } 300. 301. > BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, 302. const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, 303. int (*bn_mod_exp) (BIGNUM *r, crypto/bn/bn_blind.c:343:14: Call 341. if (!BN_rand_range(ret->A, ret->mod)) 342. goto err; 343. if (!int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)) { ^ 344. /* 345. * this should almost never happen for good RSA keys crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `int_bn_mod_inverse` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_45214
static void init_dequant_tables(H264Context *h){ int i,x; init_dequant4_coeff_table(h); if(h->pps.transform_8x8_mode) init_dequant8_coeff_table(h); if(h->sps.transform_bypass){ for(i=0; i<6; i++) for(x=0; x<16; x++) h->dequant4_coeff[i][0][x] = 1<<6; if(h->pps.transform_8x8_mode) for(i=0; i<2; i++) for(x=0; x<64; x++) h->dequant8_coeff[i][0][x] = 1<<6; } } libavcodec/h264.c:2081: error: Buffer Overrun L2 Offset: [0, 6] Size: 6. libavcodec/h264.c:2073:1: <Length trace> 2071. } 2072. 2073. static void init_dequant_tables(H264Context *h){ ^ 2074. int i,x; 2075. init_dequant4_coeff_table(h); libavcodec/h264.c:2073:1: Parameter `*h->dequant4_coeff[*]` 2071. } 2072. 2073. static void init_dequant_tables(H264Context *h){ ^ 2074. int i,x; 2075. init_dequant4_coeff_table(h); libavcodec/h264.c:2075:5: Call 2073. static void init_dequant_tables(H264Context *h){ 2074. int i,x; 2075. init_dequant4_coeff_table(h); ^ 2076. if(h->pps.transform_8x8_mode) 2077. init_dequant8_coeff_table(h); libavcodec/h264.c:2048:1: Parameter `*h->dequant4_coeff[*]` 2046. } 2047. 2048. static void init_dequant4_coeff_table(H264Context *h){ ^ 2049. int i,j,q,x; 2050. const int transpose = (h->s.dsp.h264_idct_add != ff_h264_idct_add_c); //FIXME ugly libavcodec/h264.c:2081:17: Array access: Offset: [0, 6] Size: 6 2079. for(i=0; i<6; i++) 2080. for(x=0; x<16; x++) 2081. h->dequant4_coeff[i][0][x] = 1<<6; ^ 2082. if(h->pps.transform_8x8_mode) 2083. for(i=0; i<2; i++)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2081
d2a_code_trace_data_45215
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; 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:2773: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 2725, column 11 is not reachable after line 2773, column 5. Showing all 66 steps of the trace ssl/statem/statem_clnt.c:2700:1: start of procedure tls_construct_cke_rsa() 2698. } 2699. 2700. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) 2701. { 2702. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2703:5: 2701. { 2702. #ifndef OPENSSL_NO_RSA 2703. > unsigned char *encdata = NULL; 2704. EVP_PKEY *pkey = NULL; 2705. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2704:5: 2702. #ifndef OPENSSL_NO_RSA 2703. unsigned char *encdata = NULL; 2704. > EVP_PKEY *pkey = NULL; 2705. EVP_PKEY_CTX *pctx = NULL; 2706. size_t enclen; ssl/statem/statem_clnt.c:2705:5: 2703. unsigned char *encdata = NULL; 2704. EVP_PKEY *pkey = NULL; 2705. > EVP_PKEY_CTX *pctx = NULL; 2706. size_t enclen; 2707. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2707:5: 2705. EVP_PKEY_CTX *pctx = NULL; 2706. size_t enclen; 2707. > unsigned char *pms = NULL; 2708. size_t pmslen = 0; 2709. ssl/statem/statem_clnt.c:2708:5: 2706. size_t enclen; 2707. unsigned char *pms = NULL; 2708. > size_t pmslen = 0; 2709. 2710. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2710:9: Taking false branch 2708. size_t pmslen = 0; 2709. 2710. if (s->session->peer == NULL) { ^ 2711. /* 2712. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2718:5: 2716. } 2717. 2718. > pkey = X509_get0_pubkey(s->session->peer); 2719. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2720. 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:2719:9: 2717. 2718. pkey = X509_get0_pubkey(s->session->peer); 2719. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2720. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2721. 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:2719:9: Taking false branch 2717. 2718. pkey = X509_get0_pubkey(s->session->peer); 2719. if (EVP_PKEY_get0_RSA(pkey) == NULL) { ^ 2720. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2721. return 0; ssl/statem/statem_clnt.c:2724:5: 2722. } 2723. 2724. > pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2725. pms = OPENSSL_malloc(pmslen); 2726. if (pms == NULL) { ssl/statem/statem_clnt.c:2725:5: 2723. 2724. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2725. > pms = OPENSSL_malloc(pmslen); 2726. if (pms == NULL) { 2727. 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:2726:9: Taking false branch 2724. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2725. pms = OPENSSL_malloc(pmslen); 2726. if (pms == NULL) { ^ 2727. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); 2728. *al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_clnt.c:2732:5: 2730. } 2731. 2732. > pms[0] = s->client_version >> 8; 2733. pms[1] = s->client_version & 0xff; 2734. /* TODO(size_t): Convert this function */ ssl/statem/statem_clnt.c:2733:5: 2731. 2732. pms[0] = s->client_version >> 8; 2733. > pms[1] = s->client_version & 0xff; 2734. /* TODO(size_t): Convert this function */ 2735. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ssl/statem/statem_clnt.c:2735:9: 2733. pms[1] = s->client_version & 0xff; 2734. /* TODO(size_t): Convert this function */ 2735. > if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { 2736. goto err; 2737. } crypto/rand/rand_lib.c:97:1: start of procedure RAND_bytes() 95. } 96. 97. > int RAND_bytes(unsigned char *buf, int num) 98. { 99. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:99:5: 97. int RAND_bytes(unsigned char *buf, int num) 98. { 99. > const RAND_METHOD *meth = RAND_get_rand_method(); 100. if (meth && meth->bytes) 101. return meth->bytes(buf, num); crypto/rand/rand_lib.c:34:1: start of procedure RAND_get_rand_method() 32. } 33. 34. > const RAND_METHOD *RAND_get_rand_method(void) 35. { 36. if (!default_RAND_meth) { crypto/rand/rand_lib.c:36:10: Taking false branch 34. const RAND_METHOD *RAND_get_rand_method(void) 35. { 36. if (!default_RAND_meth) { ^ 37. #ifndef OPENSSL_NO_ENGINE 38. ENGINE *e = ENGINE_get_default_RAND(); crypto/rand/rand_lib.c:52:5: 50. default_RAND_meth = RAND_OpenSSL(); 51. } 52. > return default_RAND_meth; 53. } 54. crypto/rand/rand_lib.c:53:1: return from a call to RAND_get_rand_method 51. } 52. return default_RAND_meth; 53. > } 54. 55. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:100:9: Taking true branch 98. { 99. const RAND_METHOD *meth = RAND_get_rand_method(); 100. if (meth && meth->bytes) ^ 101. return meth->bytes(buf, num); 102. return (-1); crypto/rand/rand_lib.c:100:17: Taking false branch 98. { 99. const RAND_METHOD *meth = RAND_get_rand_method(); 100. if (meth && meth->bytes) ^ 101. return meth->bytes(buf, num); 102. return (-1); crypto/rand/rand_lib.c:102:5: 100. if (meth && meth->bytes) 101. return meth->bytes(buf, num); 102. > return (-1); 103. } 104. crypto/rand/rand_lib.c:103:1: return from a call to RAND_bytes 101. return meth->bytes(buf, num); 102. return (-1); 103. > } 104. 105. #if OPENSSL_API_COMPAT < 0x10100000L ssl/statem/statem_clnt.c:2735:9: Taking true branch 2733. pms[1] = s->client_version & 0xff; 2734. /* TODO(size_t): Convert this function */ 2735. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ^ 2736. goto err; 2737. } ssl/statem/statem_clnt.c:2772:2: 2770. 2771. return 1; 2772. > err: 2773. OPENSSL_clear_free(pms, pmslen); 2774. EVP_PKEY_CTX_free(pctx); ssl/statem/statem_clnt.c:2773:5: 2771. return 1; 2772. err: 2773. > OPENSSL_clear_free(pms, pmslen); 2774. EVP_PKEY_CTX_free(pctx); 2775. 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/c19602b543562104b756aa6adec9bd5081207574/ssl/statem/statem_clnt.c/#L2773
d2a_code_trace_data_45216
static int vorbis_parse_audio_packet(vorbis_context *vc) { GetBitContext *gb=&vc->gb; uint_fast8_t previous_window=0,next_window=0; uint_fast8_t mode_number; uint_fast16_t blocksize; int_fast32_t i,j; uint_fast8_t no_residue[vc->audio_channels]; uint_fast8_t do_not_decode[vc->audio_channels]; vorbis_mapping *mapping; float *ch_res_ptr=vc->channel_residues; float *ch_floor_ptr=vc->channel_floors; uint_fast8_t res_chan[vc->audio_channels]; uint_fast8_t res_num=0; int_fast16_t retlen=0; uint_fast16_t saved_start=0; float fadd_bias = vc->add_bias; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); return -1; } if (vc->mode_count==1) { mode_number=0; } else { mode_number=get_bits(gb, ilog(vc->mode_count-1)); } vc->mode_number=mode_number; mapping=&vc->mappings[vc->modes[mode_number].mapping]; AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag); if (vc->modes[mode_number].blockflag) { previous_window=get_bits1(gb); next_window=get_bits1(gb); } blocksize=vc->blocksize[vc->modes[mode_number].blockflag]; memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); for(i=0;i<vc->audio_channels;++i) { vorbis_floor *floor; if (mapping->submaps>1) { floor=&vc->floors[mapping->submap_floor[mapping->mux[i]]]; } else { floor=&vc->floors[mapping->submap_floor[0]]; } no_residue[i]=floor->decode(vc, &floor->data, ch_floor_ptr); ch_floor_ptr+=blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) { no_residue[mapping->magnitude[i]]=0; no_residue[mapping->angle[i]]=0; } } for(i=0;i<mapping->submaps;++i) { vorbis_residue *residue; uint_fast8_t ch=0; for(j=0;j<vc->audio_channels;++j) { if ((mapping->submaps==1) || (i=mapping->mux[j])) { res_chan[j]=res_num; if (no_residue[j]) { do_not_decode[ch]=1; } else { do_not_decode[ch]=0; } ++ch; ++res_num; } } residue=&vc->residues[mapping->submap_residue[i]]; vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2); ch_res_ptr+=ch*blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { float *mag, *ang; mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); } for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) { ch_res_ptr=vc->channel_residues+res_chan[j]*blocksize/2; vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize/2); } for(j=0;j<vc->audio_channels;++j) { uint_fast8_t step=vc->audio_channels; uint_fast16_t k; float *saved=vc->saved+j*vc->blocksize[1]/2; float *ret=vc->ret; const float *lwin=vc->win[1]; const float *swin=vc->win[0]; float *buf=vc->buf; float *buf_tmp=vc->buf_tmp; ch_floor_ptr=vc->channel_floors+j*blocksize/2; saved_start=vc->saved_start; vc->mdct[0].fft.imdct_calc(&vc->mdct[vc->modes[mode_number].blockflag], buf, ch_floor_ptr, buf_tmp); if (vc->modes[mode_number].blockflag) { if (previous_window) { vc->dsp.vector_fmul_add_add(ret+j, buf, lwin, saved, vc->add_bias, vc->blocksize[1]/2, step); retlen=vc->blocksize[1]/2; } else { int len = (vc->blocksize[1]-vc->blocksize[0])/4; buf += len; vc->dsp.vector_fmul_add_add(ret+j, buf, swin, saved, vc->add_bias, vc->blocksize[0]/2, step); k = vc->blocksize[0]/2*step + j; buf += vc->blocksize[0]/2; if(vc->exp_bias){ for(i=0; i<len; i++, k+=step) ((uint32_t*)ret)[k] = ((uint32_t*)buf)[i] + vc->exp_bias; } else { for(i=0; i<len; i++, k+=step) ret[k] = buf[i] + fadd_bias; } buf=vc->buf; retlen=vc->blocksize[0]/2+len; } if (next_window) { buf += vc->blocksize[1]/2; vc->dsp.vector_fmul_reverse(saved, buf, lwin, vc->blocksize[1]/2); saved_start=0; } else { saved_start=(vc->blocksize[1]-vc->blocksize[0])/4; buf += vc->blocksize[1]/2; for(i=0; i<saved_start; i++) ((uint32_t*)saved)[i] = ((uint32_t*)buf)[i] + vc->exp_bias; vc->dsp.vector_fmul_reverse(saved+saved_start, buf+saved_start, swin, vc->blocksize[0]/2); } } else { if(vc->add_bias) { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i] + fadd_bias; } else { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i]; } vc->dsp.vector_fmul_add_add(ret+k, buf, swin, saved+saved_start, vc->add_bias, vc->blocksize[0]/2, step); retlen=saved_start+vc->blocksize[0]/2; buf += vc->blocksize[0]/2; vc->dsp.vector_fmul_reverse(saved, buf, swin, vc->blocksize[0]/2); saved_start=0; } } vc->saved_start=saved_start; return retlen*vc->audio_channels; } libavcodec/vorbis_dec.c:1493: error: Uninitialized Value The value read from res_chan[_] was never initialized. libavcodec/vorbis_dec.c:1493:9: 1491. 1492. mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; 1493. ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; ^ 1494. vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); 1495. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis_dec.c/#L1493
d2a_code_trace_data_45217
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const 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_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, 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); } test/ssltest_old.c:2917: error: BUFFER_OVERRUN_L3 Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace test/ssltest_old.c:2917:9: Call 2915. char *s, buf[256]; 2916. 2917. s = X509_NAME_oneline(X509_get_subject_name(X509_STORE_CTX_get_current_cert(ctx)), ^ 2918. buf, sizeof buf); 2919. if (s != NULL) { crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:57:9: Array access: Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline` 55. } 56. strncpy(buf, "NO X509_NAME", len); 57. buf[len - 1] = '\0'; ^ 58. return buf; 59. }
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L57
d2a_code_trace_data_45218
int ssl_get_new_session(SSL *s, int session) { unsigned int tmp; SSL_SESSION *ss=NULL; GEN_SESSION_CB cb = def_generate_session_id; if ((ss=SSL_SESSION_new()) == NULL) return(0); if (s->ctx->session_timeout == 0) ss->timeout=SSL_get_default_timeout(s); else ss->timeout=s->ctx->session_timeout; if (s->session != NULL) { SSL_SESSION_free(s->session); s->session=NULL; } if (session) { if (s->version == SSL2_VERSION) { ss->ssl_version=SSL2_VERSION; ss->session_id_length=SSL2_SSL_SESSION_ID_LENGTH; } else if (s->version == SSL3_VERSION) { ss->ssl_version=SSL3_VERSION; ss->session_id_length=SSL3_SSL_SESSION_ID_LENGTH; } else if (s->version == TLS1_VERSION) { ss->ssl_version=TLS1_VERSION; ss->session_id_length=SSL3_SSL_SESSION_ID_LENGTH; } else { SSLerr(SSL_F_SSL_GET_NEW_SESSION,SSL_R_UNSUPPORTED_SSL_VERSION); SSL_SESSION_free(ss); return(0); } CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX); if(s->generate_session_id) cb = s->generate_session_id; else if(s->ctx->generate_session_id) cb = s->ctx->generate_session_id; CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX); tmp = ss->session_id_length; if(!cb(s, ss->session_id, &tmp)) { SSLerr(SSL_F_SSL_GET_NEW_SESSION, SSL_R_SSL_SESSION_ID_CALLBACK_FAILED); SSL_SESSION_free(ss); return(0); } if(!tmp || (tmp > ss->session_id_length)) { SSLerr(SSL_F_SSL_GET_NEW_SESSION, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH); SSL_SESSION_free(ss); return(0); } if((tmp < ss->session_id_length) && (s->version == SSL2_VERSION)) memset(ss->session_id + tmp, 0, ss->session_id_length - tmp); else ss->session_id_length = tmp; if(SSL_CTX_has_matching_session_id(s->ctx, ss->session_id, ss->session_id_length)) { SSLerr(SSL_F_SSL_GET_NEW_SESSION, SSL_R_SSL_SESSION_ID_CONFLICT); SSL_SESSION_free(ss); return(0); } } else { ss->session_id_length=0; } memcpy(ss->sid_ctx,s->sid_ctx,s->sid_ctx_length); ss->sid_ctx_length=s->sid_ctx_length; s->session=ss; ss->ssl_version=s->version; ss->verify_result = X509_V_OK; return(1); } ssl/ssl_sess.c:239: error: INTEGER_OVERFLOW_L2 ([16, 32] - [16, 31]):unsigned32. Showing all 5 steps of the trace ssl/ssl_sess.c:192:4: <LHS trace> 190. { 191. ss->ssl_version=SSL2_VERSION; 192. ss->session_id_length=SSL2_SSL_SESSION_ID_LENGTH; ^ 193. } 194. else if (s->version == SSL3_VERSION) ssl/ssl_sess.c:192:4: Assignment 190. { 191. ss->ssl_version=SSL2_VERSION; 192. ss->session_id_length=SSL2_SSL_SESSION_ID_LENGTH; ^ 193. } 194. else if (s->version == SSL3_VERSION) ssl/ssl_sess.c:192:4: <RHS trace> 190. { 191. ss->ssl_version=SSL2_VERSION; 192. ss->session_id_length=SSL2_SSL_SESSION_ID_LENGTH; ^ 193. } 194. else if (s->version == SSL3_VERSION) ssl/ssl_sess.c:192:4: Assignment 190. { 191. ss->ssl_version=SSL2_VERSION; 192. ss->session_id_length=SSL2_SSL_SESSION_ID_LENGTH; ^ 193. } 194. else if (s->version == SSL3_VERSION) ssl/ssl_sess.c:239:4: Binary operation: ([16, 32] - [16, 31]):unsigned32 237. /* If the session length was shrunk and we're SSLv2, pad it */ 238. if((tmp < ss->session_id_length) && (s->version == SSL2_VERSION)) 239. memset(ss->session_id + tmp, 0, ss->session_id_length - tmp); ^ 240. else 241. ss->session_id_length = tmp;
https://github.com/openssl/openssl/blob/dc644fe2292a9a7ac674a57d2a4be99d7daeab12/ssl/ssl_sess.c/#L239
d2a_code_trace_data_45219
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = AVMEDIA_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1, video_enc->strict_std_compliance); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_ocodecs] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); } video_enc->codec_id = codec_id; set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width; video_enc->height = frame_height; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; choose_pixel_fmt(st, codec); if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); av_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } nb_ocodecs++; if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); } video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; } ffmpeg.c:3353: error: Null Dereference pointer `st` last assigned on line 3348 could be null and is dereferenced at line 3353, column 35. ffmpeg.c:3342:1: start of procedure new_video_stream() 3340. } 3341. 3342. static void new_video_stream(AVFormatContext *oc) ^ 3343. { 3344. AVStream *st; ffmpeg.c:3348:5: 3346. enum CodecID codec_id; 3347. 3348. st = av_new_stream(oc, oc->nb_streams); ^ 3349. if (!st) { 3350. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2465:1: start of procedure av_new_stream() 2463. } 2464. 2465. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2466. { 2467. AVStream *st; libavformat/utils.c:2470:9: Taking true branch 2468. int i; 2469. 2470. if (s->nb_streams >= MAX_STREAMS) ^ 2471. return NULL; 2472. libavformat/utils.c:2471:9: 2469. 2470. if (s->nb_streams >= MAX_STREAMS) 2471. return NULL; ^ 2472. 2473. st = av_mallocz(sizeof(AVStream)); libavformat/utils.c:2505:1: return from a call to av_new_stream 2503. s->streams[s->nb_streams++] = st; 2504. return st; 2505. } ^ 2506. 2507. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3349:10: Taking true branch 3347. 3348. st = av_new_stream(oc, oc->nb_streams); 3349. if (!st) { ^ 3350. fprintf(stderr, "Could not alloc stream\n"); 3351. av_exit(1); ffmpeg.c:3350:9: 3348. st = av_new_stream(oc, oc->nb_streams); 3349. if (!st) { 3350. fprintf(stderr, "Could not alloc stream\n"); ^ 3351. av_exit(1); 3352. } ffmpeg.c:3351:9: Skipping av_exit(): empty list of specs 3349. if (!st) { 3350. fprintf(stderr, "Could not alloc stream\n"); 3351. av_exit(1); ^ 3352. } 3353. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); ffmpeg.c:3353:5: 3351. av_exit(1); 3352. } 3353. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); ^ 3354. bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; 3355. video_bitstream_filters= NULL;
https://github.com/libav/libav/blob/27241cbffe180fc92f9f519c6ea7957fc4b3b0c9/ffmpeg.c/#L3353
d2a_code_trace_data_45220
void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) { BN_ULONG t; int i; bn_wcheck_size(a, nwords); bn_wcheck_size(b, nwords); assert(a != b); assert((condition & (condition - 1)) == 0); assert(sizeof(BN_ULONG) >= sizeof(int)); condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; t = (a->top ^ b->top) & condition; a->top ^= t; b->top ^= t; #define BN_CONSTTIME_SWAP(ind) \ do { \ t = (a->d[ind] ^ b->d[ind]) & condition; \ a->d[ind] ^= t; \ b->d[ind] ^= t; \ } while (0) switch (nwords) { default: for (i = 10; i < nwords; i++) BN_CONSTTIME_SWAP(i); case 10: BN_CONSTTIME_SWAP(9); case 9: BN_CONSTTIME_SWAP(8); case 8: BN_CONSTTIME_SWAP(7); case 7: BN_CONSTTIME_SWAP(6); case 6: BN_CONSTTIME_SWAP(5); case 5: BN_CONSTTIME_SWAP(4); case 4: BN_CONSTTIME_SWAP(3); case 3: BN_CONSTTIME_SWAP(2); case 2: BN_CONSTTIME_SWAP(1); case 1: BN_CONSTTIME_SWAP(0); } #undef BN_CONSTTIME_SWAP } crypto/ec/ec2_mult.c:290: error: BUFFER_OVERRUN_L3 Offset: 8 Size: [0, 8388607] by call to `BN_consttime_swap`. Showing all 6 steps of the trace crypto/ec/ec2_mult.c:292:18: Call 290. BN_consttime_swap(word & mask, x1, x2, group_top); 291. BN_consttime_swap(word & mask, z1, z2, group_top); 292. if (!gf2m_Madd(group, point->X, x2, z2, x1, z1, ctx)) ^ 293. goto err; 294. if (!gf2m_Mdouble(group, x1, z1, ctx)) crypto/ec/ec2_mult.c:81:1: Parameter `x1->d` 79. * GF(2^m) without precomputation" (CHES '99, LNCS 1717). 80. */ 81. > static int gf2m_Madd(const EC_GROUP *group, const BIGNUM *x, BIGNUM *x1, 82. BIGNUM *z1, const BIGNUM *x2, const BIGNUM *z2, 83. BN_CTX *ctx) crypto/ec/ec2_mult.c:290:13: Call 288. word = bn_get_words(scalar)[i]; 289. while (mask) { 290. BN_consttime_swap(word & mask, x1, x2, group_top); ^ 291. BN_consttime_swap(word & mask, z1, z2, group_top); 292. if (!gf2m_Madd(group, point->X, x2, z2, x1, z1, ctx)) crypto/bn/bn_lib.c:830:1: <Length trace> 828. * a and b cannot be the same number 829. */ 830. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 831. { 832. BN_ULONG t; crypto/bn/bn_lib.c:830:1: Parameter `*b->d` 828. * a and b cannot be the same number 829. */ 830. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 831. { 832. BN_ULONG t; crypto/bn/bn_lib.c:863:9: Array access: Offset: 8 Size: [0, 8388607] by call to `BN_consttime_swap` 861. BN_CONSTTIME_SWAP(9); /* Fallthrough */ 862. case 9: 863. BN_CONSTTIME_SWAP(8); /* Fallthrough */ ^ 864. case 8: 865. BN_CONSTTIME_SWAP(7); /* Fallthrough */
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L863
d2a_code_trace_data_45221
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:565: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 563 could be null and is dereferenced at line 565, column 9. Showing all 13 steps of the trace test/drbgtest.c:558:1: start of procedure get_entropy_hook() 556. 557. /* Intercepts and counts calls to the get_entropy() callback */ 558. > static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout, 559. int entropy, size_t min_len, size_t max_len, 560. int prediction_resistance) test/drbgtest.c:563:5: 561. { 562. size_t ret; 563. > HOOK_CTX *ctx = get_hook_ctx(drbg); 564. 565. if (ctx->fail != 0) test/drbgtest.c:552:1: start of procedure get_hook_ctx() 550. static HOOK_CTX master_ctx, public_ctx, private_ctx; 551. 552. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 553. { 554. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); test/drbgtest.c:554:5: 552. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 553. { 554. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 555. } 556. crypto/rand/drbg_lib.c:1108:1: start of procedure RAND_DRBG_get_ex_data() 1106. } 1107. 1108. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 1109. { 1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:1110:5: 1108. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 1109. { 1110. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 1111. } 1112. crypto/ex_data.c:458:1: start of procedure CRYPTO_get_ex_data() 456. * particular index in the class used by this variable 457. */ 458. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:460:9: Taking true branch 458. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 461. return NULL; 462. return sk_void_value(ad->sk, idx); crypto/ex_data.c:461:9: 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 461. > return NULL; 462. return sk_void_value(ad->sk, idx); 463. } crypto/ex_data.c:463:1: return from a call to CRYPTO_get_ex_data 461. return NULL; 462. return sk_void_value(ad->sk, idx); 463. > } 464. 465. OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad) crypto/rand/drbg_lib.c:1111:1: return from a call to RAND_DRBG_get_ex_data 1109. { 1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 1111. > } 1112. 1113. test/drbgtest.c:555:1: return from a call to get_hook_ctx 553. { 554. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 555. > } 556. 557. /* Intercepts and counts calls to the get_entropy() callback */ test/drbgtest.c:565:9: 563. HOOK_CTX *ctx = get_hook_ctx(drbg); 564. 565. > if (ctx->fail != 0) 566. return 0; 567.
https://github.com/openssl/openssl/blob/6b3d0423528b049d04b299a8588a32d5c1224717/test/drbgtest.c/#L565
d2a_code_trace_data_45222
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) { char *ret; size_t n; if (str->length >= len) { memset(&str->data[len],0,str->length-len); str->length=len; return(len); } if (str->max >= len) { memset(&str->data[str->length],0,len-str->length); str->length=len; return(len); } if (len > LIMIT_BEFORE_EXPANSION) { BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); return 0; } n=(len+3)/3*4; if (str->data == NULL) ret=OPENSSL_malloc(n); else ret=OPENSSL_realloc_clean(str->data,str->max,n); if (ret == NULL) { BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); len=0; } else { str->data=ret; str->max=n; memset(&str->data[str->length],0,len-str->length); str->length=len; } return(len); } ssl/d1_clnt.c:481: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 10):unsigned64 by call to `ssl3_send_client_certificate`. Showing all 13 steps of the trace ssl/d1_clnt.c:165:1: Parameter `s->init_buf->length` 163. DTLSv1_2_enc_data) 164. 165. > int dtls1_connect(SSL *s) 166. { 167. BUF_MEM *buf=NULL; ssl/d1_clnt.c:481:8: Call 479. case SSL3_ST_CW_CERT_D: 480. dtls1_start_timer(s); 481. ret=ssl3_send_client_certificate(s); ^ 482. if (ret <= 0) goto end; 483. s->state=SSL3_ST_CW_KEY_EXCH_A; ssl/s3_clnt.c:3301:1: Parameter `s->init_buf->length` 3299. } 3300. 3301. > int ssl3_send_client_certificate(SSL *s) 3302. { 3303. X509 *x509=NULL; ssl/s3_clnt.c:3383:8: Call 3381. { 3382. s->state=SSL3_ST_CW_CERT_D; 3383. if (!ssl3_output_cert_chain(s, ^ 3384. (s->s3->tmp.cert_req == 2)?NULL:s->cert->key)) 3385. { ssl/s3_both.c:323:1: Parameter `s->init_buf->length` 321. } 322. 323. > unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk) 324. { 325. unsigned char *p; ssl/s3_both.c:328:7: Call 326. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s); 327. 328. if (!ssl_add_cert_chain(s, cpk, &l)) ^ 329. return 0; 330. ssl/ssl_cert.c:1114:1: Parameter `s->init_buf->length` 1112. 1113. /* Add certificate chain to internal SSL BUF_MEM strcuture */ 1114. > int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l) 1115. { 1116. BUF_MEM *buf = s->init_buf; ssl/ssl_cert.c:1124:7: Call 1122. 1123. /* TLSv1 sends a chain with nothing in it, instead of an alert */ 1124. if (!BUF_MEM_grow_clean(buf,10)) ^ 1125. { 1126. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN,ERR_R_BUF_LIB); crypto/buffer/buffer.c:139:1: <LHS trace> 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:139:1: Parameter `len` 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:139:1: <RHS trace> 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:139:1: Parameter `len` 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:146:3: Binary operation: ([0, +oo] - 10):unsigned64 by call to `ssl3_send_client_certificate` 144. if (str->length >= len) 145. { 146. memset(&str->data[len],0,str->length-len); ^ 147. str->length=len; 148. return(len);
https://github.com/openssl/openssl/blob/66f96fe2d519147097c118d4bf60704c69ed0635/crypto/buffer/buffer.c/#L146
d2a_code_trace_data_45223
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/ecdsatest.c:99: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dec2bn`. Showing all 21 steps of the trace test/ecdsatest.c:99:10: Call 97. if (!TEST_ptr(tmp = BN_new())) 98. return 0; 99. if (!TEST_true(BN_dec2bn(&tmp, numbers[fbytes_counter]))) { ^ 100. BN_free(tmp); 101. return 0; crypto/bn/bn_print.c:197:1: Parameter `(*bn)->top` 195. } 196. 197. > int BN_dec2bn(BIGNUM **bn, const char *a) 198. { 199. BIGNUM *ret = NULL; crypto/bn/bn_print.c:230:9: Call 228. } else { 229. ret = *bn; 230. BN_zero(ret); ^ 231. } 232. crypto/bn/bn_lib.c:395:1: Parameter `a->top` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `a->top` 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:284:1: Parameter `b->top` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `words` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:263:13: Call 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:186:1: Parameter `num` 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:17: Call 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); ^ 189. 190. FAILTEST(); crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/mem.c:188:5: Assignment 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); ^ 189. 190. FAILTEST(); crypto/mem.c:193:5: Assignment 191. if (ret != NULL) 192. memset(ret, 0, num); 193. return ret; ^ 194. } 195. crypto/bn/bn_lib.c:263:9: Assignment 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dec2bn` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/05eec39505ba8af6f3c1558a26c565987707cd37/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_45224
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/rsa_sp800_56b_test.c:222: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `rsa_check_prime_factor_range`. Showing all 14 steps of the trace test/rsa_sp800_56b_test.c:222:14: Call 220. && TEST_ptr(ctx = BN_CTX_new()) 221. && TEST_true(BN_set_word(p, 0xA)) 222. && TEST_false(rsa_check_prime_factor_range(p, 8, ctx)) ^ 223. && TEST_true(BN_set_word(p, 0x10)) 224. && TEST_false(rsa_check_prime_factor_range(p, 8, ctx)) crypto/rsa/rsa_sp800_56b_check.c:84:1: Parameter `ctx->stack.depth` 82. * 0xFFFFFFFF_FFFF.......................FFF 83. */ 84. > int rsa_check_prime_factor_range(const BIGNUM *p, int nbits, BN_CTX *ctx) 85. { 86. int ret = 0; crypto/rsa/rsa_sp800_56b_check.c:95:5: Call 93. return 0; 94. 95. BN_CTX_start(ctx); ^ 96. tmp = BN_CTX_get(ctx); 97. low = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/rsa/rsa_sp800_56b_check.c:96:11: Call 94. 95. BN_CTX_start(ctx); 96. tmp = BN_CTX_get(ctx); ^ 97. low = BN_CTX_get(ctx); 98. 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/rsa/rsa_sp800_56b_check.c:97:11: Call 95. BN_CTX_start(ctx); 96. tmp = BN_CTX_get(ctx); 97. low = BN_CTX_get(ctx); ^ 98. 99. /* set low = (√2)(2^(nbits/2 - 1) */ 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/rsa/rsa_sp800_56b_check.c:113:5: Call 111. ret = 1; 112. err: 113. BN_CTX_end(ctx); ^ 114. return ret; 115. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `rsa_check_prime_factor_range` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45225
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1167: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1167:9: 1165. //FIXME try some early stop 1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) 1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) 1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1167
d2a_code_trace_data_45226
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/dcadec.c:1969: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays`. libavcodec/dcadec.c:1735:16: Call 1733. 1734. init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); 1735. if ((ret = dca_parse_frame_header(s)) < 0) { ^ 1736. //seems like the frame is corrupt, try with the next one 1737. return ret; libavcodec/dcadec.c:570:28: Call 568. s->samples_deficit = get_bits(&s->gb, 5) + 1; 569. s->crc_present = get_bits(&s->gb, 1); 570. s->sample_blocks = get_bits(&s->gb, 7) + 1; ^ 571. s->frame_size = get_bits(&s->gb, 14) + 1; 572. if (s->frame_size < 95) libavcodec/get_bits.h:244:5: Call 242. register int tmp; 243. OPEN_READER(re, s); 244. UPDATE_CACHE(re, s); ^ 245. tmp = SHOW_UBITS(re, s, n); 246. LAST_SKIP_BITS(re, s, n); libavutil/bswap.h:68:1: Parameter `x` 66. 67. #ifndef av_bswap32 68. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) ^ 69. { 70. return AV_BSWAP32C(x); libavutil/bswap.h:70:5: Assignment 68. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 69. { 70. return AV_BSWAP32C(x); ^ 71. } 72. #endif libavcodec/get_bits.h:244:5: Assignment 242. register int tmp; 243. OPEN_READER(re, s); 244. UPDATE_CACHE(re, s); ^ 245. tmp = SHOW_UBITS(re, s, n); 246. LAST_SKIP_BITS(re, s, n); libavcodec/get_bits.h:245:5: Assignment 243. OPEN_READER(re, s); 244. UPDATE_CACHE(re, s); 245. tmp = SHOW_UBITS(re, s, n); ^ 246. LAST_SKIP_BITS(re, s, n); 247. CLOSE_READER(re, s); libavcodec/get_bits.h:248:5: Assignment 246. LAST_SKIP_BITS(re, s, n); 247. CLOSE_READER(re, s); 248. return tmp; ^ 249. } 250. libavcodec/dcadec.c:570:5: Assignment 568. s->samples_deficit = get_bits(&s->gb, 5) + 1; 569. s->crc_present = get_bits(&s->gb, 1); 570. s->sample_blocks = get_bits(&s->gb, 7) + 1; ^ 571. s->frame_size = get_bits(&s->gb, 14) + 1; 572. if (s->frame_size < 95) libavcodec/dcadec.c:1949:5: Assignment 1947. 1948. /* get output buffer */ 1949. frame->nb_samples = 256 * (s->sample_blocks / 8); ^ 1950. if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { 1951. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); libavcodec/dcadec.c:1969:15: Call 1967. return AVERROR(ENOMEM); 1968. 1969. ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL, ^ 1970. s->extra_channels_buffer, 1971. full_channels - channels, libavutil/samplefmt.c:140:1: Parameter `nb_samples` 138. } 139. 140. int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, ^ 141. const uint8_t *buf, int nb_channels, int nb_samples, 142. enum AVSampleFormat sample_fmt, int align) libavutil/samplefmt.c:147:16: Call 145. 146. planar = av_sample_fmt_is_planar(sample_fmt); 147. buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples, ^ 148. sample_fmt, align); 149. if (buf_size < 0) libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_45227
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:1906: error: Buffer Overrun L2 Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `interlaced_search`. libavcodec/motion_est.c:1906:17: Call 1904. c->skip=0; 1905. c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV; 1906. interlaced_search(s, 2, ^ 1907. s->b_field_mv_table[1], s->b_field_select_table[1], 1908. s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 1); 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:1241:11: Call 1239. } 1240. 1241. dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 1242. 1243. *mx_ptr= best[0]; libavcodec/motion_est_template.c:973:1: Parameter `ref_index` 971. } 972. 973. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, ^ 974. int src_index, int ref_index, int const penalty_factor, 975. int size, int h, int flags){ libavcodec/motion_est_template.c:980:18: Call 978. return funny_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); 979. else if(c->dia_size<-1) 980. return sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 981. else if(c->dia_size<2) 982. return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); libavcodec/motion_est_template.c:809:1: Parameter `ref_index` 807. 808. #define MAX_SAB_SIZE ME_MAP_SIZE 809. static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, ^ 810. int src_index, int ref_index, int const penalty_factor, 811. int size, int h, int flags) libavcodec/motion_est_template.c:872:9: Call 870. continue; 871. 872. SAB_CHECK_MV(x-1, y) ^ 873. SAB_CHECK_MV(x+1, y) 874. SAB_CHECK_MV(x , y-1) libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:208:50: Array access: Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `interlaced_search` 206. if(chroma){ 207. uint8_t * const uvtemp= c->temp + 16*stride; 208. c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); ^ 209. c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); 210. d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L208
d2a_code_trace_data_45228
static void rtmp_calc_digest(const uint8_t *src, int len, int gap, const uint8_t *key, int keylen, uint8_t *dst) { struct AVSHA *sha; uint8_t hmac_buf[64+32] = {0}; int i; sha = av_mallocz(av_sha_size); if (keylen < 64) { memcpy(hmac_buf, key, keylen); } else { av_sha_init(sha, 256); av_sha_update(sha,key, keylen); av_sha_final(sha, hmac_buf); } for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64); if (gap <= 0) { av_sha_update(sha, src, len); } else { av_sha_update(sha, src, gap); av_sha_update(sha, src + gap + 32, len - gap - 32); } av_sha_final(sha, hmac_buf + 64); for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL ^ HMAC_OPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64+32); av_sha_final(sha, dst); av_free(sha); } libavformat/rtmpproto.c:382: error: Null Dereference pointer `sha` last assigned on line 377 could be null and is dereferenced by call to `av_sha_init()` at line 382, column 9. libavformat/rtmpproto.c:370:1: start of procedure rtmp_calc_digest() 368. * @param dst buffer where calculated digest will be stored (32 bytes) 369. */ 370. static void rtmp_calc_digest(const uint8_t *src, int len, int gap, ^ 371. const uint8_t *key, int keylen, uint8_t *dst) 372. { libavformat/rtmpproto.c:374:5: 372. { 373. struct AVSHA *sha; 374. uint8_t hmac_buf[64+32] = {0}; ^ 375. int i; 376. libavformat/rtmpproto.c:377:5: 375. int i; 376. 377. sha = av_mallocz(av_sha_size); ^ 378. 379. if (keylen < 64) { libavutil/mem.c:154:1: start of procedure av_mallocz() 152. } 153. 154. void *av_mallocz(size_t size) ^ 155. { 156. void *ptr = av_malloc(size); libavutil/mem.c:156:5: 154. void *av_mallocz(size_t size) 155. { 156. void *ptr = av_malloc(size); ^ 157. if (ptr) 158. memset(ptr, 0, size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:157:9: Taking false branch 155. { 156. void *ptr = av_malloc(size); 157. if (ptr) ^ 158. memset(ptr, 0, size); 159. return ptr; libavutil/mem.c:159:5: 157. if (ptr) 158. memset(ptr, 0, size); 159. return ptr; ^ 160. } 161. libavutil/mem.c:160:1: return from a call to av_mallocz 158. memset(ptr, 0, size); 159. return ptr; 160. } ^ 161. 162. char *av_strdup(const char *s) libavformat/rtmpproto.c:379:9: Taking false branch 377. sha = av_mallocz(av_sha_size); 378. 379. if (keylen < 64) { ^ 380. memcpy(hmac_buf, key, keylen); 381. } else { libavformat/rtmpproto.c:382:9: 380. memcpy(hmac_buf, key, keylen); 381. } else { 382. av_sha_init(sha, 256); ^ 383. av_sha_update(sha,key, keylen); 384. av_sha_final(sha, hmac_buf); libavutil/sha.c:245:1: start of procedure av_sha_init() 243. 244. 245. int av_sha_init(AVSHA* ctx, int bits) ^ 246. { 247. ctx->digest_len = bits >> 5; libavutil/sha.c:247:5: 245. int av_sha_init(AVSHA* ctx, int bits) 246. { 247. ctx->digest_len = bits >> 5; ^ 248. switch (bits) { 249. case 160: // SHA-1
https://github.com/libav/libav/blob/3ffe32eb96e2414bdd87b353953d77fb83eca8ae/libavformat/rtmpproto.c/#L382
d2a_code_trace_data_45229
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: [112+min(0, `c->synth_buf_offset[*]`), 113+max(511, `c->synth_buf_offset[*]`)] (⇐ [48+min(0, `c->synth_buf_offset[*]`), 49+max(511, `c->synth_buf_offset[*]`)] + 64) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:898:5: Assignment 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; ^ 899. SUM8(sum, -=, w + 32, p); 900. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:899:5: Array access: Offset: [112+min(0, c->synth_buf_offset[*]), 113+max(511, c->synth_buf_offset[*])] (⇐ [48+min(0, c->synth_buf_offset[*]), 49+max(511, c->synth_buf_offset[*])] + 64) Size: 2 by call to `ff_mpa_synth_filter` 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p); ^ 900. *samples = round_sample(&sum); 901. samples += incr;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L899
d2a_code_trace_data_45230
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:1060: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 14]):unsigned64 by call to `WPACKET_put_bytes`. Showing all 10 steps of the trace ssl/t1_lib.c:1059:21: Call 1057. || !WPACKET_start_sub_packet_u16(pkt) 1058. /* Sub-packet for servername list (always 1 hostname)*/ 1059. || !WPACKET_start_sub_packet_u16(pkt) ^ 1060. || !WPACKET_put_bytes(pkt, TLSEXT_NAMETYPE_host_name, 1) 1061. || !WPACKET_sub_memcpy(pkt, s->tlsext_hostname, ssl/packet.c:190:1: Parameter `pkt->buf->length` 188. } 189. 190. > int WPACKET_start_sub_packet_len(WPACKET *pkt, size_t lenbytes) 191. { 192. WPACKET_SUB *sub; ssl/t1_lib.c:1060:21: Call 1058. /* Sub-packet for servername list (always 1 hostname)*/ 1059. || !WPACKET_start_sub_packet_u16(pkt) 1060. || !WPACKET_put_bytes(pkt, TLSEXT_NAMETYPE_host_name, 1) ^ 1061. || !WPACKET_sub_memcpy(pkt, s->tlsext_hostname, 1062. strlen(s->tlsext_hostname), 2) 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 + 14]):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_45231
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:243: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul_reciprocal`. Showing all 30 steps of the trace crypto/bn/bn_exp.c:161:1: Parameter `ctx->stack.depth` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:191:5: Call 189. } 190. 191. BN_CTX_start(ctx); ^ 192. aa = BN_CTX_get(ctx); 193. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:192:10: Call 190. 191. BN_CTX_start(ctx); 192. aa = BN_CTX_get(ctx); ^ 193. val[0] = BN_CTX_get(ctx); 194. if (val[0] == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:193:14: Call 191. BN_CTX_start(ctx); 192. aa = BN_CTX_get(ctx); 193. val[0] = BN_CTX_get(ctx); ^ 194. if (val[0] == NULL) 195. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:210:10: Call 208. } 209. 210. if (!BN_nnmod(val[0], a, m, ctx)) ^ 211. goto err; /* 1 */ 212. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_exp.c:243:22: Call 241. if (BN_is_bit_set(p, wstart) == 0) { 242. if (!start) 243. if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx)) ^ 244. goto err; 245. if (wstart == 0) crypto/bn/bn_recp.c:55:1: Parameter `ctx->stack.depth` 53. } 54. 55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, 56. BN_RECP_CTX *recp, BN_CTX *ctx) 57. { crypto/bn/bn_recp.c:62:5: Call 60. const BIGNUM *ca; 61. 62. BN_CTX_start(ctx); ^ 63. if ((a = BN_CTX_get(ctx)) == NULL) 64. 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_recp.c:63:14: Call 61. 62. BN_CTX_start(ctx); 63. if ((a = BN_CTX_get(ctx)) == NULL) ^ 64. goto err; 65. if (y != NULL) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_recp.c:70:18: Call 68. goto err; 69. } else { 70. if (!BN_mul(a, x, y, ctx)) ^ 71. goto err; 72. } crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } 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_reciprocal` 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_45232
const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ int i; assert(p<=end); if(p>=end) return end; for(i=0; i<3; i++){ uint32_t tmp= *state << 8; *state= tmp + *(p++); if(tmp == 0x100 || p==end) return p; } while(p<end){ if (p[-1] > 1 ) p+= 3; else if(p[-2] ) p+= 2; else if(p[-3]|(p[-1]-1)) p++; else{ p++; break; } } p= FFMIN(p, end)-4; *state= AV_RB32(p); return p+4; } libavcodec/mpeg12.c:1903: error: Integer Overflow L1 ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `ff_find_start_code`. libavcodec/mpeg12.c:1902:9: Assignment 1900. return 0; 1901. 1902. start_code= -1; ^ 1903. buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code); 1904. mb_y= start_code - SLICE_MIN_START_CODE; libavcodec/mpeg12.c:1903:15: Call 1901. 1902. start_code= -1; 1903. buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code); ^ 1904. mb_y= start_code - SLICE_MIN_START_CODE; 1905. if(mb_y < 0 || mb_y >= s->end_mb_y) libavcodec/mpegvideo.c:82:1: <LHS trace> 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:82:1: Parameter `*state` 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:90:9: Assignment 88. 89. for(i=0; i<3; i++){ 90. uint32_t tmp= *state << 8; ^ 91. *state= tmp + *(p++); 92. if(tmp == 0x100 || p==end) libavcodec/mpegvideo.c:82:1: <RHS trace> 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:82:1: Parameter `*p` 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:91:9: Binary operation: ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `ff_find_start_code` 89. for(i=0; i<3; i++){ 90. uint32_t tmp= *state << 8; 91. *state= tmp + *(p++); ^ 92. if(tmp == 0x100 || p==end) 93. return p;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo.c/#L91
d2a_code_trace_data_45233
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: [97+min(0, `c->synth_buf_offset[*]`), 112+max(511, `c->synth_buf_offset[*]`)] (⇐ [33+min(0, `c->synth_buf_offset[*]`), 48+max(511, `c->synth_buf_offset[*]`)] + 64) 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: [97+min(0, c->synth_buf_offset[*]), 112+max(511, c->synth_buf_offset[*])] (⇐ [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] + 64) 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_45234
static void fill_decode_caches(H264Context *h, int mb_type){ MpegEncContext * const s = &h->s; int topleft_xy, top_xy, topright_xy, left_xy[2]; int topleft_type, top_type, topright_type, left_type[2]; const uint8_t * left_block= h->left_block; int i; topleft_xy = h->topleft_mb_xy ; top_xy = h->top_mb_xy ; topright_xy = h->topright_mb_xy; left_xy[0] = h->left_mb_xy[0] ; left_xy[1] = h->left_mb_xy[1] ; topleft_type = h->topleft_type ; top_type = h->top_type ; topright_type= h->topright_type ; left_type[0] = h->left_type[0] ; left_type[1] = h->left_type[1] ; if(!IS_SKIP(mb_type)){ if(IS_INTRA(mb_type)){ int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; h->topleft_samples_available= h->top_samples_available= h->left_samples_available= 0xFFFF; h->topright_samples_available= 0xEEEA; if(!(top_type & type_mask)){ h->topleft_samples_available= 0xB3FF; h->top_samples_available= 0x33FF; h->topright_samples_available= 0x26EA; } if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){ if(IS_INTERLACED(mb_type)){ if(!(left_type[0] & type_mask)){ h->topleft_samples_available&= 0xDFFF; h->left_samples_available&= 0x5FFF; } if(!(left_type[1] & type_mask)){ h->topleft_samples_available&= 0xFF5F; h->left_samples_available&= 0xFF5F; } }else{ int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0; assert(left_xy[0] == left_xy[1]); if(!((left_typei & type_mask) && (left_type[0] & type_mask))){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } }else{ if(!(left_type[0] & type_mask)){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } if(!(topleft_type & type_mask)) h->topleft_samples_available&= 0x7FFF; if(!(topright_type & type_mask)) h->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(mb_type)){ if(IS_INTRA4x4(top_type)){ AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]); }else{ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask); } for(i=0; i<2; i++){ if(IS_INTRA4x4(left_type[i])){ int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]]; h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]]; h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]]; }else{ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask); } } } } if(top_type){ AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]); h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8]; h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8]; h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8]; h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8]; }else { h->non_zero_count_cache[1+8*0]= h->non_zero_count_cache[2+8*0]= h->non_zero_count_cache[1+8*3]= h->non_zero_count_cache[2+8*3]= AV_WN32A(&h->non_zero_count_cache[4+8*0], CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040); } for (i=0; i<2; i++) { if(left_type[i]){ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]]; h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]]; h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]]; h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]]; }else{ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64; } } if( CABAC ) { if(top_type) { h->top_cbp = h->cbp_table[top_xy]; } else if(IS_INTRA(mb_type)) { h->top_cbp = 0x1CF; } else { h->top_cbp = 0x00F; } if (left_type[0]) { h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0; } else if(IS_INTRA(mb_type)) { h->left_cbp = 0x1CF; } else { h->left_cbp = 0x00F; } if (left_type[0]) { h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1; } if (left_type[1]) { h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; } } } #if 1 if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){ int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list)){ continue; } assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)); h->mv_cache_clean[list]= 0; if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride; AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]); h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; }else{ AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]); AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101); } for(i=0; i<2; i++){ int cache_idx = scan8[0] - 1 + i*2*8; if(USES_LIST(left_type[i], list)){ const int b_xy= h->mb2b_xy[left_xy[i]] + 3; const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1; AV_COPY32(h->mv_cache[list][cache_idx ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]); AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]); h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; }else{ AV_ZERO32(h->mv_cache [list][cache_idx ]); AV_ZERO32(h->mv_cache [list][cache_idx+8]); h->ref_cache[list][cache_idx ]= h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if(USES_LIST(topleft_type, list)){ const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride); const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (h->topleft_partition & h->b8_stride); AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]); h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]); h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(USES_LIST(topright_type, list)){ const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride; AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]); h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]); h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF) continue; if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) { h->ref_cache[list][scan8[5 ]+1] = h->ref_cache[list][scan8[7 ]+1] = h->ref_cache[list][scan8[13]+1] = h->ref_cache[list][scan8[4 ]] = h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE; AV_ZERO32(h->mv_cache [list][scan8[5 ]+1]); AV_ZERO32(h->mv_cache [list][scan8[7 ]+1]); AV_ZERO32(h->mv_cache [list][scan8[13]+1]); AV_ZERO32(h->mv_cache [list][scan8[4 ]]); AV_ZERO32(h->mv_cache [list][scan8[12]]); if( CABAC ) { if(USES_LIST(top_type, list)){ const int b_xy= h->mb2br_xy[top_xy]; AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]); }else{ AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]); } if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2br_xy[left_xy[0]] + 6; AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]); AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]); }else{ AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]); AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]); } if(USES_LIST(left_type[1], list)){ const int b_xy= h->mb2br_xy[left_xy[1]] + 6; AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]); AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]); }else{ AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]); AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]); } AV_ZERO16(h->mvd_cache [list][scan8[5 ]+1]); AV_ZERO16(h->mvd_cache [list][scan8[7 ]+1]); AV_ZERO16(h->mvd_cache [list][scan8[13]+1]); AV_ZERO16(h->mvd_cache [list][scan8[4 ]]); AV_ZERO16(h->mvd_cache [list][scan8[12]]); if(h->slice_type_nos == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1); if(IS_DIRECT(top_type)){ AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_DIRECT2>>1)); }else if(IS_8X8(top_type)){ int b8_xy = 4*top_xy; h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2]; h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3]; }else{ AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1)); } if(IS_DIRECT(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1; else if(IS_8X8(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)]; else h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1; if(IS_DIRECT(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1; else if(IS_8X8(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)]; else h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1; } } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\ MAP_F2F(scan8[0] - 1 + 3*8, left_type[1]) if(MB_FIELD){ #define MAP_F2F(idx, mb_type)\ if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] <<= 1;\ h->mv_cache[list][idx][1] /= 2;\ h->mvd_cache[list][idx][1] >>=1;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, mb_type)\ if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] >>= 1;\ h->mv_cache[list][idx][1] <<= 1;\ h->mvd_cache[list][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); } libavcodec/h264.h:1089: error: Integer Overflow L1 (16843009 × 128):signed32. libavcodec/h264.h:1089:25: Binary operation: (16843009 × 128):signed32 1087. 1088. if(IS_DIRECT(top_type)){ 1089. AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_DIRECT2>>1)); ^ 1090. }else if(IS_8X8(top_type)){ 1091. int b8_xy = 4*top_xy;
https://github.com/libav/libav/blob/479e1e617078476f14598cd62769b4c9ca4025e2/libavcodec/h264.h/#L1089
d2a_code_trace_data_45235
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) { char *s, *c, *b; int l, i; l = 80 - 2 - obase; b = X509_NAME_oneline(name, NULL, 0); if (!b) return 0; if (!*b) { OPENSSL_free(b); return 1; } s = b + 1; c = s; for (;;) { #ifndef CHARSET_EBCDIC if (((*s == '/') && ((s[1] >= 'A') && (s[1] <= 'Z') && ((s[2] == '=') || ((s[2] >= 'A') && (s[2] <= 'Z') && (s[3] == '=')) ))) || (*s == '\0')) #else if (((*s == '/') && (isupper(s[1]) && ((s[2] == '=') || (isupper(s[2]) && (s[3] == '=')) ))) || (*s == '\0')) #endif { i = s - c; if (BIO_write(bp, c, i) != i) goto err; c = s + 1; if (*s != '\0') { if (BIO_write(bp, ", ", 2) != 2) goto err; } l--; } if (*s == '\0') break; s++; l--; } OPENSSL_free(b); return 1; err: X509err(X509_F_X509_NAME_PRINT, ERR_R_BUF_LIB); OPENSSL_free(b); return 0; } crypto/x509/x_name.c:552: error: BUFFER_OVERRUN_L3 Offset: [4, +oo] (⇐ [1, +oo] + 3) Size: [1, 2147483644]. Showing all 6 steps of the trace crypto/x509/x_name.c:536:9: <Length trace> 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x_name.c:536:9: Call 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x509_obj.c:97:9: Assignment 95. len = 200; 96. } else if (len == 0) { 97. return NULL; ^ 98. } 99. if (a == NULL) { crypto/x509/x_name.c:536:5: Assignment 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x_name.c:543:5: Assignment 541. return 1; 542. } 543. s = b + 1; /* skip the first slash */ ^ 544. 545. c = s; crypto/x509/x_name.c:552:55: Array access: Offset: [4, +oo] (⇐ [1, +oo] + 3) Size: [1, 2147483644] 550. ((s[2] >= 'A') 551. && (s[2] <= 'Z') 552. && (s[3] == '=')) ^ 553. ))) || (*s == '\0')) 554. #else
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x_name.c/#L552
d2a_code_trace_data_45236
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:1085: error: Buffer Overrun L1 Offset: [8, 9] (⇐ [0, 1] + 8) Size: 4 by call to `cmp`. libavcodec/motion_est.c:1025:1: Parameter `*s->current_picture_ptr->ref_index[*]` 1023. } 1024. 1025. static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){ ^ 1026. MotionEstContext * const c= &s->me; 1027. Picture *p= s->current_picture_ptr; libavcodec/motion_est.c:1063:13: Assignment 1061. 1062. if(USES_LIST(mb_type, 0)){ 1063. int field_select0= p->ref_index[0][xy ]; ^ 1064. int field_select1= p->ref_index[0][xy2]; 1065. assert(field_select0==0 ||field_select0==1); libavcodec/motion_est.c:1085:17: Call 1083. x= p->motion_val[0][xy ][0]; 1084. y= p->motion_val[0][xy ][1]; 1085. d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0, 0, cmpf, chroma_cmpf, flags); ^ 1086. x= p->motion_val[0][xy2][0]; 1087. y= p->motion_val[0][xy2][1]; libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:176:50: Array access: Offset: [8, 9] (⇐ [0, 1] + 8) Size: 4 by call to `cmp` 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_45237
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/ssltest_old.c:2889: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`. Showing all 14 steps of the trace test/ssltest_old.c:2888:9: Call 2886. if ((dh = DH_new()) == NULL) 2887. return NULL; 2888. p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); ^ 2889. g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); 2890. if ((p == NULL) || (g == NULL) || !DH_set0_pqg(dh, p, NULL, g)) { crypto/bn/bn_lib.c:407:1: Parameter `*ret->d` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; test/ssltest_old.c:2889:9: Call 2887. return NULL; 2888. p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); 2889. g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); ^ 2890. if ((p == NULL) || (g == NULL) || !DH_set0_pqg(dh, p, NULL, g)) { 2891. DH_free(dh); crypto/bn/bn_lib.c:407:1: Parameter `*ret->d` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; crypto/bn/bn_lib.c:429:9: Call 427. i = ((n - 1) / BN_BYTES) + 1; 428. m = ((n - 1) % (BN_BYTES)); 429. if (bn_wexpand(ret, (int)i) == NULL) { ^ 430. BN_free(bn); 431. return NULL; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:284:1: Parameter `*b->d` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_45238
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1426: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 13]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 10 steps of the trace ssl/t1_lib.c:1425:14: Call 1423. if (!s->hit && s->servername_done == 1 1424. && s->session->tlsext_hostname != NULL) { 1425. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) ^ 1426. || !WPACKET_put_bytes_u16(pkt, 0)) { 1427. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:242:1: Parameter `pkt->buf->length` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/t1_lib.c:1426:21: Call 1424. && s->session->tlsext_hostname != NULL) { 1425. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) 1426. || !WPACKET_put_bytes_u16(pkt, 0)) { ^ 1427. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); 1428. return 0; ssl/packet.c:242:1: Parameter `pkt->written` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/packet.c:250:17: Call 248. 249. if (size > sizeof(unsigned int) 250. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 251. || !put_value(data, val, size)) 252. return 0; ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 13]):unsigned64 by call to `WPACKET_put_bytes__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25
d2a_code_trace_data_45239
static void print_key_details(BIO *out, EVP_PKEY *key) { int keyid = EVP_PKEY_id(key); #ifndef OPENSSL_NO_EC if (keyid == EVP_PKEY_EC) { EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); int nid; const char *cname; nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); EC_KEY_free(ec); cname = EC_curve_nid2nist(nid); if (!cname) cname = OBJ_nid2sn(nid); BIO_printf(out, "%d bits EC (%s)", EVP_PKEY_bits(key), cname); } else #endif { const char *algname; switch (keyid) { case EVP_PKEY_RSA: algname = "RSA"; break; case EVP_PKEY_DSA: algname = "DSA"; break; case EVP_PKEY_DH: algname = "DH"; break; default: algname = OBJ_nid2sn(keyid); break; } BIO_printf(out, "%d bits %s", EVP_PKEY_bits(key), algname); } } test/ssltest.c:848: error: NULL_DEREFERENCE pointer `ec` last assigned on line 845 could be null and is dereferenced by call to `EC_KEY_get0_group()` at line 848, column 39. Showing all 19 steps of the trace test/ssltest.c:840:1: start of procedure print_key_details() 838. } 839. 840. > static void print_key_details(BIO *out, EVP_PKEY *key) 841. { 842. int keyid = EVP_PKEY_id(key); test/ssltest.c:842:5: 840. static void print_key_details(BIO *out, EVP_PKEY *key) 841. { 842. > int keyid = EVP_PKEY_id(key); 843. #ifndef OPENSSL_NO_EC 844. if (keyid == EVP_PKEY_EC) { crypto/evp/p_lib.c:410:1: start of procedure EVP_PKEY_id() 408. } 409. 410. > int EVP_PKEY_id(const EVP_PKEY *pkey) 411. { 412. return pkey->type; crypto/evp/p_lib.c:412:5: 410. int EVP_PKEY_id(const EVP_PKEY *pkey) 411. { 412. > return pkey->type; 413. } 414. crypto/evp/p_lib.c:413:1: return from a call to EVP_PKEY_id 411. { 412. return pkey->type; 413. > } 414. 415. int EVP_PKEY_base_id(const EVP_PKEY *pkey) test/ssltest.c:844:9: Taking true branch 842. int keyid = EVP_PKEY_id(key); 843. #ifndef OPENSSL_NO_EC 844. if (keyid == EVP_PKEY_EC) { ^ 845. EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 846. int nid; test/ssltest.c:845:9: 843. #ifndef OPENSSL_NO_EC 844. if (keyid == EVP_PKEY_EC) { 845. > EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 846. int nid; 847. const char *cname; crypto/evp/p_lib.c:356:1: start of procedure EVP_PKEY_get1_EC_KEY() 354. } 355. 356. > EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 357. { 358. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); crypto/evp/p_lib.c:358:5: 356. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 357. { 358. > EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 359. if (ret != NULL) 360. EC_KEY_up_ref(ret); crypto/evp/p_lib.c:347:1: start of procedure EVP_PKEY_get0_EC_KEY() 345. } 346. 347. > EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 348. { 349. if (pkey->type != EVP_PKEY_EC) { crypto/evp/p_lib.c:349:9: Taking false branch 347. EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 348. { 349. if (pkey->type != EVP_PKEY_EC) { ^ 350. EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY); 351. return NULL; crypto/evp/p_lib.c:353:5: 351. return NULL; 352. } 353. > return pkey->pkey.ec; 354. } 355. crypto/evp/p_lib.c:354:1: return from a call to EVP_PKEY_get0_EC_KEY 352. } 353. return pkey->pkey.ec; 354. > } 355. 356. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) crypto/evp/p_lib.c:359:9: Taking false branch 357. { 358. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 359. if (ret != NULL) ^ 360. EC_KEY_up_ref(ret); 361. return ret; crypto/evp/p_lib.c:361:5: 359. if (ret != NULL) 360. EC_KEY_up_ref(ret); 361. > return ret; 362. } 363. #endif crypto/evp/p_lib.c:362:1: return from a call to EVP_PKEY_get1_EC_KEY 360. EC_KEY_up_ref(ret); 361. return ret; 362. > } 363. #endif 364. test/ssltest.c:848:9: 846. int nid; 847. const char *cname; 848. > nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); 849. EC_KEY_free(ec); 850. cname = EC_curve_nid2nist(nid); crypto/ec/ec_key.c:438:1: start of procedure EC_KEY_get0_group() 436. } 437. 438. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 439. { 440. return key->group; crypto/ec/ec_key.c:440:5: 438. const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 439. { 440. > return key->group; 441. } 442.
https://github.com/openssl/openssl/blob/928623825cc59e272e2031cd3f07c5b7bbd605d4/test/ssltest.c/#L848
d2a_code_trace_data_45240
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:1078: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1078:17: 1076. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) 1077. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line 1078. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, ^ 1079. (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 1080. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1078
d2a_code_trace_data_45241
void TIFFSwabShort(uint16* wp) { register unsigned char* cp = (unsigned char*) wp; unsigned char t; assert(sizeof(uint16)==2); t = cp[1]; cp[1] = cp[0]; cp[0] = t; } libtiff/tif_dirwrite.c:813: error: Buffer Overrun L3 Offset: [17, +oo] (⇐ [16, +oo] + 1) Size: [0, +oo] by call to `TIFFSwabShort`. libtiff/tif_dirwrite.c:345:1: Parameter `tif->tif_diroff` 343. } 344. 345. static int ^ 346. TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) 347. { libtiff/tif_dirwrite.c:792:9: Call 790. } 791. } 792. dirmem=_TIFFmalloc(dirsize); ^ 793. if (dirmem==NULL) 794. { libtiff/tif_unix.c:253:1: Parameter `s` 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:10: Array declaration 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:256:2: Assignment 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_dirwrite.c:792:2: Assignment 790. } 791. } 792. dirmem=_TIFFmalloc(dirsize); ^ 793. if (dirmem==NULL) 794. { libtiff/tif_dirwrite.c:803:3: Assignment 801. uint32 nTmp; 802. TIFFDirEntry* o; 803. n=dirmem; ^ 804. *(uint16*)n=ndir; 805. if (tif->tif_flags&TIFF_SWAB) libtiff/tif_dirwrite.c:807:3: Assignment 805. if (tif->tif_flags&TIFF_SWAB) 806. TIFFSwabShort((uint16*)n); 807. n+=2; ^ 808. o=dir; 809. for (m=0; m<ndir; m++) libtiff/tif_dirwrite.c:813:5: Call 811. *(uint16*)n=o->tdir_tag; 812. if (tif->tif_flags&TIFF_SWAB) 813. TIFFSwabShort((uint16*)n); ^ 814. n+=2; 815. *(uint16*)n=o->tdir_type; libtiff/tif_swab.c:35:1: <Length trace> 33. 34. #ifndef TIFFSwabShort 35. void ^ 36. TIFFSwabShort(uint16* wp) 37. { libtiff/tif_swab.c:35:1: Parameter `*wp` 33. 34. #ifndef TIFFSwabShort 35. void ^ 36. TIFFSwabShort(uint16* wp) 37. { libtiff/tif_swab.c:38:2: Assignment 36. TIFFSwabShort(uint16* wp) 37. { 38. register unsigned char* cp = (unsigned char*) wp; ^ 39. unsigned char t; 40. assert(sizeof(uint16)==2); libtiff/tif_swab.c:41:6: Array access: Offset: [17, +oo] (⇐ [16, +oo] + 1) Size: [0, +oo] by call to `TIFFSwabShort` 39. unsigned char t; 40. assert(sizeof(uint16)==2); 41. t = cp[1]; cp[1] = cp[0]; cp[0] = t; ^ 42. } 43. #endif
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L41
d2a_code_trace_data_45242
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; AVMetadataTag *tag = NULL; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); ffmpeg_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); ffmpeg_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); ffmpeg_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) use_audio = 0; if (video_disable) use_video = 0; if (subtitle_disable) use_subtitle = 0; if (use_video) new_video_stream(oc, nb_output_files); if (use_audio) new_audio_stream(oc, nb_output_files); if (use_subtitle) new_subtitle_stream(oc, nb_output_files); oc->timestamp = recording_timestamp; while ((tag = av_metadata_get(metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) av_metadata_set2(&oc->metadata, tag->key, tag->value, 0); av_metadata_free(&metadata); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); ffmpeg_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); ffmpeg_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); ffmpeg_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); nb_streamid_map = 0; av_freep(&forced_key_frames); } ffmpeg.c:3720: error: Null Dereference pointer `oc` last assigned on line 3698 could be null and is dereferenced at line 3720, column 5. ffmpeg.c:3686:1: start of procedure opt_output_file() 3684. } 3685. 3686. static void opt_output_file(const char *filename) ^ 3687. { 3688. AVFormatContext *oc; ffmpeg.c:3691:5: 3689. int err, use_video, use_audio, use_subtitle; 3690. int input_has_video, input_has_audio, input_has_subtitle; 3691. AVFormatParameters params, *ap = &params; ^ 3692. AVOutputFormat *file_oformat; 3693. AVMetadataTag *tag = NULL; ffmpeg.c:3693:5: 3691. AVFormatParameters params, *ap = &params; 3692. AVOutputFormat *file_oformat; 3693. AVMetadataTag *tag = NULL; ^ 3694. 3695. if (!strcmp(filename, "-")) ffmpeg.c:3695:10: Taking false branch 3693. AVMetadataTag *tag = NULL; 3694. 3695. if (!strcmp(filename, "-")) ^ 3696. filename = "pipe:"; 3697. ffmpeg.c:3698:5: 3696. filename = "pipe:"; 3697. 3698. oc = avformat_alloc_context(); ^ 3699. if (!oc) { 3700. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:82:1: start of procedure avformat_alloc_context() 80. } 81. 82. AVFormatContext *avformat_alloc_context(void) ^ 83. { 84. AVFormatContext *ic; libavformat/options.c:85:5: 83. { 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); ^ 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) libavformat/options.c:86:10: Taking true branch 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:86:14: 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:90:1: return from a call to avformat_alloc_context 88. ic->av_class = &av_format_context_class; 89. return ic; 90. } ^ 91. 92. #if FF_API_ALLOC_FORMAT_CONTEXT ffmpeg.c:3699:10: Taking true branch 3697. 3698. oc = avformat_alloc_context(); 3699. if (!oc) { ^ 3700. print_error(filename, AVERROR(ENOMEM)); 3701. ffmpeg_exit(1); ffmpeg.c:3700:9: 3698. oc = avformat_alloc_context(); 3699. if (!oc) { 3700. print_error(filename, AVERROR(ENOMEM)); ^ 3701. ffmpeg_exit(1); 3702. } cmdutils.c:360:1: start of procedure print_error() 358. } 359. 360. void print_error(const char *filename, int err) ^ 361. { 362. char errbuf[128]; cmdutils.c:363:5: 361. { 362. char errbuf[128]; 363. const char *errbuf_ptr = errbuf; ^ 364. 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:365:9: Taking true branch 363. const char *errbuf_ptr = errbuf; 364. 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 366. errbuf_ptr = strerror(AVUNERROR(err)); 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:366:9: Skipping strerror(): method has no implementation 364. 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 366. errbuf_ptr = strerror(AVUNERROR(err)); ^ 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 368. } cmdutils.c:367:5: 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 366. errbuf_ptr = strerror(AVUNERROR(err)); 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); ^ 368. } 369. cmdutils.c:368:1: return from a call to print_error 366. errbuf_ptr = strerror(AVUNERROR(err)); 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 368. } ^ 369. 370. static int warned_cfg = 0; ffmpeg.c:3701:9: Skipping ffmpeg_exit(): empty list of specs 3699. if (!oc) { 3700. print_error(filename, AVERROR(ENOMEM)); 3701. ffmpeg_exit(1); ^ 3702. } 3703. ffmpeg.c:3704:9: Taking true branch 3702. } 3703. 3704. if (last_asked_format) { ^ 3705. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3706. if (!file_oformat) { ffmpeg.c:3705:9: Skipping av_guess_format(): empty list of specs 3703. 3704. if (last_asked_format) { 3705. file_oformat = av_guess_format(last_asked_format, NULL, NULL); ^ 3706. if (!file_oformat) { 3707. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg.c:3706:14: Taking false branch 3704. if (last_asked_format) { 3705. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3706. if (!file_oformat) { ^ 3707. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); 3708. ffmpeg_exit(1); ffmpeg.c:3710:9: 3708. ffmpeg_exit(1); 3709. } 3710. last_asked_format = NULL; ^ 3711. } else { 3712. file_oformat = av_guess_format(NULL, filename, NULL); ffmpeg.c:3720:5: 3718. } 3719. 3720. oc->oformat = file_oformat; ^ 3721. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3722.
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L3720
d2a_code_trace_data_45243
int BN_set_word(BIGNUM *a, BN_ULONG w) { bn_check_top(a); if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) return 0; a->neg = 0; a->d[0] = w; a->top = (w ? 1 : 0); a->flags &= ~BN_FLG_FIXED_TOP; bn_check_top(a); return 1; } test/ecdsatest.c:144: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_dec2bn`. Showing all 13 steps of the trace test/ecdsatest.c:127:10: Call 125. 126. /* create the key */ 127. if (!TEST_ptr(key = EC_KEY_new_by_curve_name(nid))) ^ 128. goto x962_int_err; 129. use_fake = 1; crypto/ec/ec_key.c:25:19: Call 23. EC_KEY *EC_KEY_new_by_curve_name(int nid) 24. { 25. EC_KEY *ret = EC_KEY_new(); ^ 26. if (ret == NULL) 27. return NULL; crypto/ec/ec_key.c:20:12: Call 18. EC_KEY *EC_KEY_new(void) 19. { 20. return EC_KEY_new_method(NULL); ^ 21. } 22. crypto/ec/ec_kmeth.c:123:5: Call 121. 122. err: 123. EC_KEY_free(ret); ^ 124. return NULL; 125. } crypto/ec/ec_key.c:41:1: Parameter `r->priv_key->d` 39. } 40. 41. > void EC_KEY_free(EC_KEY *r) 42. { 43. int i; test/ecdsatest.c:144:10: Call 142. if (!TEST_ptr(r = BN_new()) || !TEST_ptr(s = BN_new())) 143. goto x962_int_err; 144. if (!TEST_true(BN_dec2bn(&r, r_in)) || !TEST_true(BN_dec2bn(&s, s_in))) ^ 145. goto x962_int_err; 146. ECDSA_SIG_get0(signature, &sig_r, &sig_s); crypto/bn/bn_print.c:199:1: Parameter `*(*bn)->d` 197. } 198. 199. > int BN_dec2bn(BIGNUM **bn, const char *a) 200. { 201. BIGNUM *ret = NULL; crypto/bn/bn_print.c:232:9: Call 230. } else { 231. ret = *bn; 232. BN_zero(ret); ^ 233. } 234. crypto/bn/bn_lib.c:359:1: <Length trace> 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); 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_lib.c:365:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_dec2bn` 363. return 0; 364. a->neg = 0; 365. a->d[0] = w; ^ 366. a->top = (w ? 1 : 0); 367. a->flags &= ~BN_FLG_FIXED_TOP;
https://github.com/openssl/openssl/blob/2eb2b4f3a12d0b8807447913a3b16f21104c701b/crypto/bn/bn_lib.c/#L365
d2a_code_trace_data_45244
static int select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (servername == NULL) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } if (strcmp(servername, "server2") == 0) { SSL_CTX *new_ctx = (SSL_CTX*)arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return SSL_TLSEXT_ERR_OK; } else if (strcmp(servername, "server1") == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_OK; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } else { return SSL_TLSEXT_ERR_ALERT_FATAL; } } test/handshake_helper.c:134: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 109 could be null and is dereferenced at line 134, column 9. Showing all 22 steps of the trace test/handshake_helper.c:106:1: start of procedure select_server_ctx() 104. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK. 105. */ 106. > static int select_server_ctx(SSL *s, void *arg, int ignore) 107. { 108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); test/handshake_helper.c:108:5: 106. static int select_server_ctx(SSL *s, void *arg, int ignore) 107. { 108. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 109. HANDSHAKE_EX_DATA *ex_data = 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ssl/ssl_lib.c:2597:1: start of procedure SSL_get_servername() 2595. */ 2596. 2597. > const char *SSL_get_servername(const SSL *s, const int type) 2598. { 2599. if (type != TLSEXT_NAMETYPE_host_name) ssl/ssl_lib.c:2599:9: Taking false branch 2597. const char *SSL_get_servername(const SSL *s, const int type) 2598. { 2599. if (type != TLSEXT_NAMETYPE_host_name) ^ 2600. return NULL; 2601. ssl/ssl_lib.c:2602:12: Condition is true 2600. return NULL; 2601. 2602. return s->session && !s->ext.hostname ? ^ 2603. s->session->ext.hostname : s->ext.hostname; 2604. } ssl/ssl_lib.c:2602:27: Condition is true 2600. return NULL; 2601. 2602. return s->session && !s->ext.hostname ? ^ 2603. s->session->ext.hostname : s->ext.hostname; 2604. } ssl/ssl_lib.c:2602:12: 2600. return NULL; 2601. 2602. > return s->session && !s->ext.hostname ? 2603. s->session->ext.hostname : s->ext.hostname; 2604. } ssl/ssl_lib.c:2602:5: 2600. return NULL; 2601. 2602. > return s->session && !s->ext.hostname ? 2603. s->session->ext.hostname : s->ext.hostname; 2604. } ssl/ssl_lib.c:2604:1: return from a call to SSL_get_servername 2602. return s->session && !s->ext.hostname ? 2603. s->session->ext.hostname : s->ext.hostname; 2604. > } 2605. 2606. int SSL_get_servername_type(const SSL *s) test/handshake_helper.c:109:5: 107. { 108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 109. > HANDSHAKE_EX_DATA *ex_data = 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 111. ssl/ssl_lib.c:4014:1: start of procedure SSL_get_ex_data() 4012. } 4013. 4014. > void *SSL_get_ex_data(const SSL *s, int idx) 4015. { 4016. return CRYPTO_get_ex_data(&s->ex_data, idx); ssl/ssl_lib.c:4016:5: 4014. void *SSL_get_ex_data(const SSL *s, int idx) 4015. { 4016. > return CRYPTO_get_ex_data(&s->ex_data, idx); 4017. } 4018. crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data() 391. * particular index in the class used by this variable 392. */ 393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:395:9: Taking true branch 393. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 396. return NULL; 397. return sk_void_value(ad->sk, idx); crypto/ex_data.c:396:9: 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 396. > return NULL; 397. return sk_void_value(ad->sk, idx); 398. } crypto/ex_data.c:398:1: return from a call to CRYPTO_get_ex_data 396. return NULL; 397. return sk_void_value(ad->sk, idx); 398. > } ssl/ssl_lib.c:4017:1: return from a call to SSL_get_ex_data 4015. { 4016. return CRYPTO_get_ex_data(&s->ex_data, idx); 4017. > } 4018. 4019. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:112:9: Taking false branch 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 111. 112. if (servername == NULL) { ^ 113. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 114. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:117:9: Taking false branch 115. } 116. 117. if (strcmp(servername, "server2") == 0) { ^ 118. SSL_CTX *new_ctx = (SSL_CTX*)arg; 119. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:130:16: Taking false branch 128. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 129. return SSL_TLSEXT_ERR_OK; 130. } else if (strcmp(servername, "server1") == 0) { ^ 131. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 132. return SSL_TLSEXT_ERR_OK; test/handshake_helper.c:133:16: Taking true branch 131. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 132. return SSL_TLSEXT_ERR_OK; 133. } else if (ignore) { ^ 134. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 135. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:134:9: 132. return SSL_TLSEXT_ERR_OK; 133. } else if (ignore) { 134. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 135. return SSL_TLSEXT_ERR_NOACK; 136. } else {
https://github.com/openssl/openssl/blob/e43e6b1951de931ca500c6964496e76651332f5e/test/handshake_helper.c/#L134
d2a_code_trace_data_45245
static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; int mqdiff, mquant; int ttmb = v->ttfrm; int status; static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, offset_table[6] = { 0, 1, 3, 7, 15, 31 }; int mb_has_coeffs = 1; int dmv_x, dmv_y; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, fourmv; mquant = v->pq; if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; s->dsp.clear_blocks(s->block[0]); if (!fourmv) { if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { mquant = v->pq; cbp = 0; } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); if(!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if(s->mb_intra) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { s->mb_intra = 0; for(i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_1mv(v, 0); return 0; } } else { if (!skipped ) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i=0; i<6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if(i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if(val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); if(!s->mb_intra) vc1_mc_4mv_luma(v, i); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if(i&4){ is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if(i == 4) vc1_mc_4mv_chroma(v); v->mb_type[0][s->block_index[i]] = is_intra[i]; if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; } if(!intra_count && !coded_inter) return 0; dst_idx = 0; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; { int intrapred = 0; for(i=0; i<6; i++) if(is_intra[i]) { if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if(intrapred)s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i=0; i<6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(is_coded[i]) { status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } return status; } else { s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 0; for (i=0; i<6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } for (i=0; i<4; i++) { vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_4mv_luma(v, i); } vc1_mc_4mv_chroma(v); s->current_picture.qscale_table[mb_pos] = 0; return 0; } } return -1; } libavcodec/vc1.c:3043: error: Buffer Overrun L3 Offset: [-5, 5] Size: 6. libavcodec/vc1.c:3037:5: <Offset trace> 3035. skipped = v->s.mbskip_table[mb_pos]; 3036. 3037. s->dsp.clear_blocks(s->block[0]); ^ 3038. 3039. if (!fourmv) /* 1MV mode */ libavcodec/vc1.c:3037:5: Unknown value from: non-const function 3035. skipped = v->s.mbskip_table[mb_pos]; 3036. 3037. s->dsp.clear_blocks(s->block[0]); ^ 3038. 3039. if (!fourmv) /* 1MV mode */ libavcodec/vc1.c:3043:13: Call 3041. if (!skipped) 3042. { 3043. GET_MVDATA(dmv_x, dmv_y); ^ 3044. 3045. if (s->mb_intra) { libavcodec/bitstream.h:877:1: Parameter `(*table)[*]` 875. * = (max_vlc_length + bits - 1) / bits 876. */ 877. static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], ^ 878. int bits, int max_depth) 879. { libavcodec/bitstream.h:885:5: Assignment 883. UPDATE_CACHE(re, s) 884. 885. GET_VLC(code, re, s, table, bits, max_depth) ^ 886. 887. CLOSE_READER(re, s) libavcodec/bitstream.h:888:5: Assignment 886. 887. CLOSE_READER(re, s) 888. return code; ^ 889. } 890. libavcodec/vc1.c:3043:13: Assignment 3041. if (!skipped) 3042. { 3043. GET_MVDATA(dmv_x, dmv_y); ^ 3044. 3045. if (s->mb_intra) { libavcodec/vc1.c:3043:13: Assignment 3041. if (!skipped) 3042. { 3043. GET_MVDATA(dmv_x, dmv_y); ^ 3044. 3045. if (s->mb_intra) { libavcodec/vc1.c:3016:5: <Length trace> 3014. int status; 3015. 3016. static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, ^ 3017. offset_table[6] = { 0, 1, 3, 7, 15, 31 }; 3018. int mb_has_coeffs = 1; /* last_flag */ libavcodec/vc1.c:3016:5: Array declaration 3014. int status; 3015. 3016. static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, ^ 3017. offset_table[6] = { 0, 1, 3, 7, 15, 31 }; 3018. int mb_has_coeffs = 1; /* last_flag */ libavcodec/vc1.c:3043:13: Array access: Offset: [-5, 5] Size: 6 3041. if (!skipped) 3042. { 3043. GET_MVDATA(dmv_x, dmv_y); ^ 3044. 3045. if (s->mb_intra) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3043
d2a_code_trace_data_45246
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) { unsigned int i, m; unsigned int n; BN_ULONG l; BIGNUM *bn = NULL; if (ret == NULL) ret = bn = BN_new(); if (ret == NULL) return (NULL); bn_check_top(ret); for ( ; len > 0 && *s == 0; s++, len--) continue; n = len; if (n == 0) { ret->top = 0; return (ret); } i = ((n - 1) / BN_BYTES) + 1; m = ((n - 1) % (BN_BYTES)); if (bn_wexpand(ret, (int)i) == NULL) { BN_free(bn); return NULL; } ret->top = i; ret->neg = 0; l = 0; while (n--) { l = (l << 8L) | *(s++); if (m-- == 0) { ret->d[--i] = l; l = 0; m = BN_BYTES - 1; } } bn_correct_top(ret); return (ret); } test/ectest.c:1484: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, +oo] by call to `EC_GROUP_new_from_ecparameters`. Showing all 12 steps of the trace test/ectest.c:1483:12: Call 1481. 1482. r = TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_secp112r1)) 1483. && TEST_ptr(ecparameters = EC_GROUP_get_ecparameters(group, NULL)) ^ 1484. && TEST_ptr(group2 = EC_GROUP_new_from_ecparameters(ecparameters)) 1485. && TEST_int_eq(EC_GROUP_cmp(group, group2, NULL), 0); crypto/ec/ec_asn1.c:471:1: Parameter `*params->curve->seed->data` 469. } 470. 471. > ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, 472. ECPARAMETERS *params) 473. { test/ectest.c:1484:12: Call 1482. r = TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_secp112r1)) 1483. && TEST_ptr(ecparameters = EC_GROUP_get_ecparameters(group, NULL)) 1484. && TEST_ptr(group2 = EC_GROUP_new_from_ecparameters(ecparameters)) ^ 1485. && TEST_int_eq(EC_GROUP_cmp(group, group2, NULL), 0); 1486. crypto/ec/ec_asn1.c:599:1: Parameter `*params->base->data` 597. } 598. 599. > EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params) 600. { 601. int ok = 0, tmp; crypto/ec/ec_asn1.c:784:10: Call 782. 783. /* extract the ec point */ 784. if (!EC_POINT_oct2point(ret, point, params->base->data, ^ 785. params->base->length, NULL)) { 786. ECerr(EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS, ERR_R_EC_LIB); crypto/ec/ec_oct.c:118:1: Parameter `*buf` 116. } 117. 118. > int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, 119. const unsigned char *buf, size_t len, BN_CTX *ctx) 120. { crypto/ec/ec_oct.c:132:20: Call 130. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 131. if (group->meth->field_type == NID_X9_62_prime_field) 132. return ec_GFp_simple_oct2point(group, point, buf, len, ctx); ^ 133. else 134. #ifdef OPENSSL_NO_EC2M crypto/ec/ecp_oct.c:274:1: Parameter `*buf` 272. } 273. 274. > int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point, 275. const unsigned char *buf, size_t len, BN_CTX *ctx) 276. { crypto/ec/ecp_oct.c:333:10: Call 331. goto err; 332. 333. if (!BN_bin2bn(buf + 1, field_len, x)) ^ 334. goto err; 335. if (BN_ucmp(x, group->field) >= 0) { crypto/bn/bn_lib.c:407:1: <Length trace> 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; crypto/bn/bn_lib.c:407:1: Parameter `*s` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; crypto/bn/bn_lib.c:420:24: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `EC_GROUP_new_from_ecparameters` 418. bn_check_top(ret); 419. /* Skip leading zero's. */ 420. for ( ; len > 0 && *s == 0; s++, len--) ^ 421. continue; 422. n = len;
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_lib.c/#L420
d2a_code_trace_data_45247
static int test_param_bignum(int n) { unsigned char buf[MAX_LEN], bnbuf[MAX_LEN], le[MAX_LEN]; const size_t len = raw_values[n].len; size_t bnsize; BIGNUM *b = NULL, *c = NULL; OSSL_PARAM param = OSSL_PARAM_DEFN("bn", OSSL_PARAM_UNSIGNED_INTEGER, NULL, 0, NULL); int ret = 0; param.data = bnbuf; param.data_size = len; param.return_size = &bnsize; copy_be_to_native(buf, raw_values[n].value, len); swap_copy(le, raw_values[n].value, len); if (!TEST_ptr(b = BN_bin2bn(raw_values[n].value, (int)len, NULL))) goto err; if (!TEST_true(OSSL_PARAM_set_BN(&param, b)) || !TEST_mem_eq(bnbuf, bnsize, buf, bnsize)) goto err; param.data_size = *param.return_size; if (!TEST_true(OSSL_PARAM_get_BN(&param, &c)) || !TEST_BN_eq(b, c)) goto err; ret = 1; err: BN_free(b); BN_free(c); return ret; } test/params_api_test.c:412: error: UNINITIALIZED_VALUE The value read from bnsize was never initialized. Showing all 1 steps of the trace test/params_api_test.c:412:13: 410. 411. if (!TEST_true(OSSL_PARAM_set_BN(&param, b)) 412. > || !TEST_mem_eq(bnbuf, bnsize, buf, bnsize)) 413. goto err; 414. param.data_size = *param.return_size;
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/test/params_api_test.c/#L412
d2a_code_trace_data_45248
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const 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_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, 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/s_server.c:2528: error: BUFFER_OVERRUN_L2 Offset: [-oo, 1048576] Size: 8192 by call to `X509_NAME_oneline`. Showing all 8 steps of the trace apps/s_server.c:2414:1: Array declaration 2412. } 2413. 2414. > static int init_ssl_connection(SSL *con) 2415. { 2416. int i; apps/s_server.c:2528:9: Call 2526. BIO_printf(bio_s_out, "Client certificate\n"); 2527. PEM_write_bio_X509(bio_s_out, peer); 2528. X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf); ^ 2529. BIO_printf(bio_s_out, "subject=%s\n", buf); 2530. X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf); crypto/x509/x509_obj.c:62:5: <Offset trace> 60. 61. len--; /* space for '\0' */ 62. l = 0; ^ 63. for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { 64. ne = sk_X509_NAME_ENTRY_value(a->entries, i); crypto/x509/x509_obj.c:62:5: Assignment 60. 61. len--; /* space for '\0' */ 62. l = 0; ^ 63. for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { 64. ne = sk_X509_NAME_ENTRY_value(a->entries, i); crypto/x509/x509_obj.c:121:9: Assignment 119. } 120. 121. lold = l; ^ 122. l += 1 + l1 + 1 + l2; 123. if (l > NAME_ONELINE_MAX) { crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:134:13: Array access: Offset: [-oo, 1048576] Size: 8192 by call to `X509_NAME_oneline` 132. break; 133. } else 134. p = &(buf[lold]); ^ 135. *(p++) = '/'; 136. memcpy(p, s, (unsigned int)l1);
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L134
d2a_code_trace_data_45249
static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) { int idx = oc->nb_streams - 1; OutputStream *ost; output_streams_for_file[file_idx] = grow_array(output_streams_for_file[file_idx], sizeof(*output_streams_for_file[file_idx]), &nb_output_streams_for_file[file_idx], oc->nb_streams); ost = output_streams_for_file[file_idx][idx] = av_mallocz(sizeof(OutputStream)); if (!ost) { fprintf(stderr, "Could not alloc output stream\n"); ffmpeg_exit(1); } ost->file_index = file_idx; ost->index = idx; ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL); return ost; } ffmpeg.c:3840: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `new_video_stream`. ffmpeg.c:3804:10: Unknown value from: strcmp 3802. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3803. 3804. if (!strcmp(file_oformat->name, "ffm") && ^ 3805. av_strstart(filename, "http:", NULL)) { 3806. /* special case for files sent to ffserver: we get the stream ffmpeg.c:3840:27: Call 3838. if (data_disable) use_data = 0; 3839. 3840. if (use_video) new_video_stream(oc, nb_output_files); ^ 3841. if (use_audio) new_audio_stream(oc, nb_output_files); 3842. if (use_subtitle) new_subtitle_stream(oc, nb_output_files); ffmpeg.c:3423:1: Global `nb_streamid_map` 3421. } 3422. 3423. static void new_video_stream(AVFormatContext *oc, int file_idx) ^ 3424. { 3425. AVStream *st; ffmpeg.c:3431:10: Call 3429. AVCodec *codec= NULL; 3430. 3431. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3432. if (!st) { 3433. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2642:1: Parameter `s->nb_streams` 2640. } 2641. 2642. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2643. { 2644. AVStream *st; ffmpeg.c:3436:11: Call 3434. ffmpeg_exit(1); 3435. } 3436. ost = new_output_stream(oc, file_idx); ^ 3437. 3438. if(!video_stream_copy){ ffmpeg.c:643:1: <LHS trace> 641. } 642. 643. static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) ^ 644. { 645. int idx = oc->nb_streams - 1; ffmpeg.c:643:1: Parameter `oc->nb_streams` 641. } 642. 643. static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) ^ 644. { 645. int idx = oc->nb_streams - 1; ffmpeg.c:645:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `new_video_stream` 643. static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) 644. { 645. int idx = oc->nb_streams - 1; ^ 646. OutputStream *ost; 647.
https://github.com/libav/libav/blob/bf2cba453244a74331238a472fe0e309f116f4d9/ffmpeg.c/#L645
d2a_code_trace_data_45250
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1169: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1169:9: 1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) 1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) ^ 1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1171. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1169
d2a_code_trace_data_45251
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:944: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 22 steps of the trace test/bntest.c:918:1: Parameter `ctx->stack.depth` 916. } 917. 918. > int test_mod_mul(BIO *bp, BN_CTX *ctx) 919. { 920. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:932:9: Call 930. BN_one(b); 931. BN_zero(c); 932. if (BN_mod_mul(e, a, b, c, ctx)) { ^ 933. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); 934. return 0; crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:98:5: Call 96. ret = 1; 97. err: 98. BN_CTX_end(ctx); ^ 99. return (ret); 100. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); test/bntest.c:944:18: Call 942. a->neg = rand_neg(); 943. b->neg = rand_neg(); 944. if (!BN_mod_mul(e, a, b, c, ctx)) { ^ 945. unsigned long l; 946. crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:32:5: Call 30. } 31. 32. BN_CTX_start(ctx); ^ 33. rr = (a != r) ? r : BN_CTX_get(ctx); 34. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqr.c:100:5: Call 98. bn_check_top(rr); 99. bn_check_top(tmp); 100. BN_CTX_end(ctx); ^ 101. return (ret); 102. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_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_45252
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ec_lib.c:1041: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_set_word`. Showing all 16 steps of the trace crypto/ec/ec_lib.c:1034:14: Call 1032. 1033. BN_CTX_start(ctx); 1034. if ((e = BN_CTX_get(ctx)) == NULL) ^ 1035. goto err; 1036. crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:367:15: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/bn/bn_lib.c:367:5: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/ec/ec_lib.c:1041:10: Call 1039. * order must be prime and use Fermats Little Theorem instead. 1040. */ 1041. if (!BN_set_word(e, 2)) ^ 1042. goto err; 1043. if (!BN_sub(e, group->order, e)) crypto/bn/bn_lib.c:360:1: Parameter `*a->d` 358. } 359. 360. > int BN_set_word(BIGNUM *a, BN_ULONG w) 361. { 362. bn_check_top(a); crypto/bn/bn_lib.c:363:9: Call 361. { 362. bn_check_top(a); 363. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 364. return 0; 365. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `*a->d` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `*b->d` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_set_word` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_45253
static int tree_add_unmatched(X509_POLICY_LEVEL *curr, const X509_POLICY_CACHE *cache, const ASN1_OBJECT *id, X509_POLICY_NODE *node, X509_POLICY_TREE *tree) { X509_POLICY_DATA *data; if (id == NULL) id = node->data->valid_policy; if ((data = policy_data_new(NULL, id, node_critical(node))) == NULL) return 0; data->qualifier_set = cache->anyPolicy->qualifier_set; data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; if (level_add_node(curr, data, node, tree) == NULL) { policy_data_free(data); return 0; } return 1; } crypto/x509v3/pcy_tree.c:360: error: MEMORY_LEAK memory dynamically allocated by call to `policy_data_new()` at line 354, column 17 is not reachable after line 360, column 9. Showing all 82 steps of the trace crypto/x509v3/pcy_tree.c:341:1: start of procedure tree_add_unmatched() 339. * Return value: 1 on success, 0 otherwise. 340. */ 341. > static int tree_add_unmatched(X509_POLICY_LEVEL *curr, 342. const X509_POLICY_CACHE *cache, 343. const ASN1_OBJECT *id, crypto/x509v3/pcy_tree.c:348:9: Taking false branch 346. X509_POLICY_DATA *data; 347. 348. if (id == NULL) ^ 349. id = node->data->valid_policy; 350. /* crypto/x509v3/pcy_tree.c:354:9: 352. * node. 353. */ 354. > if ((data = policy_data_new(NULL, id, node_critical(node))) == NULL) 355. return 0; 356. crypto/x509v3/pcy_data.c:87:1: start of procedure policy_data_new() 85. */ 86. 87. > X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, 88. const ASN1_OBJECT *cid, int crit) 89. { crypto/x509v3/pcy_data.c:92:10: Taking true branch 90. X509_POLICY_DATA *ret; 91. ASN1_OBJECT *id; 92. if (!policy && !cid) ^ 93. return NULL; 94. if (cid) { crypto/x509v3/pcy_data.c:92:21: Taking false branch 90. X509_POLICY_DATA *ret; 91. ASN1_OBJECT *id; 92. if (!policy && !cid) ^ 93. return NULL; 94. if (cid) { crypto/x509v3/pcy_data.c:94:9: Taking true branch 92. if (!policy && !cid) 93. return NULL; 94. if (cid) { ^ 95. id = OBJ_dup(cid); 96. if (!id) crypto/x509v3/pcy_data.c:95:9: Skipping OBJ_dup(): empty list of specs 93. return NULL; 94. if (cid) { 95. id = OBJ_dup(cid); ^ 96. if (!id) 97. return NULL; crypto/x509v3/pcy_data.c:96:14: Taking false branch 94. if (cid) { 95. id = OBJ_dup(cid); 96. if (!id) ^ 97. return NULL; 98. } else crypto/x509v3/pcy_data.c:100:5: 98. } else 99. id = NULL; 100. > ret = OPENSSL_zalloc(sizeof(*ret)); 101. if (ret == NULL) 102. return NULL; crypto/mem.c:156:1: start of procedure CRYPTO_zalloc() 154. } 155. 156. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:158:5: 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. > void *ret = CRYPTO_malloc(num, file, line); 159. 160. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (num <= 0) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (num <= 0) ^ 124. return NULL; 125. crypto/mem.c:126:5: 124. return NULL; 125. 126. > allow_customize = 0; 127. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 128. if (call_malloc_debug) { crypto/mem.c:136:5: 134. } 135. #else 136. > (void)file; 137. (void)line; 138. ret = malloc(num); crypto/mem.c:137:5: 135. #else 136. (void)file; 137. > (void)line; 138. ret = malloc(num); 139. #endif crypto/mem.c:138:5: 136. (void)file; 137. (void)line; 138. > ret = malloc(num); 139. #endif 140. crypto/mem.c:153:5: 151. #endif 152. 153. > return ret; 154. } 155. crypto/mem.c:154:1: return from a call to CRYPTO_malloc 152. 153. return ret; 154. > } 155. 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:160:9: Taking true branch 158. void *ret = CRYPTO_malloc(num, file, line); 159. 160. if (ret != NULL) ^ 161. memset(ret, 0, num); 162. return ret; crypto/mem.c:161:9: 159. 160. if (ret != NULL) 161. > memset(ret, 0, num); 162. return ret; 163. } crypto/mem.c:162:5: 160. if (ret != NULL) 161. memset(ret, 0, num); 162. > return ret; 163. } 164. crypto/mem.c:163:1: return from a call to CRYPTO_zalloc 161. memset(ret, 0, num); 162. return ret; 163. > } 164. 165. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/x509v3/pcy_data.c:101:9: Taking false branch 99. id = NULL; 100. ret = OPENSSL_zalloc(sizeof(*ret)); 101. if (ret == NULL) ^ 102. return NULL; 103. ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); crypto/x509v3/pcy_data.c:103:5: 101. if (ret == NULL) 102. return NULL; 103. > ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); 104. if (ret->expected_policy_set == NULL) { 105. OPENSSL_free(ret); include/openssl/asn1.h:568:1: start of procedure sk_ASN1_OBJECT_new_null() 566. DECLARE_ASN1_ITEM(ASN1_OBJECT) 567. 568. > DEFINE_STACK_OF(ASN1_OBJECT) 569. 570. ASN1_STRING *ASN1_STRING_new(void); crypto/stack/stack.c:144:1: start of procedure sk_new_null() 142. } 143. 144. > _STACK *sk_new_null(void) 145. { 146. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:146:5: 144. _STACK *sk_new_null(void) 145. { 146. > return sk_new((int (*)(const void *, const void *))0); 147. } 148. crypto/stack/stack.c:149:1: start of procedure sk_new() 147. } 148. 149. > _STACK *sk_new(int (*c) (const void *, const void *)) 150. { 151. _STACK *ret; crypto/stack/stack.c:153:9: 151. _STACK *ret; 152. 153. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 154. goto err; 155. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:156:1: start of procedure CRYPTO_zalloc() 154. } 155. 156. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:158:5: 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. > void *ret = CRYPTO_malloc(num, file, line); 159. 160. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (num <= 0) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (num <= 0) ^ 124. return NULL; 125. crypto/mem.c:126:5: 124. return NULL; 125. 126. > allow_customize = 0; 127. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 128. if (call_malloc_debug) { crypto/mem.c:136:5: 134. } 135. #else 136. > (void)file; 137. (void)line; 138. ret = malloc(num); crypto/mem.c:137:5: 135. #else 136. (void)file; 137. > (void)line; 138. ret = malloc(num); 139. #endif crypto/mem.c:138:5: 136. (void)file; 137. (void)line; 138. > ret = malloc(num); 139. #endif 140. crypto/mem.c:153:5: 151. #endif 152. 153. > return ret; 154. } 155. crypto/mem.c:154:1: return from a call to CRYPTO_malloc 152. 153. return ret; 154. > } 155. 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:160:9: Taking true branch 158. void *ret = CRYPTO_malloc(num, file, line); 159. 160. if (ret != NULL) ^ 161. memset(ret, 0, num); 162. return ret; crypto/mem.c:161:9: 159. 160. if (ret != NULL) 161. > memset(ret, 0, num); 162. return ret; 163. } crypto/mem.c:162:5: 160. if (ret != NULL) 161. memset(ret, 0, num); 162. > return ret; 163. } 164. crypto/mem.c:163:1: return from a call to CRYPTO_zalloc 161. memset(ret, 0, num); 162. return ret; 163. > } 164. 165. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:153:9: Taking false branch 151. _STACK *ret; 152. 153. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 154. goto err; 155. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:155:9: 153. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 154. goto err; 155. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 156. goto err; 157. ret->comp = c; crypto/mem.c:156:1: start of procedure CRYPTO_zalloc() 154. } 155. 156. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:158:5: 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. > void *ret = CRYPTO_malloc(num, file, line); 159. 160. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (num <= 0) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (num <= 0) ^ 124. return NULL; 125. crypto/mem.c:126:5: 124. return NULL; 125. 126. > allow_customize = 0; 127. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 128. if (call_malloc_debug) { crypto/mem.c:136:5: 134. } 135. #else 136. > (void)file; 137. (void)line; 138. ret = malloc(num); crypto/mem.c:137:5: 135. #else 136. (void)file; 137. > (void)line; 138. ret = malloc(num); 139. #endif crypto/mem.c:138:5: 136. (void)file; 137. (void)line; 138. > ret = malloc(num); 139. #endif 140. crypto/mem.c:153:5: 151. #endif 152. 153. > return ret; 154. } 155. crypto/mem.c:154:1: return from a call to CRYPTO_malloc 152. 153. return ret; 154. > } 155. 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:160:9: Taking true branch 158. void *ret = CRYPTO_malloc(num, file, line); 159. 160. if (ret != NULL) ^ 161. memset(ret, 0, num); 162. return ret; crypto/mem.c:161:9: 159. 160. if (ret != NULL) 161. > memset(ret, 0, num); 162. return ret; 163. } crypto/mem.c:162:5: 160. if (ret != NULL) 161. memset(ret, 0, num); 162. > return ret; 163. } 164. crypto/mem.c:163:1: return from a call to CRYPTO_zalloc 161. memset(ret, 0, num); 162. return ret; 163. > } 164. 165. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:155:9: Taking false branch 153. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 154. goto err; 155. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 156. goto err; 157. ret->comp = c; crypto/stack/stack.c:157:5: 155. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 156. goto err; 157. > ret->comp = c; 158. ret->num_alloc = MIN_NODES; 159. return (ret); crypto/stack/stack.c:158:5: 156. goto err; 157. ret->comp = c; 158. > ret->num_alloc = MIN_NODES; 159. return (ret); 160. crypto/stack/stack.c:159:5: 157. ret->comp = c; 158. ret->num_alloc = MIN_NODES; 159. > return (ret); 160. 161. err: crypto/stack/stack.c:164:1: return from a call to sk_new 162. OPENSSL_free(ret); 163. return (NULL); 164. > } 165. 166. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:147:1: return from a call to sk_new_null 145. { 146. return sk_new((int (*)(const void *, const void *))0); 147. > } 148. 149. _STACK *sk_new(int (*c) (const void *, const void *)) include/openssl/asn1.h:568:1: return from a call to sk_ASN1_OBJECT_new_null 566. DECLARE_ASN1_ITEM(ASN1_OBJECT) 567. 568. > DEFINE_STACK_OF(ASN1_OBJECT) 569. 570. ASN1_STRING *ASN1_STRING_new(void); crypto/x509v3/pcy_data.c:104:9: Taking false branch 102. return NULL; 103. ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); 104. if (ret->expected_policy_set == NULL) { ^ 105. OPENSSL_free(ret); 106. ASN1_OBJECT_free(id); crypto/x509v3/pcy_data.c:110:9: Taking false branch 108. } 109. 110. if (crit) ^ 111. ret->flags = POLICY_DATA_FLAG_CRITICAL; 112. crypto/x509v3/pcy_data.c:113:9: Taking true branch 111. ret->flags = POLICY_DATA_FLAG_CRITICAL; 112. 113. if (id) ^ 114. ret->valid_policy = id; 115. else { crypto/x509v3/pcy_data.c:114:9: 112. 113. if (id) 114. > ret->valid_policy = id; 115. else { 116. ret->valid_policy = policy->policyid; crypto/x509v3/pcy_data.c:120:9: Taking false branch 118. } 119. 120. if (policy) { ^ 121. ret->qualifier_set = policy->qualifiers; 122. policy->qualifiers = NULL; crypto/x509v3/pcy_data.c:125:5: 123. } 124. 125. > return ret; 126. } crypto/x509v3/pcy_data.c:126:1: return from a call to policy_data_new 124. 125. return ret; 126. > } crypto/x509v3/pcy_tree.c:354:9: Taking false branch 352. * node. 353. */ 354. if ((data = policy_data_new(NULL, id, node_critical(node))) == NULL) ^ 355. return 0; 356. crypto/x509v3/pcy_tree.c:358:5: 356. 357. /* Curr may not have anyPolicy */ 358. > data->qualifier_set = cache->anyPolicy->qualifier_set; 359. data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; 360. if (level_add_node(curr, data, node, tree) == NULL) { crypto/x509v3/pcy_tree.c:359:5: 357. /* Curr may not have anyPolicy */ 358. data->qualifier_set = cache->anyPolicy->qualifier_set; 359. > data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; 360. if (level_add_node(curr, data, node, tree) == NULL) { 361. policy_data_free(data); crypto/x509v3/pcy_tree.c:360:9: Skipping level_add_node(): empty list of specs 358. data->qualifier_set = cache->anyPolicy->qualifier_set; 359. data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; 360. if (level_add_node(curr, data, node, tree) == NULL) { ^ 361. policy_data_free(data); 362. return 0;
https://github.com/openssl/openssl/blob/895c2f84a6a083fc8b9f69f962ed19da12ce3b40/crypto/x509v3/pcy_tree.c/#L360