id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_45354
static int append_buf(char **buf, int *size, const char *s) { const int expand = 256; int len = strlen(s) + 1; char *p = *buf; if (p == NULL) { *size = ((len + expand - 1) / expand) * expand; p = *buf = app_malloc(*size, "engine buffer"); } else { const int blen = strlen(p); if (blen > 0) len += 2 + blen; if (len > *size) { *size = ((len + expand - 1) / expand) * expand; p = OPENSSL_realloc(p, *size); if (p == NULL) { OPENSSL_free(*buf); *buf = NULL; return 0; } *buf = p; } if (blen > 0) { p += blen; *p++ = ','; *p++ = ' '; } } strcpy(p, s); return 1; } apps/engine.c:409: error: BUFFER_OVERRUN_L3 Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, +oo] by call to `append_buf`. Showing all 8 steps of the trace apps/engine.c:392:17: Assignment 390. if (list_cap) { 391. int cap_size = 256; 392. char *cap_buf = NULL; ^ 393. int k, n; 394. const int *nids; apps/engine.c:409:25: Call 407. goto end; 408. if (ENGINE_get_RAND(e) != NULL 409. && !append_buf(&cap_buf, &cap_size, "RAND")) ^ 410. goto end; 411. apps/engine.c:49:1: <Offset trace> 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:49:1: Parameter `s->strlen` 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:49:1: <Length trace> 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:49:1: Parameter `**buf` 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:53:5: Assignment 51. const int expand = 256; 52. int len = strlen(s) + 1; 53. char *p = *buf; ^ 54. 55. if (p == NULL) { apps/engine.c:82:5: Array access: Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, +oo] by call to `append_buf` 80. } 81. 82. strcpy(p, s); ^ 83. return 1; 84. }
https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/apps/engine.c/#L82
d2a_code_trace_data_45355
static int read_avserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) { int i, err; AVFormatContext *ic = avformat_alloc_context(); ic->interrupt_callback = int_cb; err = avformat_open_input(&ic, filename, NULL, NULL); if (err < 0) return err; for(i=0;i<ic->nb_streams;i++) { AVStream *st; OutputStream *ost; AVCodec *codec; codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id); ost = new_output_stream(o, s, codec->type); st = ost->st; memcpy(st, ic->streams[i], sizeof(AVStream)); st->info = NULL; avcodec_copy_context(st->codec, ic->streams[i]->codec); if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, codec); } av_close_input_file(ic); return 0; } avconv.c:3518: error: Null Dereference pointer `ic` last assigned on line 3516 could be null and is dereferenced at line 3518, column 5. avconv.c:3513:1: start of procedure read_avserver_streams() 3511. } 3512. 3513. static int read_avserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) ^ 3514. { 3515. int i, err; avconv.c:3516:5: 3514. { 3515. int i, err; 3516. AVFormatContext *ic = avformat_alloc_context(); ^ 3517. 3518. ic->interrupt_callback = int_cb; libavformat/options.c:141:1: start of procedure avformat_alloc_context() 139. } 140. 141. AVFormatContext *avformat_alloc_context(void) ^ 142. { 143. AVFormatContext *ic; libavformat/options.c:144:5: 142. { 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); ^ 145. if (!ic) return ic; 146. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/options.c:145:10: Taking true branch 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); 145. if (!ic) return ic; ^ 146. avformat_get_context_defaults(ic); 147. return ic; libavformat/options.c:145:14: 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); 145. if (!ic) return ic; ^ 146. avformat_get_context_defaults(ic); 147. return ic; libavformat/options.c:148:1: return from a call to avformat_alloc_context 146. avformat_get_context_defaults(ic); 147. return ic; 148. } ^ 149. 150. const AVClass *avformat_get_class(void) avconv.c:3518:5: 3516. AVFormatContext *ic = avformat_alloc_context(); 3517. 3518. ic->interrupt_callback = int_cb; ^ 3519. err = avformat_open_input(&ic, filename, NULL, NULL); 3520. if (err < 0)
https://github.com/libav/libav/blob/e1edfbcb240cace69d92701e6910c2b03555b7d7/avconv.c/#L3518
d2a_code_trace_data_45356
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_smpl.c:1018: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add_quick`. Showing all 18 steps of the trace crypto/ec/ecp_smpl.c:976:10: Call 974. 975. BN_CTX_start(ctx); 976. rh = BN_CTX_get(ctx); ^ 977. tmp = BN_CTX_get(ctx); 978. Z4 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ecp_smpl.c:1018:18: Call 1016. if (!field_mul(group, tmp, Z4, group->a, ctx)) 1017. goto err; 1018. if (!BN_mod_add_quick(rh, rh, tmp, p)) ^ 1019. goto err; 1020. if (!field_mul(group, rh, rh, point->X, ctx)) crypto/bn/bn_mod.c:94:1: Parameter `*r->d` 92. } 93. 94. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 95. const BIGNUM *m) 96. { crypto/bn/bn_mod.c:97:15: Call 95. const BIGNUM *m) 96. { 97. int ret = bn_mod_add_fixed_top(r, a, b, m); ^ 98. 99. 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/793f19e47c69558e39c702da75c27e0509baf379/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45357
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/x509.c:729: error: BUFFER_OVERRUN_L3 Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/x509.c:729:17: Call 727. int len; 728. 729. X509_NAME_oneline(X509_get_subject_name(x), buf, sizeof buf); ^ 730. BIO_printf(out, "/*\n" 731. " * Subject: %s\n", buf); 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/645c694d85c8f48c74e7db8730ead874656c781e/crypto/x509/x509_obj.c/#L57
d2a_code_trace_data_45358
int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) { unsigned char *dest; if (len == 0) return 1; if (!WPACKET_allocate_bytes(pkt, len, &dest)) return 0; memcpy(dest, src, len); return 1; } ssl/statem/statem_srvr.c:3012: error: BUFFER_OVERRUN_S2 Offset added: [`pkt->curr` + 16, `pkt->curr` + 22] (⇐ [`pkt->curr`, `pkt->curr` + 6] + 16) Size: [1, 2147483644] by call to `WPACKET_memcpy`. Showing all 15 steps of the trace ssl/statem/statem_srvr.c:2895:1: Parameter `pkt->curr` 2893. } 2894. 2895. > int tls_construct_new_session_ticket(SSL *s, WPACKET *pkt) 2896. { 2897. unsigned char *senc = NULL; ssl/statem/statem_srvr.c:3007:10: Call 3005. * new sessions will live as long as their sessions. 3006. */ 3007. if (!WPACKET_put_bytes_u32(pkt, s->hit ? 0 : s->session->timeout) ^ 3008. /* Now the actual ticket data */ 3009. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:261:1: Parameter `pkt->curr` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/statem/statem_srvr.c:3009:17: Call 3007. if (!WPACKET_put_bytes_u32(pkt, s->hit ? 0 : s->session->timeout) 3008. /* Now the actual ticket data */ 3009. || !WPACKET_start_sub_packet_u16(pkt) ^ 3010. || !WPACKET_get_total_written(pkt, &macoffset) 3011. /* Output key name */ ssl/packet.c:224:1: Parameter `pkt->curr` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/statem/statem_srvr.c:3012:17: Call 3010. || !WPACKET_get_total_written(pkt, &macoffset) 3011. /* Output key name */ 3012. || !WPACKET_memcpy(pkt, key_name, sizeof(key_name)) ^ 3013. /* output IV */ 3014. || !WPACKET_memcpy(pkt, iv, iv_len) ssl/packet.c:302:1: <Offset trace> 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: Parameter `len` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: <Length trace> 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: Parameter `*pkt->buf->data` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:309:10: Call 307. return 1; 308. 309. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 310. return 0; 311. ssl/packet.c:15:1: Parameter `**allocbytes` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: Parameter `**allocbytes` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:312:5: Array access: Offset added: [pkt->curr + 16, pkt->curr + 22] (⇐ [pkt->curr, pkt->curr + 6] + 16) Size: [1, 2147483644] by call to `WPACKET_memcpy` 310. return 0; 311. 312. memcpy(dest, src, len); ^ 313. 314. return 1;
https://github.com/openssl/openssl/blob/b90506e995d44dee0ef4dd0324b56b59154256c2/ssl/packet.c/#L312
d2a_code_trace_data_45359
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/statem_srvr.c:3961: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `pkt->written` + 19]):unsigned64 by call to `WPACKET_memcpy`. Showing all 13 steps of the trace ssl/statem/statem_srvr.c:3956:10: Call 3954. unsigned char *tick_nonce) 3955. { 3956. if (!create_ticket_prequel(s, pkt, age_add, tick_nonce)) { ^ 3957. /* SSLfatal() already called */ 3958. return 0; ssl/statem/statem_srvr.c:3751:10: Call 3749. * timeout. 3750. */ 3751. if (!WPACKET_put_bytes_u32(pkt, ^ 3752. (s->hit && !SSL_IS_TLS13(s)) 3753. ? 0 : s->session->timeout)) { ssl/packet.c:309:1: Parameter `pkt->buf->length` 307. } 308. 309. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 310. { 311. unsigned char *data; ssl/statem/statem_srvr.c:3961:10: Call 3959. } 3960. 3961. if (!WPACKET_memcpy(pkt, s->session->session_id, ^ 3962. s->session->session_id_length) 3963. || !WPACKET_close(pkt)) { ssl/packet.c:362:1: Parameter `pkt->written` 360. } 361. 362. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 363. { 364. unsigned char *dest; ssl/packet.c:369:10: Call 367. return 1; 368. 369. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 370. return 0; 371. ssl/packet.c:16:1: Parameter `pkt->written` 14. #define DEFAULT_BUF_SIZE 256 15. 16. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 17. { 18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:18:10: Call 16. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 17. { 18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 19. return 0; 20. ssl/packet.c:40:1: <LHS trace> 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: Parameter `pkt->buf->length` 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: <RHS trace> 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: Parameter `len` 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [0, pkt->written + 19]):unsigned64 by call to `WPACKET_memcpy` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/41145c35bfee8f2b0822288fcb23a807d06d8e89/ssl/packet.c/#L49
d2a_code_trace_data_45360
static inline int get_p_cbp(MpegEncContext * s, DCTELEM block[6][64], int motion_x, int motion_y){ int cbp, i; if(s->flags & CODEC_FLAG_CBP_RD){ int best_cbpy_score= INT_MAX; int best_cbpc_score= INT_MAX; int cbpc = (-1), cbpy= (-1); const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); for(i=0; i<4; i++){ int score= inter_MCBPC_bits[i + offset] * lambda; if(i&1) score += s->coded_score[5]; if(i&2) score += s->coded_score[4]; if(score < best_cbpc_score){ best_cbpc_score= score; cbpc= i; } } for(i=0; i<16; i++){ int score= cbpy_tab[i ^ 0xF][1] * lambda; if(i&1) score += s->coded_score[3]; if(i&2) score += s->coded_score[2]; if(i&4) score += s->coded_score[1]; if(i&8) score += s->coded_score[0]; if(score < best_cbpy_score){ best_cbpy_score= score; cbpy= i; } } cbp= cbpc + 4*cbpy; if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){ if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0) cbp= 0; } for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){ s->block_last_index[i]= -1; memset(s->block[i], 0, sizeof(DCTELEM)*64); } } }else{ cbp= 0; for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0) cbp |= 1 << (5 - i); } } return cbp; } libavcodec/h263.c:806: error: Integer Overflow L1 (2147483647 + 2147483647):signed32. libavcodec/h263.c:775:9: <LHS trace> 773. 774. if(s->flags & CODEC_FLAG_CBP_RD){ 775. int best_cbpy_score= INT_MAX; ^ 776. int best_cbpc_score= INT_MAX; 777. int cbpc = (-1), cbpy= (-1); libavcodec/h263.c:775:9: Assignment 773. 774. if(s->flags & CODEC_FLAG_CBP_RD){ 775. int best_cbpy_score= INT_MAX; ^ 776. int best_cbpc_score= INT_MAX; 777. int cbpc = (-1), cbpy= (-1); libavcodec/h263.c:776:9: <RHS trace> 774. if(s->flags & CODEC_FLAG_CBP_RD){ 775. int best_cbpy_score= INT_MAX; 776. int best_cbpc_score= INT_MAX; ^ 777. int cbpc = (-1), cbpy= (-1); 778. const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); libavcodec/h263.c:776:9: Assignment 774. if(s->flags & CODEC_FLAG_CBP_RD){ 775. int best_cbpy_score= INT_MAX; 776. int best_cbpc_score= INT_MAX; ^ 777. int cbpc = (-1), cbpy= (-1); 778. const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); libavcodec/h263.c:806:16: Binary operation: (2147483647 + 2147483647):signed32 804. cbp= cbpc + 4*cbpy; 805. if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){ 806. if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0) ^ 807. cbp= 0; 808. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h263.c/#L806
d2a_code_trace_data_45361
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ecdsa/ecs_ossl.c:402: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 22 steps of the trace crypto/ecdsa/ecs_ossl.c:378:5: Call 376. return -1; 377. } 378. BN_CTX_start(ctx); ^ 379. order = BN_CTX_get(ctx); 380. u1 = 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/ecdsa/ecs_ossl.c:402:10: Call 400. } 401. /* calculate tmp1 = inv(S) mod order */ 402. if (!BN_mod_inverse(u2, sig->s, order, ctx)) { ^ 403. ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_BN_LIB); 404. goto err; 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_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_45362
int test_kron(BIO *bp, BN_CTX *ctx) { BN_GENCB cb; BIGNUM *a, *b, *r, *t; int i; int legendre, kronecker; int ret = 0; a = BN_new(); b = BN_new(); r = BN_new(); t = BN_new(); if (a == NULL || b == NULL || r == NULL || t == NULL) goto err; BN_GENCB_set(&cb, genprime_cb, NULL); if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err; b->neg = rand_neg(); putc('\n', stderr); for (i = 0; i < num0; i++) { if (!BN_bntest_rand(a, 512, 0, 0)) goto err; a->neg = rand_neg(); if (!BN_copy(t, b)) goto err; t->neg = 0; if (!BN_sub_word(t, 1)) goto err; if (!BN_rshift1(t, t)) goto err; b->neg = 0; if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err; b->neg = 1; if (BN_is_word(r, 1)) legendre = 1; else if (BN_is_zero(r)) legendre = 0; else { if (!BN_add_word(r, 1)) goto err; if (0 != BN_ucmp(r, b)) { fprintf(stderr, "Legendre symbol computation failed\n"); goto err; } legendre = -1; } kronecker = BN_kronecker(a, b, ctx); if (kronecker < -1) goto err; if (a->neg && b->neg) kronecker = -kronecker; if (legendre != kronecker) { fprintf(stderr, "legendre != kronecker; a = "); BN_print_fp(stderr, a); fprintf(stderr, ", b = "); BN_print_fp(stderr, b); fprintf(stderr, "\n"); goto err; } putc('.', stderr); fflush(stderr); } putc('\n', stderr); fflush(stderr); ret = 1; err: BN_free(a); BN_free(b); BN_free(r); BN_free(t); return ret; } test/bntest.c:1744: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1662, column 9 is not reachable after line 1744, column 5. Showing all 129 steps of the trace test/bntest.c:1653:1: start of procedure test_kron() 1651. } 1652. 1653. > int test_kron(BIO *bp, BN_CTX *ctx) 1654. { 1655. BN_GENCB cb; test/bntest.c:1659:5: 1657. int i; 1658. int legendre, kronecker; 1659. > int ret = 0; 1660. 1661. a = BN_new(); test/bntest.c:1661:5: 1659. int ret = 0; 1660. 1661. > a = BN_new(); 1662. b = BN_new(); 1663. r = 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:1662:5: 1660. 1661. a = BN_new(); 1662. > b = BN_new(); 1663. r = BN_new(); 1664. t = 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:1663:5: 1661. a = BN_new(); 1662. b = BN_new(); 1663. > r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) 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:1664:5: 1662. b = BN_new(); 1663. r = BN_new(); 1664. > t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) 1666. goto err; 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:1665:9: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1665:22: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1665:35: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1665:48: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1668:5: 1666. goto err; 1667. 1668. > BN_GENCB_set(&cb, genprime_cb, NULL); 1669. 1670. /* crypto/bn/bn_lib.c:981:1: start of procedure BN_GENCB_set() 979. 980. /* Populate a BN_GENCB structure with a "new"-style callback */ 981. > void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), 982. void *cb_arg) 983. { crypto/bn/bn_lib.c:984:5: 982. void *cb_arg) 983. { 984. > BN_GENCB *tmp_gencb = gencb; 985. tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; crypto/bn/bn_lib.c:985:5: 983. { 984. BN_GENCB *tmp_gencb = gencb; 985. > tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; crypto/bn/bn_lib.c:986:5: 984. BN_GENCB *tmp_gencb = gencb; 985. tmp_gencb->ver = 2; 986. > tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; 988. } crypto/bn/bn_lib.c:987:5: 985. tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; 987. > tmp_gencb->cb.cb_2 = callback; 988. } 989. crypto/bn/bn_lib.c:988:1: return from a call to BN_GENCB_set 986. tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; 988. > } 989. 990. void *BN_GENCB_get_arg(BN_GENCB *cb) test/bntest.c:1680:10: Taking true branch 1678. */ 1679. 1680. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) ^ 1681. goto err; 1682. b->neg = rand_neg(); test/bntest.c:1742:2: 1740. fflush(stderr); 1741. ret = 1; 1742. > err: 1743. BN_free(a); 1744. BN_free(b); test/bntest.c:1743:5: 1741. ret = 1; 1742. err: 1743. > BN_free(a); 1744. BN_free(b); 1745. BN_free(r); 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:1744:5: 1742. err: 1743. BN_free(a); 1744. > BN_free(b); 1745. BN_free(r); 1746. BN_free(t); 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/#L1744
d2a_code_trace_data_45363
int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) { if(s->me_method>=ME_EPZS){ int score[8]; int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2); uint8_t * fcode_tab= s->fcode_tab; int best_fcode=-1; int best_score=-10000000; if(s->msmpeg4_version) range= FFMIN(range, 16); else if(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) range= FFMIN(range, 256); for(i=0; i<8; i++) score[i]= s->mb_num*(8-i); for(y=0; y<s->mb_height; y++){ int x; int xy= y*s->mb_stride; for(x=0; x<s->mb_width; x++){ if(s->mb_type[xy] & type){ int mx= mv_table[xy][0]; int my= mv_table[xy][1]; int fcode= FFMAX(fcode_tab[mx + MAX_MV], fcode_tab[my + MAX_MV]); int j; if(mx >= range || mx < -range || my >= range || my < -range) continue; for(j=0; j<fcode && j<8; j++){ if(s->pict_type==FF_B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy]) score[j]-= 170; } } xy++; } } for(i=1; i<8; i++){ if(score[i] > best_score){ best_score= score[i]; best_fcode= i; } } return best_fcode; }else{ return 1; } } libavcodec/motion_est.c:2038: error: Uninitialized Value The value read from score[_] was never initialized. libavcodec/motion_est.c:2038:16: 2036. 2037. for(i=1; i<8; i++){ 2038. if(score[i] > best_score){ ^ 2039. best_score= score[i]; 2040. best_fcode= i;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L2038
d2a_code_trace_data_45364
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ecdh/ech_ossl.c:153: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 12 steps of the trace crypto/ecdh/ech_ossl.c:137:2: Call 135. 136. if ((ctx = BN_CTX_new()) == NULL) goto err; 137. BN_CTX_start(ctx); ^ 138. x = BN_CTX_get(ctx); 139. y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ecdh/ech_ossl.c:153:5: Call 151. { 152. if (!EC_GROUP_get_cofactor(group, x, ctx) || 153. !BN_mul(x, x, priv_key, ctx)) ^ 154. { 155. ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); crypto/bn/bn_mul.c:943:1: Parameter `ctx->stack.depth` 941. #endif /* BN_RECURSION */ 942. 943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 944. { 945. int ret=0; crypto/bn/bn_mul.c:974:2: Call 972. top=al+bl; 973. 974. BN_CTX_start(ctx); ^ 975. if ((r == a) || (r == b)) 976. { crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:1100:2: Call 1098. err: 1099. bn_check_top(r); 1100. BN_CTX_end(ctx); ^ 1101. return(ret); 1102. } crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth` 270. } 271. 272. > void BN_CTX_end(BN_CTX *ctx) 273. { 274. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:279:21: Call 277. else 278. { 279. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 280. /* Does this stack frame have anything to release? */ 281. if(fp < ctx->used) crypto/bn/bn_ctx.c:353:1: <LHS trace> 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:1: Parameter `st->depth` 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 353. static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; ^ 356. } 357.
https://github.com/openssl/openssl/blob/27dfffd5b75ee1db114e32f6dc73e266513889c5/crypto/bn/bn_ctx.c/#L355
d2a_code_trace_data_45365
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/ngx_http_variables.c:1363: error: Buffer Overrun L2 Offset: [0, 65535] Size: 44 by call to `ngx_http_time`. src/http/ngx_http_variables.c:1357:13: Call 1355. 1356. if (r->headers_out.last_modified_time >= 0) { 1357. p = ngx_pnalloc(r->pool, ^ 1358. sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT") - 1); 1359. if (p == NULL) { src/core/ngx_palloc.c:155:13: Assignment 153. 154. do { 155. m = p->d.last; ^ 156. 157. if ((size_t) (p->d.end - m) >= size) { src/core/ngx_palloc.c:160:17: Assignment 158. p->d.last = m + size; 159. 160. return m; ^ 161. } 162. src/http/ngx_http_variables.c:1357:9: Assignment 1355. 1356. if (r->headers_out.last_modified_time >= 0) { 1357. p = ngx_pnalloc(r->pool, ^ 1358. sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT") - 1); 1359. if (p == NULL) { src/http/ngx_http_variables.c:1363:18: Call 1361. } 1362. 1363. v->len = ngx_http_time(p, r->headers_out.last_modified_time) - p; ^ 1364. v->valid = 1; 1365. v->no_cacheable = 0; src/core/ngx_times.c:154:1: Parameter `*buf` 152. 153. 154. u_char * ^ 155. ngx_http_time(u_char *buf, time_t t) 156. { src/core/ngx_times.c:161:12: Call 159. ngx_gmtime(t, &tm); 160. 161. return ngx_sprintf(buf, "%s, %02d %s %4d %02d:%02d:%02d GMT", ^ 162. week[tm.ngx_tm_wday], 163. tm.ngx_tm_mday, src/core/ngx_string.c:95:1: Parameter `*buf` 93. 94. 95. u_char * ngx_cdecl ^ 96. ngx_sprintf(u_char *buf, const char *fmt, ...) 97. { src/core/ngx_string.c:102:9: Call 100. 101. va_start(args, fmt); 102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args); ^ 103. va_end(args); 104. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 65535] Size: 44 by call to `ngx_http_time` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_45366
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:3192: error: Uninitialized Value The value read from is_coded[_] was never initialized. libavcodec/vc1.c:3192:21: 3190. v->c_avail = v->mb_type[0][s->block_index[i] - 1]; 3191. 3192. vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); ^ 3193. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; 3194. s->dsp.vc1_inv_trans_8x8(s->block[i]);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3192
d2a_code_trace_data_45367
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:289: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 22 steps of the trace crypto/dsa/dsa_ossl.c:270:10: Call 268. * Calculate W = inv(S) mod Q save W in u2 269. */ 270. if ((BN_mod_inverse(u2, s, dsa->q, ctx)) == NULL) ^ 271. goto err; 272. 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:154:5: Call 152. bn_check_top(n); 153. 154. BN_CTX_start(ctx); ^ 155. A = BN_CTX_get(ctx); 156. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:446:5: Call 444. if ((ret == NULL) && (in == NULL)) 445. BN_free(R); 446. BN_CTX_end(ctx); ^ 447. bn_check_top(ret); 448. return (ret); 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/dsa/dsa_ossl.c:289:10: Call 287. 288. /* u2 = r * w mod q */ 289. if (!BN_mod_mul(u2, r, u2, dsa->q, ctx)) ^ 290. goto err; 291. 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/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45368
uint32_t ngx_utf8_decode(u_char **p, size_t n) { size_t len; uint32_t u, i, valid; u = **p; if (u > 0xf0) { u &= 0x07; valid = 0xffff; len = 3; } else if (u > 0xe0) { u &= 0x0f; valid = 0x7ff; len = 2; } else if (u > 0xc0) { u &= 0x1f; valid = 0x7f; len = 1; } else { (*p)++; return 0xffffffff; } if (n - 1 < len) { return 0xfffffffe; } (*p)++; while (len) { i = *(*p)++; if (i < 0x80) { return 0xffffffff; } u = (u << 6) | (i & 0x3f); len--; } if (u > valid) { return u; } return 0xffffffff; } src/core/ngx_string.c:1194: error: Integer Overflow L2 ([0, `len`] - 1):unsigned64 by call to `ngx_utf8_decode`. src/core/ngx_string.c:1165:1: Parameter `len` 1163. 1164. 1165. u_char * ^ 1166. ngx_utf8_cpystrn(u_char *dst, u_char *src, size_t n, size_t len) 1167. { src/core/ngx_string.c:1194:13: Call 1192. next = src; 1193. 1194. if (ngx_utf8_decode(&next, len) > 0x10ffff) { ^ 1195. /* invalid UTF-8 */ 1196. break; src/core/ngx_string.c:1081:1: <LHS trace> 1079. */ 1080. 1081. uint32_t ^ 1082. ngx_utf8_decode(u_char **p, size_t n) 1083. { src/core/ngx_string.c:1081:1: Parameter `n` 1079. */ 1080. 1081. uint32_t ^ 1082. ngx_utf8_decode(u_char **p, size_t n) 1083. { src/core/ngx_string.c:1112:9: Binary operation: ([0, len] - 1):unsigned64 by call to `ngx_utf8_decode` 1110. } 1111. 1112. if (n - 1 < len) { ^ 1113. return 0xfffffffe; 1114. }
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L1112
d2a_code_trace_data_45369
int test_mul(BIO *bp) { BIGNUM *a, *b, *c, *d, *e; int i; BN_CTX *ctx; ctx = BN_CTX_new(); if (ctx == NULL) EXIT(1); a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i <= num1) { BN_bntest_rand(a, 100, 0, 0); BN_bntest_rand(b, 100, 0, 0); } else BN_bntest_rand(b, i - num1, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); BN_mul(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, c); BIO_puts(bp, "\n"); } BN_div(d, e, c, a, ctx); BN_sub(d, d, b); if (!BN_is_zero(d) || !BN_is_zero(e)) { fprintf(stderr, "Multiplication test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); BN_CTX_free(ctx); return (1); } test/bntest.c:679: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 647, column 9 is not reachable after line 679, column 5. Showing all 158 steps of the trace test/bntest.c:637:1: start of procedure test_mul() 635. } 636. 637. > int test_mul(BIO *bp) 638. { 639. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:643:5: 641. BN_CTX *ctx; 642. 643. > ctx = BN_CTX_new(); 644. if (ctx == NULL) 645. EXIT(1); crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. 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_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) test/bntest.c:644:9: Taking false branch 642. 643. ctx = BN_CTX_new(); 644. if (ctx == NULL) ^ 645. EXIT(1); 646. test/bntest.c:647:5: 645. EXIT(1); 646. 647. > a = BN_new(); 648. b = BN_new(); 649. 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:648:5: 646. 647. a = BN_new(); 648. > b = BN_new(); 649. c = BN_new(); 650. 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:649:5: 647. a = BN_new(); 648. b = BN_new(); 649. > c = BN_new(); 650. d = BN_new(); 651. 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:650:5: 648. b = BN_new(); 649. c = BN_new(); 650. > d = BN_new(); 651. e = BN_new(); 652. 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:651:5: 649. c = BN_new(); 650. d = BN_new(); 651. > e = BN_new(); 652. 653. for (i = 0; i < num0 + num1; i++) { crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:653:10: 651. e = BN_new(); 652. 653. > for (i = 0; i < num0 + num1; i++) { 654. if (i <= num1) { 655. BN_bntest_rand(a, 100, 0, 0); test/bntest.c:653:17: Loop condition is false. Leaving loop 651. e = BN_new(); 652. 653. for (i = 0; i < num0 + num1; i++) { ^ 654. if (i <= num1) { 655. BN_bntest_rand(a, 100, 0, 0); test/bntest.c:679:5: 677. } 678. } 679. > BN_free(a); 680. BN_free(b); 681. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L679
d2a_code_trace_data_45370
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/s3_lib.c:3834: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 16]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 11 steps of the trace ssl/s3_lib.c:3788:1: Parameter `pkt->written` 3786. } 3787. 3788. > int ssl3_get_req_cert_type(SSL *s, WPACKET *pkt) 3789. { 3790. uint32_t alg_k, alg_a = 0; ssl/s3_lib.c:3834:17: Call 3832. if (s->version >= TLS1_VERSION 3833. && !(alg_a & SSL_aECDSA) 3834. && !WPACKET_put_bytes_u8(pkt, TLS_CT_ECDSA_SIGN)) ^ 3835. return 0; 3836. #endif ssl/packet.c:306:1: Parameter `pkt->written` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/packet.c:312:17: Call 310. /* Internal API, so should not fail */ 311. if (!ossl_assert(size <= sizeof(unsigned int)) 312. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 313. || !put_value(data, val, size)) 314. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:48:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 16]):unsigned64 by call to `WPACKET_put_bytes__` 46. return 0; 47. 48. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 49. size_t newlen; 50. size_t reflen;
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/packet.c/#L48
d2a_code_trace_data_45371
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1613: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`. Showing all 16 steps of the trace test/bntest.c:1590:1: Parameter `ctx->stack.depth` 1588. } 1589. 1590. > int test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx) 1591. { 1592. BIGNUM *a, *b[2], *c, *d, *e; test/bntest.c:1610:17: Call 1608. BN_bntest_rand(a, 512, 0, 0); 1609. for (j = 0; j < 2; j++) { 1610. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); ^ 1611. if (t) { 1612. s++; crypto/bn/bn_gf2m.c:1145:1: Parameter `ctx->stack.depth` 1143. * for best performance, use the BN_GF2m_mod_solve_quad_arr function. 1144. */ 1145. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1146. BN_CTX *ctx) 1147. { test/bntest.c:1613:17: Call 1611. if (t) { 1612. s++; 1613. BN_GF2m_mod_sqr(d, c, b[j], ctx); ^ 1614. BN_GF2m_add(d, c, d); 1615. BN_GF2m_mod(e, a, b[j]); crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; crypto/bn/bn_gf2m.c:547:11: Call 545. goto err; 546. } 547. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); ^ 548. bn_check_top(r); 549. err: crypto/bn/bn_gf2m.c:504:5: Call 502. 503. bn_check_top(a); 504. BN_CTX_start(ctx); ^ 505. if ((s = BN_CTX_get(ctx)) == NULL) 506. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:522:5: Call 520. ret = 1; 521. err: 522. BN_CTX_end(ctx); ^ 523. return ret; 524. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45372
static inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/s3_clnt.c:1795: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 2):unsigned64 by call to `PACKET_get_bytes`. Showing all 10 steps of the trace ssl/s3_clnt.c:1484:10: Call 1482. } 1483. 1484. if (!PACKET_buf_init(&pkt, s->init_msg, n)) { ^ 1485. SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); 1486. al = SSL_AD_INTERNAL_ERROR; ssl/packet_locl.h:110:8: Parameter `pkt->remaining` 108. * is being used. 109. */ 110. __owur static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, ^ 111. size_t len) 112. { ssl/s3_clnt.c:1795:18: Call 1793. unsigned char *sigalgs; 1794. int rv; 1795. if (!PACKET_get_bytes(&pkt, &sigalgs, 2)) { ^ 1796. SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); 1797. goto f_err; ssl/packet_locl.h:332:8: Parameter `len` 330. * freed 331. */ 332. __owur static inline int PACKET_get_bytes(PACKET *pkt, unsigned char **data, ^ 333. size_t len) 334. { ssl/packet_locl.h:338:5: Call 336. return 0; 337. 338. packet_forward(pkt, len); ^ 339. 340. return 1; ssl/packet_locl.h:80:1: <LHS trace> 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:80:1: Parameter `pkt->remaining` 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:80:1: <RHS trace> 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:80:1: Parameter `len` 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:83:5: Binary operation: ([0, +oo] - 2):unsigned64 by call to `PACKET_get_bytes` 81. { 82. pkt->curr += len; 83. pkt->remaining -= len; ^ 84. } 85.
https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/packet_locl.h/#L83
d2a_code_trace_data_45373
static void unhook_drbg(RAND_DRBG *drbg) { HOOK_CTX *ctx = get_hook_ctx(drbg); drbg->get_entropy = ctx->get_entropy; CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data); } test/drbgtest.c:535: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 533 could be null and is dereferenced at line 535, column 25. Showing all 13 steps of the trace test/drbgtest.c:531:1: start of procedure unhook_drbg() 529. 530. /* Installs the hook for the get_entropy() callback of the given drbg */ 531. > static void unhook_drbg(RAND_DRBG *drbg) 532. { 533. HOOK_CTX *ctx = get_hook_ctx(drbg); test/drbgtest.c:533:5: 531. static void unhook_drbg(RAND_DRBG *drbg) 532. { 533. > HOOK_CTX *ctx = get_hook_ctx(drbg); 534. 535. drbg->get_entropy = ctx->get_entropy; test/drbgtest.c:497:1: start of procedure get_hook_ctx() 495. static HOOK_CTX master_ctx, public_ctx, private_ctx; 496. 497. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 498. { 499. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); test/drbgtest.c:499:5: 497. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 498. { 499. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 500. } 501. crypto/rand/drbg_lib.c:617:1: start of procedure RAND_DRBG_get_ex_data() 615. } 616. 617. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 618. { 619. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:619:5: 617. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 618. { 619. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 620. } 621. crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data() 391. * particular index in the class used by this variable 392. */ 393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:395:9: Taking true branch 393. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 396. return NULL; 397. return sk_void_value(ad->sk, idx); crypto/ex_data.c:396:9: 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 396. > return NULL; 397. return sk_void_value(ad->sk, idx); 398. } crypto/ex_data.c:398:1: return from a call to CRYPTO_get_ex_data 396. return NULL; 397. return sk_void_value(ad->sk, idx); 398. > } crypto/rand/drbg_lib.c:620:1: return from a call to RAND_DRBG_get_ex_data 618. { 619. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 620. > } 621. 622. test/drbgtest.c:500:1: return from a call to get_hook_ctx 498. { 499. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 500. > } 501. 502. /* Intercepts and counts calls to the get_entropy() callback */ test/drbgtest.c:535:5: 533. HOOK_CTX *ctx = get_hook_ctx(drbg); 534. 535. > drbg->get_entropy = ctx->get_entropy; 536. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data); 537. }
https://github.com/openssl/openssl/blob/24d06e8ca07f705635a072dcb6ad08c2555c9025/test/drbgtest.c/#L535
d2a_code_trace_data_45374
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt=0; int i; int y=0,M=0,d=0,h=0,m=0,s=0; char *f = NULL; int f_len = 0; i=tm->length; v=(char *)tm->data; if (i < 12) goto err; if (v[i-1] == 'Z') gmt=1; for (i=0; i<12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); M= (v[4]-'0')*10+(v[5]-'0'); if ((M > 12) || (M < 1)) goto err; d= (v[6]-'0')*10+(v[7]-'0'); h= (v[8]-'0')*10+(v[9]-'0'); m= (v[10]-'0')*10+(v[11]-'0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s= (v[12]-'0')*10+(v[13]-'0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) return(0); else return(1); err: BIO_write(bp,"Bad time value",14); return(0); } crypto/x509v3/v3_ocsp.c:177: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 9 steps of the trace crypto/x509v3/v3_ocsp.c:165:8: Call 163. { 164. if (BIO_printf(bp, "%*scrlUrl: ", ind, "") <= 0) goto err; 165. if (!ASN1_STRING_print(bp, (ASN1_STRING*)a->crlUrl)) goto err; ^ 166. if (BIO_write(bp, "\n", 1) <= 0) goto err; 167. } crypto/asn1/t_x509.c:309:1: Parameter `*v->data` 307. } 308. 309. > int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v) 310. { 311. int i,n; crypto/x509v3/v3_ocsp.c:177:8: Call 175. { 176. if (BIO_printf(bp, "%*scrlTime: ", ind, "") <= 0) goto err; 177. if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) goto err; ^ 178. if (BIO_write(bp, "\n", 1) <= 0) goto err; 179. } crypto/asn1/t_x509.c:354:1: <Offset trace> 352. }; 353. 354. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 355. { 356. char *v; crypto/asn1/t_x509.c:354:1: Parameter `*tm->data` 352. }; 353. 354. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 355. { 356. char *v; crypto/asn1/t_x509.c:371:2: Assignment 369. if ((v[i] > '9') || (v[i] < '0')) goto err; 370. y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); 371. M= (v[4]-'0')*10+(v[5]-'0'); ^ 372. if ((M > 12) || (M < 1)) goto err; 373. d= (v[6]-'0')*10+(v[7]-'0'); crypto/asn1/t_x509.c:348:1: <Length trace> 346. } 347. 348. > static const char *mon[12]= 349. { 350. "Jan","Feb","Mar","Apr","May","Jun", crypto/asn1/t_x509.c:348:1: Array declaration 346. } 347. 348. > static const char *mon[12]= 349. { 350. "Jan","Feb","Mar","Apr","May","Jun", crypto/asn1/t_x509.c:393:3: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 391. 392. if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", 393. mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) ^ 394. return(0); 395. else
https://github.com/openssl/openssl/blob/c21869fb07ea02ffd46e817caeb47d85a85ee8ef/crypto/asn1/t_x509.c/#L393
d2a_code_trace_data_45375
int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) { int rv, start_idx, i; if (x == NULL) { x = sk_X509_value(sk, 0); start_idx = 1; } else start_idx = 0; rv = ssl_security_cert(s, NULL, x, vfy, 1); if (rv != 1) return rv; for (i = start_idx; i < sk_X509_num(sk); i++) { x = sk_X509_value(sk, i); rv = ssl_security_cert(s, NULL, x, vfy, 0); if (rv != 1) return rv; } return 1; } ssl/t1_lib.c:2288: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 2288, column 10. Showing all 11 steps of the trace ssl/t1_lib.c:2279:1: start of procedure ssl_security_cert_chain() 2277. */ 2278. 2279. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 2280. { 2281. int rv, start_idx, i; ssl/t1_lib.c:2282:9: Taking true branch 2280. { 2281. int rv, start_idx, i; 2282. if (x == NULL) { ^ 2283. x = sk_X509_value(sk, 0); 2284. start_idx = 1; ssl/t1_lib.c:2283:9: 2281. int rv, start_idx, i; 2282. if (x == NULL) { 2283. > x = sk_X509_value(sk, 0); 2284. start_idx = 1; 2285. } else include/openssl/x509.h:100:1: start of procedure sk_X509_value() 98. typedef struct x509_cinf_st X509_CINF; 99. 100. > DEFINE_STACK_OF(X509) 101. 102. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:284:1: start of procedure OPENSSL_sk_value() 282. } 283. 284. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 285. { 286. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:286:9: Taking true branch 284. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 285. { 286. if (st == NULL || i < 0 || i >= st->num) ^ 287. return NULL; 288. return (void *)st->data[i]; crypto/stack/stack.c:287:9: 285. { 286. if (st == NULL || i < 0 || i >= st->num) 287. > return NULL; 288. return (void *)st->data[i]; 289. } crypto/stack/stack.c:289:1: return from a call to OPENSSL_sk_value 287. return NULL; 288. return (void *)st->data[i]; 289. > } 290. 291. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) include/openssl/x509.h:100:1: return from a call to sk_X509_value 98. typedef struct x509_cinf_st X509_CINF; 99. 100. > DEFINE_STACK_OF(X509) 101. 102. /* This is used for a table of trust checking functions */ ssl/t1_lib.c:2284:9: 2282. if (x == NULL) { 2283. x = sk_X509_value(sk, 0); 2284. > start_idx = 1; 2285. } else 2286. start_idx = 0; ssl/t1_lib.c:2288:5: 2286. start_idx = 0; 2287. 2288. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 2289. if (rv != 1) 2290. return rv;
https://github.com/openssl/openssl/blob/e8e5597606d10fcb5620399dd751be4ecf3dcd1d/ssl/t1_lib.c/#L2288
d2a_code_trace_data_45376
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/ec/ecp_smpl.c:568: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_sqr`. Showing all 21 steps of the trace crypto/ec/ecp_smpl.c:519:9: Call 517. 518. BN_CTX_start(ctx); 519. Z = BN_CTX_get(ctx); ^ 520. Z_1 = BN_CTX_get(ctx); 521. Z_2 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ecp_smpl.c:568:18: Call 566. goto err; 567. } else { 568. if (!BN_mod_sqr(Z_2, Z_1, group->field, ctx)) ^ 569. goto err; 570. } crypto/bn/bn_mod.c:222:1: Parameter `*r->d` 220. } 221. 222. > int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 223. { 224. if (!BN_sqr(r, a, ctx)) crypto/bn/bn_mod.c:224:10: Call 222. int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 223. { 224. if (!BN_sqr(r, a, ctx)) ^ 225. return 0; 226. /* r->neg == 0, thus we don't need BN_nnmod */ crypto/bn/bn_sqr.c:17:1: Parameter `*r->d` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:27:1: Parameter `a->top` 25. } 26. 27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 28. { 29. int max, al; crypto/bn/bn_sqr.c:35:5: Assignment 33. bn_check_top(a); 34. 35. al = a->top; ^ 36. if (al <= 0) { 37. r->top = 0; crypto/bn/bn_sqr.c:84:17: Call 82. if (bn_wexpand(tmp, max) == NULL) 83. goto err; 84. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 85. } 86. } crypto/bn/bn_sqr.c:109:1: <Offset trace> 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:109:1: Parameter `n` 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:120:5: Assignment 118. rp[0] = rp[max - 1] = 0; 119. rp++; 120. j = n; ^ 121. 122. if (--j > 0) { crypto/bn/bn_sqr.c:122:9: Assignment 120. j = n; 121. 122. if (--j > 0) { ^ 123. ap++; 124. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:109:1: <Length trace> 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:109:1: Parameter `*r` 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:117:5: Assignment 115. max = n * 2; 116. ap = a; 117. rp = r; ^ 118. rp[0] = rp[max - 1] = 0; 119. rp++; crypto/bn/bn_sqr.c:119:5: Assignment 117. rp = r; 118. rp[0] = rp[max - 1] = 0; 119. rp++; ^ 120. j = n; 121. crypto/bn/bn_sqr.c:124:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_sqr` 122. if (--j > 0) { 123. ap++; 124. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 125. rp += 2; 126. }
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_sqr.c/#L124
d2a_code_trace_data_45377
static av_always_inline int cmp_direct_inline(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, int qpel){ MotionEstContext * const c= &s->me; const int stride= c->stride; 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; 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; return d; } libavcodec/motion_est.c:1532: error: Buffer Overrun L1 Offset: 10 (⇐ 2 + 8) Size: 4 by call to `estimate_motion_b`. libavcodec/motion_est.c:1532:12: Call 1530. 1531. c->skip=0; 1532. bmin = estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + ^ 1533. 2 * penalty_factor; 1534. av_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); libavcodec/motion_est.c:1110:1: Parameter `ref_index` 1108. } 1109. 1110. static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y, ^ 1111. int16_t (*mv_table)[2], int ref_index, int f_code) 1112. { libavcodec/motion_est.c:1165:16: Call 1163. } 1164. 1165. dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16); ^ 1166. 1167. break; libavcodec/motion_est_template.c:976:1: Parameter `ref_index` 974. 975. //this function is dedicated to the braindamaged gcc 976. int ff_epzs_motion_search(MpegEncContext *s, int *mx_ptr, int *my_ptr, ^ 977. int P[10][2], int src_index, int ref_index, 978. int16_t (*last_mv)[2], int ref_mv_scale, libavcodec/motion_est_template.c:984:16: Call 982. //FIXME convert other functions in the same way if faster 983. if(c->flags==0 && h==16 && size==0){ 984. return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16); ^ 985. // case FLAG_QPEL: 986. // 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:860:1: Parameter `ref_index` 858. optimal mv. 859. */ 860. static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 861. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 862. int ref_mv_scale, int flags, int size, int h) libavcodec/motion_est_template.c:966:11: Call 964. 965. //check(best[0],best[1],0, b0) 966. dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 967. 968. //check(best[0],best[1],0, b1) libavcodec/motion_est_template.c:832:1: Parameter `ref_index` 830. } 831. 832. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, ^ 833. int src_index, int ref_index, int const penalty_factor, 834. int size, int h, int flags){ libavcodec/motion_est_template.c:845:26: Call 843. return full_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); 844. else if(c->dia_size>768) 845. return umh_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 846. else if(c->dia_size>512) 847. return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, c->dia_size&0xFF); libavcodec/motion_est_template.c:574:1: Parameter `ref_index` 572. } 573. 574. static int umh_search(MpegEncContext * s, int *best, int dmin, ^ 575. int src_index, int ref_index, int const penalty_factor, 576. int size, int h, int flags) libavcodec/motion_est_template.c:596:9: Call 594. y= best[1]; 595. for(x2=FFMAX(x-dia_size+1, xmin); x2<=FFMIN(x+dia_size-1,xmax); x2+=2){ 596. CHECK_MV(x2, y); ^ 597. } 598. for(y2=FFMAX(y-dia_size/2+1, ymin); y2<=FFMIN(y+dia_size/2-1,ymax); y2+=2){ libavcodec/motion_est.c:252:1: Parameter `ref_index` 250. against a proposed motion-compensated prediction of that block 251. */ 252. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 253. const int size, const int h, int ref_index, int src_index, 254. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:261:16: Call 259. }else if(av_builtin_constant_p(subx) && av_builtin_constant_p(suby) 260. && subx==0 && suby==0){ 261. return cmp_fpel_internal(s,x,y,size,h,ref_index,src_index, cmp_func, chroma_cmp_func,flags); ^ 262. }else{ 263. return cmp_internal(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags); libavcodec/motion_est.c:229:1: Parameter `ref_index` 227. } 228. 229. static int cmp_fpel_internal(MpegEncContext *s, const int x, const int y, ^ 230. const int size, const int h, int ref_index, int src_index, 231. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:233:16: Call 231. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ 232. if(flags&FLAG_DIRECT){ 233. return cmp_direct_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL); ^ 234. }else{ 235. return cmp_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0, flags&FLAG_CHROMA); libavcodec/motion_est.c:105:1: <Length trace> 103. } 104. 105. static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 106. const int size, const int h, int ref_index, int src_index, 107. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel){ libavcodec/motion_est.c:105:1: Parameter `ref_index` 103. } 104. 105. static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 106. const int size, const int h, int ref_index, int src_index, 107. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel){ libavcodec/motion_est.c:112:5: Assignment 110. const int hx= subx + (x<<(1+qpel)); 111. const int hy= suby + (y<<(1+qpel)); 112. uint8_t * const * const ref= c->ref[ref_index]; ^ 113. uint8_t * const * const src= c->src[src_index]; 114. int d; libavcodec/motion_est.c:168:50: Array access: Offset: 10 (⇐ 2 + 8) Size: 4 by call to `estimate_motion_b` 166. 167. c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); 168. c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); ^ 169. } 170. }
https://github.com/libav/libav/blob/483321fe789566dcb27b6387c00ea16dd86bc587/libavcodec/motion_est.c/#L168
d2a_code_trace_data_45378
int ec_precompute_mont_data(EC_GROUP *group) { BN_CTX *ctx = BN_CTX_new(); int ret = 0; BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; if (ctx == NULL) goto err; group->mont_data = BN_MONT_CTX_new(); if (group->mont_data == NULL) goto err; if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; goto err; } ret = 1; err: BN_CTX_free(ctx); return ret; } crypto/ec/ec_lib.c:976: error: MEMORY_LEAK memory dynamically allocated to `group->mont_data` by call to `BN_MONT_CTX_new()` at line 970, column 24 is not reachable after line 976, column 9. Showing all 65 steps of the trace crypto/ec/ec_lib.c:959:1: start of procedure ec_precompute_mont_data() 957. * returns one on success. On error it returns zero. 958. */ 959. > int ec_precompute_mont_data(EC_GROUP *group) 960. { 961. BN_CTX *ctx = BN_CTX_new(); crypto/ec/ec_lib.c:961:5: 959. int ec_precompute_mont_data(EC_GROUP *group) 960. { 961. > BN_CTX *ctx = BN_CTX_new(); 962. int ret = 0; 963. crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. 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_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) crypto/ec/ec_lib.c:962:5: 960. { 961. BN_CTX *ctx = BN_CTX_new(); 962. > int ret = 0; 963. 964. BN_MONT_CTX_free(group->mont_data); crypto/ec/ec_lib.c:964:5: Skipping BN_MONT_CTX_free(): empty list of specs 962. int ret = 0; 963. 964. BN_MONT_CTX_free(group->mont_data); ^ 965. group->mont_data = NULL; 966. crypto/ec/ec_lib.c:965:5: 963. 964. BN_MONT_CTX_free(group->mont_data); 965. > group->mont_data = NULL; 966. 967. if (ctx == NULL) crypto/ec/ec_lib.c:967:9: Taking false branch 965. group->mont_data = NULL; 966. 967. if (ctx == NULL) ^ 968. goto err; 969. crypto/ec/ec_lib.c:970:5: 968. goto err; 969. 970. > group->mont_data = BN_MONT_CTX_new(); 971. if (group->mont_data == NULL) 972. goto err; crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking false branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:322:5: 320. return (NULL); 321. 322. > BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init() 325. } 326. 327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. ctx->ri = 0; crypto/bn/bn_mont.c:329:5: 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. > ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs 328. { 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); ^ 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); ^ 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); ^ 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; crypto/bn/bn_mont.c:333:5: 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); 333. > ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. } crypto/bn/bn_mont.c:334:5: 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; 334. > ctx->flags = 0; 335. } 336. crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. > } 336. 337. void BN_MONT_CTX_free(BN_MONT_CTX *mont) crypto/bn/bn_mont.c:323:5: 321. 322. BN_MONT_CTX_init(ret); 323. > ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. } crypto/bn/bn_mont.c:324:5: 322. BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. > return (ret); 325. } 326. crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) crypto/ec/ec_lib.c:971:9: Taking false branch 969. 970. group->mont_data = BN_MONT_CTX_new(); 971. if (group->mont_data == NULL) ^ 972. goto err; 973. crypto/ec/ec_lib.c:974:10: Taking true branch 972. goto err; 973. 974. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { ^ 975. BN_MONT_CTX_free(group->mont_data); 976. group->mont_data = NULL; crypto/ec/ec_lib.c:975:9: Skipping BN_MONT_CTX_free(): empty list of specs 973. 974. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { 975. BN_MONT_CTX_free(group->mont_data); ^ 976. group->mont_data = NULL; 977. goto err; crypto/ec/ec_lib.c:976:9: 974. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { 975. BN_MONT_CTX_free(group->mont_data); 976. > group->mont_data = NULL; 977. goto err; 978. }
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/crypto/ec/ec_lib.c/#L976
d2a_code_trace_data_45379
int test_kron(BIO *bp, BN_CTX *ctx) { BN_GENCB cb; BIGNUM *a, *b, *r, *t; int i; int legendre, kronecker; int ret = 0; a = BN_new(); b = BN_new(); r = BN_new(); t = BN_new(); if (a == NULL || b == NULL || r == NULL || t == NULL) goto err; BN_GENCB_set(&cb, genprime_cb, NULL); if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err; b->neg = rand_neg(); putc('\n', stderr); for (i = 0; i < num0; i++) { if (!BN_bntest_rand(a, 512, 0, 0)) goto err; a->neg = rand_neg(); if (!BN_copy(t, b)) goto err; t->neg = 0; if (!BN_sub_word(t, 1)) goto err; if (!BN_rshift1(t, t)) goto err; b->neg = 0; if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err; b->neg = 1; if (BN_is_word(r, 1)) legendre = 1; else if (BN_is_zero(r)) legendre = 0; else { if (!BN_add_word(r, 1)) goto err; if (0 != BN_ucmp(r, b)) { fprintf(stderr, "Legendre symbol computation failed\n"); goto err; } legendre = -1; } kronecker = BN_kronecker(a, b, ctx); if (kronecker < -1) goto err; if (a->neg && b->neg) kronecker = -kronecker; if (legendre != kronecker) { fprintf(stderr, "legendre != kronecker; a = "); BN_print_fp(stderr, a); fprintf(stderr, ", b = "); BN_print_fp(stderr, b); fprintf(stderr, "\n"); goto err; } putc('.', stderr); fflush(stderr); } putc('\n', stderr); fflush(stderr); ret = 1; err: BN_free(a); BN_free(b); BN_free(r); BN_free(t); return ret; } test/bntest.c:1733: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1651, column 9 is not reachable after line 1733, column 5. Showing all 116 steps of the trace test/bntest.c:1643:1: start of procedure test_kron() 1641. } 1642. 1643. > int test_kron(BIO *bp, BN_CTX *ctx) 1644. { 1645. BN_GENCB cb; test/bntest.c:1649:5: 1647. int i; 1648. int legendre, kronecker; 1649. > int ret = 0; 1650. 1651. a = BN_new(); test/bntest.c:1651:5: 1649. int ret = 0; 1650. 1651. > a = BN_new(); 1652. b = BN_new(); 1653. r = 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:1652:5: 1650. 1651. a = BN_new(); 1652. > b = BN_new(); 1653. r = BN_new(); 1654. t = 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:1653:5: 1651. a = BN_new(); 1652. b = BN_new(); 1653. > r = BN_new(); 1654. t = BN_new(); 1655. if (a == NULL || b == NULL || r == NULL || t == NULL) 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:1654:5: 1652. b = BN_new(); 1653. r = BN_new(); 1654. > t = BN_new(); 1655. if (a == NULL || b == NULL || r == NULL || t == NULL) 1656. goto err; 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:1655:9: Taking false branch 1653. r = BN_new(); 1654. t = BN_new(); 1655. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1656. goto err; 1657. test/bntest.c:1655:22: Taking false branch 1653. r = BN_new(); 1654. t = BN_new(); 1655. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1656. goto err; 1657. test/bntest.c:1655:35: Taking false branch 1653. r = BN_new(); 1654. t = BN_new(); 1655. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1656. goto err; 1657. test/bntest.c:1655:48: Taking false branch 1653. r = BN_new(); 1654. t = BN_new(); 1655. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1656. goto err; 1657. test/bntest.c:1658:5: 1656. goto err; 1657. 1658. > BN_GENCB_set(&cb, genprime_cb, NULL); 1659. 1660. /* crypto/bn/bn_lib.c:981:1: start of procedure BN_GENCB_set() 979. 980. /* Populate a BN_GENCB structure with a "new"-style callback */ 981. > void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), 982. void *cb_arg) 983. { crypto/bn/bn_lib.c:984:5: 982. void *cb_arg) 983. { 984. > BN_GENCB *tmp_gencb = gencb; 985. tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; crypto/bn/bn_lib.c:985:5: 983. { 984. BN_GENCB *tmp_gencb = gencb; 985. > tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; crypto/bn/bn_lib.c:986:5: 984. BN_GENCB *tmp_gencb = gencb; 985. tmp_gencb->ver = 2; 986. > tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; 988. } crypto/bn/bn_lib.c:987:5: 985. tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; 987. > tmp_gencb->cb.cb_2 = callback; 988. } 989. crypto/bn/bn_lib.c:988:1: return from a call to BN_GENCB_set 986. tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; 988. > } 989. 990. void *BN_GENCB_get_arg(BN_GENCB *cb) test/bntest.c:1670:10: Taking true branch 1668. */ 1669. 1670. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) ^ 1671. goto err; 1672. b->neg = rand_neg(); test/bntest.c:1732:2: 1730. fflush(stderr); 1731. ret = 1; 1732. > err: 1733. BN_free(a); 1734. BN_free(b); test/bntest.c:1733:5: 1731. ret = 1; 1732. err: 1733. > BN_free(a); 1734. BN_free(b); 1735. BN_free(r); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1733
d2a_code_trace_data_45380
int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow){ const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int max=0; unsigned int threshold1, threshold2; int bias=0; int run_tab[65]; int level_tab[65]; int score_tab[65]; int survivor[65]; int survivor_count; int last_run=0; int last_level=0; int last_score= 0; int last_i; int coeff[2][64]; int coeff_count[64]; int qmul, qadd, start_i, last_non_zero, i, dc; const int esc_length= s->ac_esc_length; uint8_t * length; uint8_t * last_length; const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); s->dsp.fdct (block); if(s->dct_error_sum) s->denoise_dct(s, block); qmul= qscale*16; qadd= ((qscale-1)|1)*8; if (s->mb_intra) { int q; if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else{ q = 1 << 3; qadd=0; } block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; if(s->mpeg_quant || s->out_format == FMT_MPEG1) bias= 1<<(QMAT_SHIFT-1); length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_i= start_i; threshold1= (1<<QMAT_SHIFT) - bias - 1; threshold2= (threshold1<<1); for(i=63; i>=start_i; i--) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ last_non_zero = i; break; } } for(i=start_i; i<=last_non_zero; i++) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>QMAT_SHIFT; coeff[0][i]= level; coeff[1][i]= level-1; }else{ level= (bias - level)>>QMAT_SHIFT; coeff[0][i]= -level; coeff[1][i]= -level+1; } coeff_count[i]= FFMIN(level, 2); assert(coeff_count[i]); max |=level; }else{ coeff[0][i]= (level>>31)|1; coeff_count[i]= 1; } } *overflow= s->max_qcoeff < max; if(last_non_zero < start_i){ memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); return last_non_zero; } score_tab[start_i]= 0; survivor[0]= start_i; survivor_count= 1; for(i=start_i; i<=last_non_zero; i++){ int level_index, j, zero_distoration; int dct_coeff= FFABS(block[ scantable[i] ]); int best_score=256*256*256*120; if ( s->dsp.fdct == fdct_ifast #ifndef FAAN_POSTSCALE || s->dsp.fdct == ff_faandct #endif ) dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12; zero_distoration= dct_coeff*dct_coeff; for(level_index=0; level_index < coeff_count[i]; level_index++){ int distoration; int level= coeff[level_index][i]; const int alevel= FFABS(level); int unquant_coeff; assert(level); if(s->out_format == FMT_H263){ unquant_coeff= alevel*qmul + qadd; }else{ j= s->dsp.idct_permutation[ scantable[i] ]; if(s->mb_intra){ unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; unquant_coeff = (unquant_coeff - 1) | 1; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff<<= 3; } distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration; level+=64; if((level&(~127)) == 0){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } }else{ distoration += esc_length*lambda; for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } } } score_tab[i+1]= best_score; if(last_non_zero <= 27){ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score) break; } }else{ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda) break; } } survivor[ survivor_count++ ]= i+1; } if(s->out_format != FMT_H263){ last_score= 256*256*256*120; for(i= survivor[0]; i<=last_non_zero + 1; i++){ int score= score_tab[i]; if(i) score += lambda*2; if(score < last_score){ last_score= score; last_i= i; last_level= level_tab[i]; last_run= run_tab[i]; } } } s->coded_score[n] = last_score; dc= FFABS(block[0]); last_non_zero= last_i - 1; memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); if(last_non_zero < start_i) return last_non_zero; if(last_non_zero == 0 && start_i == 0){ int best_level= 0; int best_score= dc * dc; for(i=0; i<coeff_count[0]; i++){ int level= coeff[i][0]; int alevel= FFABS(level); int unquant_coeff, score, distortion; if(s->out_format == FMT_H263){ unquant_coeff= (alevel*qmul + qadd)>>3; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff = (unquant_coeff + 4) >> 3; unquant_coeff<<= 3 + 3; distortion= (unquant_coeff - dc) * (unquant_coeff - dc); level+=64; if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda; else score= distortion + esc_length*lambda; if(score < best_score){ best_score= score; best_level= level - 64; } } block[0]= best_level; s->coded_score[n] = best_score - dc*dc; if(best_level == 0) return -1; else return last_non_zero; } i= last_i; assert(last_level); block[ perm_scantable[last_non_zero] ]= last_level; i -= last_run + 1; for(; i>start_i; i -= run_tab[i] + 1){ block[ perm_scantable[i-1] ]= level_tab[i]; } return last_non_zero; } libavcodec/mpegvideo_enc.c:3121: error: Buffer Overrun L2 Offset: [-63, 127] Size: 65. libavcodec/mpegvideo_enc.c:3013:9: <Offset trace> 3011. /* note: block[0] is assumed to be positive */ 3012. block[0] = (block[0] + (q >> 1)) / q; 3013. start_i = 1; ^ 3014. last_non_zero = 0; 3015. qmat = s->q_intra_matrix[qscale]; libavcodec/mpegvideo_enc.c:3013:9: Assignment 3011. /* note: block[0] is assumed to be positive */ 3012. block[0] = (block[0] + (q >> 1)) / q; 3013. start_i = 1; ^ 3014. last_non_zero = 0; 3015. qmat = s->q_intra_matrix[qscale]; libavcodec/mpegvideo_enc.c:2964:1: <Length trace> 2962. } 2963. 2964. int dct_quantize_trellis_c(MpegEncContext *s, ^ 2965. DCTELEM *block, int n, 2966. int qscale, int *overflow){ libavcodec/mpegvideo_enc.c:2964:1: Array declaration 2962. } 2963. 2964. int dct_quantize_trellis_c(MpegEncContext *s, ^ 2965. DCTELEM *block, int n, 2966. int qscale, int *overflow){ libavcodec/mpegvideo_enc.c:3121:30: Array access: Offset: [-63, 127] Size: 65 3119. int run= i - survivor[j]; 3120. int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda; 3121. score += score_tab[i-run]; ^ 3122. 3123. if(score < best_score){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3121
d2a_code_trace_data_45381
TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, toff_t nDirOffset ) { TIFFOvrCache *psCache; toff_t nBaseDirOffset; psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache)); psCache->nDirOffset = nDirOffset; psCache->hTIFF = hTIFF; nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF ); TIFFSetSubDirectory( hTIFF, nDirOffset ); TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) ); TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize) ); TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &(psCache->nBitsPerPixel) ); TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &(psCache->nSamples) ); TIFFGetField( hTIFF, TIFFTAG_PLANARCONFIG, &(psCache->nPlanarConfig) ); if( !TIFFIsTiled( hTIFF ) ) { TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(psCache->nBlockYSize) ); psCache->nBlockXSize = psCache->nXSize; psCache->nBytesPerBlock = TIFFStripSize(hTIFF); psCache->bTiled = FALSE; } else { TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &(psCache->nBlockXSize) ); TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &(psCache->nBlockYSize) ); psCache->nBytesPerBlock = TIFFTileSize(hTIFF); psCache->bTiled = TRUE; } psCache->nBlocksPerRow = (psCache->nXSize + psCache->nBlockXSize - 1) / psCache->nBlockXSize; psCache->nBlocksPerColumn = (psCache->nYSize + psCache->nBlockYSize - 1) / psCache->nBlockYSize; if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE) psCache->nBytesPerRow = psCache->nBytesPerBlock * psCache->nBlocksPerRow * psCache->nSamples; else psCache->nBytesPerRow = psCache->nBytesPerBlock * psCache->nBlocksPerRow; psCache->pabyRow1Blocks = (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow); psCache->pabyRow2Blocks = (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow); if ( psCache->pabyRow1Blocks == NULL || psCache->pabyRow2Blocks == NULL ) { TIFFErrorExt( hTIFF->tif_clientdata, hTIFF->tif_name, "Can't allocate memory for overview cache." ); if (psCache->pabyRow1Blocks) _TIFFfree(psCache->pabyRow1Blocks); if (psCache->pabyRow2Blocks) _TIFFfree(psCache->pabyRow2Blocks); _TIFFfree( psCache ); return NULL; } _TIFFmemset( psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow ); _TIFFmemset( psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow ); psCache->nBlockOffset = 0; TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset ); return psCache; } contrib/addtiffo/tif_ovrcache.c:50: error: Null Dereference pointer `psCache` last assigned on line 49 could be null and is dereferenced at line 50, column 5. contrib/addtiffo/tif_ovrcache.c:43:1: start of procedure TIFFCreateOvrCache() 41. /************************************************************************/ 42. 43. TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, toff_t nDirOffset ) ^ 44. 45. { contrib/addtiffo/tif_ovrcache.c:49:5: 47. toff_t nBaseDirOffset; 48. 49. psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache)); ^ 50. psCache->nDirOffset = nDirOffset; 51. psCache->hTIFF = hTIFF; libtiff/tif_unix.c:310:1: start of procedure _TIFFmalloc() 308. #endif 309. 310. void* ^ 311. _TIFFmalloc(tmsize_t s) 312. { libtiff/tif_unix.c:313:13: Taking false branch 311. _TIFFmalloc(tmsize_t s) 312. { 313. if (s == 0) ^ 314. return ((void *) NULL); 315. libtiff/tif_unix.c:316:2: 314. return ((void *) NULL); 315. 316. return (malloc((size_t) s)); ^ 317. } 318. libtiff/tif_unix.c:317:1: return from a call to _TIFFmalloc 315. 316. return (malloc((size_t) s)); 317. } ^ 318. 319. void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz) contrib/addtiffo/tif_ovrcache.c:50:5: 48. 49. psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache)); 50. psCache->nDirOffset = nDirOffset; ^ 51. psCache->hTIFF = hTIFF; 52.
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/contrib/addtiffo/tif_ovrcache.c/#L50
d2a_code_trace_data_45382
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/ec/ec2_mult.c:263: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_GF2m_mod_arr`. Showing all 18 steps of the trace crypto/ec/ec2_mult.c:248:10: Call 246. */ 247. BN_CTX_start(ctx); 248. x1 = BN_CTX_get(ctx); ^ 249. z1 = BN_CTX_get(ctx); 250. if (z1 == NULL) 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:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/ec/ec2_mult.c:263:10: Call 261. goto err; 262. 263. if (!BN_GF2m_mod_arr(x1, point->X, group->poly)) ^ 264. goto err; /* x1 = x */ 265. if (!BN_one(z1)) crypto/bn/bn_gf2m.c:300:1: Parameter `*r->d` 298. 299. /* Performs modular reduction of a and store result in r. r could be a. */ 300. > int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]) 301. { 302. int j, k; crypto/bn/bn_gf2m.c:310:9: Call 308. if (!p[0]) { 309. /* reduction mod 1 => return 0 */ 310. BN_zero(r); ^ 311. return 1; 312. } crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:684:12: Call 682. return a; 683. 684. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 685. } 686. 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_GF2m_mod_arr` 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/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L289
d2a_code_trace_data_45383
static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) { int smp = bd->block_length - 1; int32_t val = *bd->raw_samples; int32_t *dst = bd->raw_samples + 1; for (; smp; smp--) *dst++ = val; } libavcodec/alsdec.c:1340: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `decode_blocks_ind`. libavcodec/alsdec.c:1327:13: Call 1325. js_blocks[1] = 0; 1326. 1327. get_block_sizes(ctx, div_blocks, &bs_info); ^ 1328. 1329. // if joint_stereo and block_switching is set, independent decoding libavcodec/alsdec.c:499:1: Parameter `ctx->sconf.frame_length` 497. * actual number of samples. 498. */ 499. static void get_block_sizes(ALSDecContext *ctx, unsigned int *div_blocks, ^ 500. uint32_t *bs_info) 501. { libavcodec/alsdec.c:532:9: Assignment 530. 531. for (b = 0; b < ctx->num_blocks; b++) 532. div_blocks[b] = ctx->sconf.frame_length >> div_blocks[b]; ^ 533. 534. if (ctx->cur_frame_length != ctx->sconf.frame_length) { libavcodec/alsdec.c:1340:23: Call 1338. 1339. if (independent_bs) { 1340. ret = decode_blocks_ind(ctx, ra_frame, c, ^ 1341. div_blocks, js_blocks); 1342. if (ret < 0) libavcodec/alsdec.c:1035:1: Parameter `*div_blocks` 1033. /** Decode blocks independently. 1034. */ 1035. static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame, ^ 1036. unsigned int c, const unsigned int *div_blocks, 1037. unsigned int *js_blocks) libavcodec/alsdec.c:1058:9: Assignment 1056. 1057. for (b = 0; b < ctx->num_blocks; b++) { 1058. bd.block_length = div_blocks[b]; ^ 1059. 1060. if ((ret = read_decode_block(ctx, &bd)) < 0) { libavcodec/alsdec.c:1060:20: Call 1058. bd.block_length = div_blocks[b]; 1059. 1060. if ((ret = read_decode_block(ctx, &bd)) < 0) { ^ 1061. // damaged block, write zero for the rest of the frame 1062. zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples); libavcodec/alsdec.c:1006:1: Parameter `bd->block_length` 1004. /** Read and decode block data successively. 1005. */ 1006. static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 1007. { 1008. int ret; libavcodec/alsdec.c:1013:12: Call 1011. return ret; 1012. 1013. return decode_block(ctx, bd); ^ 1014. } 1015. libavcodec/alsdec.c:980:1: Parameter `bd->block_length` 978. /** Decode the block data. 979. */ 980. static int decode_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 981. { 982. unsigned int smp; libavcodec/alsdec.c:987:9: Call 985. // read block type flag and read the samples accordingly 986. if (*bd->const_block) 987. decode_const_block_data(ctx, bd); ^ 988. else 989. ret = decode_var_block_data(ctx, bd); // always return 0 libavcodec/alsdec.c:577:1: <LHS trace> 575. /** Decode the block data for a constant block 576. */ 577. static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 578. { 579. int smp = bd->block_length - 1; libavcodec/alsdec.c:577:1: Parameter `bd->block_length` 575. /** Decode the block data for a constant block 576. */ 577. static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 578. { 579. int smp = bd->block_length - 1; libavcodec/alsdec.c:579:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `decode_blocks_ind` 577. static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) 578. { 579. int smp = bd->block_length - 1; ^ 580. int32_t val = *bd->raw_samples; 581. int32_t *dst = bd->raw_samples + 1;
https://github.com/libav/libav/blob/582963a8156522582e55466be4a59974a8d909a5/libavcodec/alsdec.c/#L579
d2a_code_trace_data_45384
static ngx_int_t ngx_http_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data) { ngx_http_upstream_hash_peer_data_t *hp = data; time_t now; u_char buf[NGX_INT_T_LEN]; size_t size; uint32_t hash; ngx_int_t w; uintptr_t m; ngx_uint_t i, n, p; ngx_http_upstream_rr_peer_t *peer; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, "get hash peer, try: %ui", pc->tries); if (hp->tries > 20 || hp->rrp.peers->single) { return hp->get_rr_peer(pc, &hp->rrp); } now = ngx_time(); pc->cached = 0; pc->connection = NULL; for ( ;; ) { ngx_crc32_init(hash); if (hp->rehash > 0) { size = ngx_sprintf(buf, "%ui", hp->rehash) - buf; ngx_crc32_update(&hash, buf, size); } ngx_crc32_update(&hash, hp->key.data, hp->key.len); ngx_crc32_final(hash); hash = (hash >> 16) & 0x7fff; hp->hash += hash; hp->rehash++; if (!hp->rrp.peers->weighted) { p = hp->hash % hp->rrp.peers->number; } else { w = hp->hash % hp->rrp.peers->total_weight; for (i = 0; i < hp->rrp.peers->number; i++) { w -= hp->rrp.peers->peer[i].weight; if (w < 0) { break; } } p = i; } n = p / (8 * sizeof(uintptr_t)); m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t)); if (hp->rrp.tried[n] & m) { goto next; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, "get hash peer, value:%uD, peer:%ui", hp->hash, p); peer = &hp->rrp.peers->peer[p]; if (peer->down) { goto next; } if (peer->max_fails && peer->fails >= peer->max_fails && now - peer->checked <= peer->fail_timeout) { goto next; } break; next: if (++hp->tries > 20) { return hp->get_rr_peer(pc, &hp->rrp); } } hp->rrp.current = p; pc->sockaddr = peer->sockaddr; pc->socklen = peer->socklen; pc->name = &peer->name; if (now - peer->checked > peer->fail_timeout) { peer->checked = now; } hp->rrp.tried[n] |= m; return NGX_OK; } src/http/modules/ngx_http_upstream_hash_module.c:269: error: Uninitialized Value The value read from m was never initialized. src/http/modules/ngx_http_upstream_hash_module.c:269:5: 267. } 268. 269. hp->rrp.tried[n] |= m; ^ 270. 271. return NGX_OK;
https://github.com/nginx/nginx/blob/9b5a17b5e23e8e7c94d84eb85044370e38887849/src/http/modules/ngx_http_upstream_hash_module.c/#L269
d2a_code_trace_data_45385
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1795: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 11 steps of the trace test/bntest.c:1795:10: Call 1793. BN_set_negative(a, 1); 1794. BN_zero(b); 1795. if (!TEST_true(BN_mul(c, a, b, ctx))) ^ 1796. goto err; 1797. if (!TEST_BN_eq_zero(c) crypto/bn/bn_mul.c:521:5: Call 519. top = al + bl; 520. 521. BN_CTX_start(ctx); ^ 522. if ((r == a) || (r == b)) { 523. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:646:5: Call 644. err: 645. bn_check_top(r); 646. BN_CTX_end(ctx); ^ 647. return (ret); 648. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45386
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; InternalBuffer *buf, *last; assert(pic->type==FF_BUFFER_TYPE_INTERNAL); assert(s->internal_buffer_count); buf = NULL; for(i=0; i<s->internal_buffer_count; i++){ buf= &((InternalBuffer*)s->internal_buffer)[i]; if(buf->data[0] == pic->data[0]) break; } assert(i < s->internal_buffer_count); s->internal_buffer_count--; last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; FFSWAP(InternalBuffer, *buf, *last); for(i=0; i<4; i++){ pic->data[i]=NULL; } if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count); } libavcodec/utils.c:379: error: Null Dereference pointer `buf` last assigned on line 369 could be null and is dereferenced at line 379, column 5. libavcodec/utils.c:362:1: start of procedure avcodec_default_release_buffer() 360. } 361. 362. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ ^ 363. int i; 364. InternalBuffer *buf, *last; libavcodec/utils.c:366:5: 364. InternalBuffer *buf, *last; 365. 366. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); ^ 367. assert(s->internal_buffer_count); 368. libavcodec/utils.c:367:5: 365. 366. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); 367. assert(s->internal_buffer_count); ^ 368. 369. buf = NULL; /* avoids warning */ libavcodec/utils.c:369:5: 367. assert(s->internal_buffer_count); 368. 369. buf = NULL; /* avoids warning */ ^ 370. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize 371. buf= &((InternalBuffer*)s->internal_buffer)[i]; libavcodec/utils.c:370:9: 368. 369. buf = NULL; /* avoids warning */ 370. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 371. buf= &((InternalBuffer*)s->internal_buffer)[i]; 372. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:370:14: Loop condition is false. Leaving loop 368. 369. buf = NULL; /* avoids warning */ 370. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 371. buf= &((InternalBuffer*)s->internal_buffer)[i]; 372. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:375:5: 373. break; 374. } 375. assert(i < s->internal_buffer_count); ^ 376. s->internal_buffer_count--; 377. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; libavcodec/utils.c:376:5: 374. } 375. assert(i < s->internal_buffer_count); 376. s->internal_buffer_count--; ^ 377. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 378. libavcodec/utils.c:377:5: 375. assert(i < s->internal_buffer_count); 376. s->internal_buffer_count--; 377. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; ^ 378. 379. FFSWAP(InternalBuffer, *buf, *last); libavcodec/utils.c:379:5: 377. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 378. 379. FFSWAP(InternalBuffer, *buf, *last); ^ 380. 381. for(i=0; i<4; i++){
https://github.com/libav/libav/blob/938b62538a719785bce0f1d49d3065937b29e3aa/libavcodec/utils.c/#L379
d2a_code_trace_data_45387
static int matroska_decode_buffer(uint8_t** buf, int* buf_size, MatroskaTrack *track) { MatroskaTrackEncoding *encodings = track->encodings.elem; uint8_t* data = *buf; int isize = *buf_size; uint8_t* pkt_data = NULL; int pkt_size = isize; int result = 0; int olen; if (pkt_size >= 10000000) return -1; switch (encodings[0].compression.algo) { case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: return encodings[0].compression.settings.size; case MATROSKA_TRACK_ENCODING_COMP_LZO: do { olen = pkt_size *= 3; pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); result = av_lzo1x_decode(pkt_data, &olen, data, &isize); } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); if (result) goto failed; pkt_size -= olen; break; #if CONFIG_ZLIB case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { z_stream zstream = {0}; if (inflateInit(&zstream) != Z_OK) return -1; zstream.next_in = data; zstream.avail_in = isize; do { pkt_size *= 3; pkt_data = av_realloc(pkt_data, pkt_size); zstream.avail_out = pkt_size - zstream.total_out; zstream.next_out = pkt_data + zstream.total_out; result = inflate(&zstream, Z_NO_FLUSH); } while (result==Z_OK && pkt_size<10000000); pkt_size = zstream.total_out; inflateEnd(&zstream); if (result != Z_STREAM_END) goto failed; break; } #endif #if CONFIG_BZLIB case MATROSKA_TRACK_ENCODING_COMP_BZLIB: { bz_stream bzstream = {0}; if (BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK) return -1; bzstream.next_in = data; bzstream.avail_in = isize; do { pkt_size *= 3; pkt_data = av_realloc(pkt_data, pkt_size); bzstream.avail_out = pkt_size - bzstream.total_out_lo32; bzstream.next_out = pkt_data + bzstream.total_out_lo32; result = BZ2_bzDecompress(&bzstream); } while (result==BZ_OK && pkt_size<10000000); pkt_size = bzstream.total_out_lo32; BZ2_bzDecompressEnd(&bzstream); if (result != BZ_STREAM_END) goto failed; break; } #endif default: return -1; } *buf = pkt_data; *buf_size = pkt_size; return 0; failed: av_free(pkt_data); return -1; } libavformat/matroskadec.c:959: error: Memory Leak memory dynamically allocated by call to `av_realloc()` at line 959, column 24 is not reachable after line 959, column 13. libavformat/matroskadec.c:923:1: start of procedure matroska_decode_buffer() 921. } 922. 923. static int matroska_decode_buffer(uint8_t** buf, int* buf_size, ^ 924. MatroskaTrack *track) 925. { libavformat/matroskadec.c:926:5: 924. MatroskaTrack *track) 925. { 926. MatroskaTrackEncoding *encodings = track->encodings.elem; ^ 927. uint8_t* data = *buf; 928. int isize = *buf_size; libavformat/matroskadec.c:927:5: 925. { 926. MatroskaTrackEncoding *encodings = track->encodings.elem; 927. uint8_t* data = *buf; ^ 928. int isize = *buf_size; 929. uint8_t* pkt_data = NULL; libavformat/matroskadec.c:928:5: 926. MatroskaTrackEncoding *encodings = track->encodings.elem; 927. uint8_t* data = *buf; 928. int isize = *buf_size; ^ 929. uint8_t* pkt_data = NULL; 930. int pkt_size = isize; libavformat/matroskadec.c:929:5: 927. uint8_t* data = *buf; 928. int isize = *buf_size; 929. uint8_t* pkt_data = NULL; ^ 930. int pkt_size = isize; 931. int result = 0; libavformat/matroskadec.c:930:5: 928. int isize = *buf_size; 929. uint8_t* pkt_data = NULL; 930. int pkt_size = isize; ^ 931. int result = 0; 932. int olen; libavformat/matroskadec.c:931:5: 929. uint8_t* pkt_data = NULL; 930. int pkt_size = isize; 931. int result = 0; ^ 932. int olen; 933. libavformat/matroskadec.c:934:9: Taking false branch 932. int olen; 933. 934. if (pkt_size >= 10000000) ^ 935. return -1; 936. libavformat/matroskadec.c:937:5: 935. return -1; 936. 937. switch (encodings[0].compression.algo) { ^ 938. case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: 939. return encodings[0].compression.settings.size; libavformat/matroskadec.c:938:5: Switch condition is false. Skipping switch case 936. 937. switch (encodings[0].compression.algo) { 938. case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: ^ 939. return encodings[0].compression.settings.size; 940. case MATROSKA_TRACK_ENCODING_COMP_LZO: libavformat/matroskadec.c:940:5: Switch condition is false. Skipping switch case 938. case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: 939. return encodings[0].compression.settings.size; 940. case MATROSKA_TRACK_ENCODING_COMP_LZO: ^ 941. do { 942. olen = pkt_size *= 3; libavformat/matroskadec.c:951:5: Switch condition is true. Entering switch case 949. break; 950. #if CONFIG_ZLIB 951. case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { ^ 952. z_stream zstream = {0}; 953. if (inflateInit(&zstream) != Z_OK) libavformat/matroskadec.c:952:9: 950. #if CONFIG_ZLIB 951. case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { 952. z_stream zstream = {0}; ^ 953. if (inflateInit(&zstream) != Z_OK) 954. return -1; libavformat/matroskadec.c:953:13: Taking false branch 951. case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { 952. z_stream zstream = {0}; 953. if (inflateInit(&zstream) != Z_OK) ^ 954. return -1; 955. zstream.next_in = data; libavformat/matroskadec.c:955:9: 953. if (inflateInit(&zstream) != Z_OK) 954. return -1; 955. zstream.next_in = data; ^ 956. zstream.avail_in = isize; 957. do { libavformat/matroskadec.c:956:9: 954. return -1; 955. zstream.next_in = data; 956. zstream.avail_in = isize; ^ 957. do { 958. pkt_size *= 3; libavformat/matroskadec.c:958:13: 956. zstream.avail_in = isize; 957. do { 958. pkt_size *= 3; ^ 959. pkt_data = av_realloc(pkt_data, pkt_size); 960. zstream.avail_out = pkt_size - zstream.total_out; libavformat/matroskadec.c:959:13: 957. do { 958. pkt_size *= 3; 959. pkt_data = av_realloc(pkt_data, pkt_size); ^ 960. zstream.avail_out = pkt_size - zstream.total_out; 961. zstream.next_out = pkt_data + zstream.total_out; libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking false branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:135:5: 133. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 134. #else 135. return realloc(ptr, size); ^ 136. #endif 137. } libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr) libavformat/matroskadec.c:960:13: 958. pkt_size *= 3; 959. pkt_data = av_realloc(pkt_data, pkt_size); 960. zstream.avail_out = pkt_size - zstream.total_out; ^ 961. zstream.next_out = pkt_data + zstream.total_out; 962. result = inflate(&zstream, Z_NO_FLUSH); libavformat/matroskadec.c:961:13: 959. pkt_data = av_realloc(pkt_data, pkt_size); 960. zstream.avail_out = pkt_size - zstream.total_out; 961. zstream.next_out = pkt_data + zstream.total_out; ^ 962. result = inflate(&zstream, Z_NO_FLUSH); 963. } while (result==Z_OK && pkt_size<10000000); libavformat/matroskadec.c:962:13: Skipping inflate(): method has no implementation 960. zstream.avail_out = pkt_size - zstream.total_out; 961. zstream.next_out = pkt_data + zstream.total_out; 962. result = inflate(&zstream, Z_NO_FLUSH); ^ 963. } while (result==Z_OK && pkt_size<10000000); 964. pkt_size = zstream.total_out; libavformat/matroskadec.c:963:18: Loop condition is true. Entering loop body 961. zstream.next_out = pkt_data + zstream.total_out; 962. result = inflate(&zstream, Z_NO_FLUSH); 963. } while (result==Z_OK && pkt_size<10000000); ^ 964. pkt_size = zstream.total_out; 965. inflateEnd(&zstream); libavformat/matroskadec.c:963:34: Loop condition is true. Entering loop body 961. zstream.next_out = pkt_data + zstream.total_out; 962. result = inflate(&zstream, Z_NO_FLUSH); 963. } while (result==Z_OK && pkt_size<10000000); ^ 964. pkt_size = zstream.total_out; 965. inflateEnd(&zstream); libavformat/matroskadec.c:958:13: 956. zstream.avail_in = isize; 957. do { 958. pkt_size *= 3; ^ 959. pkt_data = av_realloc(pkt_data, pkt_size); 960. zstream.avail_out = pkt_size - zstream.total_out; libavformat/matroskadec.c:959:13: 957. do { 958. pkt_size *= 3; 959. pkt_data = av_realloc(pkt_data, pkt_size); ^ 960. zstream.avail_out = pkt_size - zstream.total_out; 961. zstream.next_out = pkt_data + zstream.total_out; libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking true branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:127:9: 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) 127. return NULL; ^ 128. 129. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr)
https://github.com/libav/libav/blob/90e8a9c34f641d0cb9137190c1912a3da3095e01/libavformat/matroskadec.c/#L959
d2a_code_trace_data_45388
static int decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; s->dsp.clear_blocks(h->mb); tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; if(h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); else predict_field_decoding_flag(h); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type == FF_B_TYPE){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } }else if(h->slice_type == FF_P_TYPE ){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(h->slice_type == FF_I_TYPE); decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)){ unsigned int x, y; align_get_bits(&s->gb); for(y=0; y<16; y++){ const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3); for(x=0; x<16; x++){ tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } s->current_picture.qscale_table[mb_xy]= 0; h->chroma_qp[0] = get_chroma_qp(h, 0, 0); h->chroma_qp[1] = get_chroma_qp(h, 1, 0); memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if(IS_INTRA(mb_type)){ int pred_mode; if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } write_back_intra_pred_mode(h); if( check_intra4x4_pred_mode(h) < 0) return -1; }else{ h->intra16x16_pred_mode= check_intra_pred_mode(h, h->intra16x16_pred_mode); if(h->intra16x16_pred_mode < 0) return -1; } pred_mode= check_intra_pred_mode(h, get_ue_golomb(&s->gb)); if(pred_mode < 0) return -1; h->chroma_pred_mode= pred_mode; }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if(h->slice_type == FF_B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0]) || IS_DIRECT(h->sub_mb_type[1]) || IS_DIRECT(h->sub_mb_type[2]) || IS_DIRECT(h->sub_mb_type[3])) { pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type == FF_P_TYPE || h->slice_type == FF_SP_TYPE); for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for(list=0; list<h->list_count; list++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ unsigned int tmp = get_te0_golomb(&s->gb, ref_count); if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } ref[list][i]= tmp; }else{ ref[list][i] = -1; } } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(h->sub_mb_type[i], 0, list)){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp[cbp]; } h->cbp = cbp; if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ if(get_bits1(&s->gb)) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i8x8, i4x4, chroma_idx; int dquant; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8, *dc_scan; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } dquant= get_se_golomb(&s->gb); if( dquant > 25 || dquant < -26 ){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } s->qscale += dquant; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if(IS_INTRA16x16(mb_type)){ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){ return -1; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } }else{ for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ DCTELEM *buf = &h->mb[64*i8x8]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 ) return -1; } nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 15) < 0){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; } libavcodec/h264.c:4747: error: Buffer Overrun L1 Offset: 9 Size: 2. libavcodec/h264.c:4612:5: <Length trace> 4610. } 4611. 4612. fill_caches(h, mb_type, 0); ^ 4613. 4614. //mb_pred libavcodec/h264.c:4612:5: Call 4610. } 4611. 4612. fill_caches(h, mb_type, 0); ^ 4613. 4614. //mb_pred libavcodec/h264.c:79:1: Parameter `h->mv_cache[*][*][*]` 77. 78. 79. static void fill_caches(H264Context *h, int mb_type, int for_deblock){ ^ 80. MpegEncContext * const s = &h->s; 81. const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; libavcodec/h264.c:4745:21: Assignment 4743. } 4744. }else{ 4745. uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; ^ 4746. p[0] = p[1]= 4747. p[8] = p[9]= 0; libavcodec/h264.c:4747:28: Array access: Offset: 9 Size: 2 4745. uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; 4746. p[0] = p[1]= 4747. p[8] = p[9]= 0; ^ 4748. } 4749. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L4747
d2a_code_trace_data_45389
int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) { ASN1_TIME t; struct tm tm; int rv = 0; t.length = strlen(str); t.data = (unsigned char *)str; t.flags = ASN1_STRING_FLAG_X509_TIME; t.type = V_ASN1_UTCTIME; if (!ASN1_TIME_check(&t)) { t.type = V_ASN1_GENERALIZEDTIME; if (!ASN1_TIME_check(&t)) goto out; } if (s != NULL && t.type == V_ASN1_GENERALIZEDTIME) { if (!asn1_time_to_tm(&tm, &t)) goto out; if (is_utc(tm.tm_year)) { t.length -= 2; t.data = OPENSSL_zalloc(t.length + 1); if (t.data == NULL) goto out; memcpy(t.data, str + 2, t.length); t.type = V_ASN1_UTCTIME; } } if (s == NULL || ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t)) rv = 1; if (t.data != (unsigned char *)str) OPENSSL_free(t.data); out: return rv; } apps/x509.c:1064: error: BUFFER_OVERRUN_L3 Offset added: [-2, +oo] Size: [1, +oo] by call to `set_cert_times`. Showing all 26 steps of the trace apps/x509.c:1062:10: Call 1060. { 1061. 1062. if (!X509_set_issuer_name(x, X509_get_subject_name(x))) ^ 1063. goto err; 1064. if (!preserve_dates && !set_cert_times(x, NULL, NULL, days)) crypto/x509/x509_set.c:54:12: Call 52. if (x == NULL) 53. return 0; 54. return X509_NAME_set(&x->cert_info.issuer, name); ^ 55. } 56. crypto/x509/x_name.c:491:22: Call 489. if (*xn == name) 490. return *xn != NULL; 491. if ((name_copy = X509_NAME_dup(name)) == NULL) ^ 492. return 0; 493. X509_NAME_free(*xn); crypto/x509/x_name.c:88:1: Call 86. IMPLEMENT_ASN1_FUNCTIONS(X509_NAME) 87. 88. > IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME) 89. 90. static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) crypto/asn1/a_dup.c:59:9: Call 57. return NULL; 58. 59. i = ASN1_item_i2d(x, &b, it); ^ 60. if (b == NULL) { 61. ASN1err(ASN1_F_ASN1_ITEM_DUP, ERR_R_MALLOC_FAILURE); crypto/asn1/tasn_enc.c:45:12: Call 43. int ASN1_item_i2d(const ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it) 44. { 45. return asn1_item_flags_i2d(val, out, it, 0); ^ 46. } 47. crypto/asn1/tasn_enc.c:55:1: Parameter `(*out)->strlen` 53. */ 54. 55. > static int asn1_item_flags_i2d(const ASN1_VALUE *val, unsigned char **out, 56. const ASN1_ITEM *it, int flags) 57. { apps/x509.c:1064:29: Call 1062. if (!X509_set_issuer_name(x, X509_get_subject_name(x))) 1063. goto err; 1064. if (!preserve_dates && !set_cert_times(x, NULL, NULL, days)) ^ 1065. goto err; 1066. if (fkey == NULL && !X509_set_pubkey(x, pkey)) apps/apps.c:2507:1: Parameter `startdate->strlen` 2505. } 2506. 2507. > int set_cert_times(X509 *x, const char *startdate, const char *enddate, 2508. int days) 2509. { apps/apps.c:2514:14: Call 2512. return 0; 2513. } else { 2514. if (!ASN1_TIME_set_string_X509(X509_getm_notBefore(x), startdate)) ^ 2515. return 0; 2516. } crypto/asn1/a_time.c:374:1: <Offset trace> 372. } 373. 374. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 375. { 376. ASN1_TIME t; crypto/asn1/a_time.c:374:1: Parameter `str->strlen` 372. } 373. 374. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 375. { 376. ASN1_TIME t; crypto/asn1/a_time.c:380:5: Assignment 378. int rv = 0; 379. 380. t.length = strlen(str); ^ 381. t.data = (unsigned char *)str; 382. t.flags = ASN1_STRING_FLAG_X509_TIME; crypto/asn1/a_time.c:410:13: Assignment 408. goto out; 409. if (is_utc(tm.tm_year)) { 410. t.length -= 2; ^ 411. /* 412. * it's OK to let original t.data go since that's assigned crypto/asn1/a_time.c:374:1: <Length trace> 372. } 373. 374. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 375. { 376. ASN1_TIME t; crypto/asn1/a_time.c:374:1: Parameter `str->strlen` 372. } 373. 374. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 375. { 376. ASN1_TIME t; crypto/asn1/a_time.c:380:5: Assignment 378. int rv = 0; 379. 380. t.length = strlen(str); ^ 381. t.data = (unsigned char *)str; 382. t.flags = ASN1_STRING_FLAG_X509_TIME; crypto/asn1/a_time.c:410:13: Assignment 408. goto out; 409. if (is_utc(tm.tm_year)) { 410. t.length -= 2; ^ 411. /* 412. * it's OK to let original t.data go since that's assigned crypto/asn1/a_time.c:416:22: Call 414. * new t.data would be freed after ASN1_STRING_copy is done. 415. */ 416. t.data = OPENSSL_zalloc(t.length + 1); ^ 417. if (t.data == NULL) 418. goto out; 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/asn1/a_time.c:416:13: Assignment 414. * new t.data would be freed after ASN1_STRING_copy is done. 415. */ 416. t.data = OPENSSL_zalloc(t.length + 1); ^ 417. if (t.data == NULL) 418. goto out; crypto/asn1/a_time.c:419:13: Array access: Offset added: [-2, +oo] Size: [1, +oo] by call to `set_cert_times` 417. if (t.data == NULL) 418. goto out; 419. memcpy(t.data, str + 2, t.length); ^ 420. t.type = V_ASN1_UTCTIME; 421. }
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/asn1/a_time.c/#L419
d2a_code_trace_data_45390
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale, float bias) { const float *prCoeff; int i, j, k; float praXin[33], *raXin = &praXin[1]; float *subband_fir_hist = s->subband_fir_hist[chans]; float *subband_fir_hist2 = s->subband_fir_noidea[chans]; int chindex = 0, subindex; praXin[0] = 0.0; if (!s->multirate_inter) prCoeff = fir_32bands_nonperfect; else prCoeff = fir_32bands_perfect; for (subindex = 0; subindex < 8; subindex++) { float t1, t2, sum[16], diff[16]; for (i = 0; i < s->subband_activity[chans]; i++) raXin[i] = samples_in[i][subindex]; for (; i < 32; i++) raXin[i] = 0.0; for (j = 0, k = 0; k < 16; k++) { t1 = 0.0; t2 = 0.0; for (i = 0; i < 16; i++, j++){ t1 += (raXin[2 * i] + raXin[2 * i + 1]) * cos_mod[j]; t2 += (raXin[2 * i] + raXin[2 * i - 1]) * cos_mod[j + 256]; } sum[k] = t1 + t2; diff[k] = t1 - t2; } j = 512; for (k = 0; k < 16; k++) subband_fir_hist[k] = cos_mod[j++] * sum[k]; for (k = 0; k < 16; k++) subband_fir_hist[32-k-1] = cos_mod[j++] * diff[k]; for (k = 31, i = 0; i < 32; i++, k--) for (j = 0; j < 512; j += 64){ subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]); subband_fir_hist2[i+32] += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]); } for (i = 0; i < 32; i++) samples_out[chindex++] = subband_fir_hist2[i] * scale + bias; memmove(&subband_fir_hist[32], &subband_fir_hist[0], (512 - 32) * sizeof(float)); memmove(&subband_fir_hist2[0], &subband_fir_hist2[32], 32 * sizeof(float)); memset(&subband_fir_hist2[32], 0, 32 * sizeof(float)); } } libavcodec/dca.c:700: error: Uninitialized Value The value read from sum[_] was never initialized. libavcodec/dca.c:700:13: 698. /* Store history */ 699. for (k = 0; k < 16; k++) 700. subband_fir_hist[k] = cos_mod[j++] * sum[k]; ^ 701. for (k = 0; k < 16; k++) 702. subband_fir_hist[32-k-1] = cos_mod[j++] * diff[k];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dca.c/#L700
d2a_code_trace_data_45391
static void contract(OPENSSL_LHASH *lh) { OPENSSL_LH_NODE **n, *n1, *np; np = lh->b[lh->p + lh->pmax - 1]; lh->b[lh->p + lh->pmax - 1] = NULL; if (lh->p == 0) { n = OPENSSL_realloc(lh->b, (unsigned int)(sizeof(OPENSSL_LH_NODE *) * lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes /= 2; lh->pmax /= 2; lh->p = lh->pmax - 1; lh->b = n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1 = lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p] = np; else { while (n1->next != NULL) n1 = n1->next; n1->next = np; } } crypto/property/defn_cache.c:30: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete`. Showing all 10 steps of the trace crypto/property/defn_cache.c:30:1: Parameter `lh->pmax` 28. } PROPERTY_DEFN_ELEM; 29. 30. > DEFINE_LHASH_OF(PROPERTY_DEFN_ELEM); 31. 32. static unsigned long property_defn_hash(const PROPERTY_DEFN_ELEM *a) crypto/property/defn_cache.c:30:1: Call 28. } PROPERTY_DEFN_ELEM; 29. 30. > DEFINE_LHASH_OF(PROPERTY_DEFN_ELEM); 31. 32. static unsigned long property_defn_hash(const PROPERTY_DEFN_ELEM *a) crypto/lhash/lhash.c:137:1: Parameter `lh->pmax` 135. } 136. 137. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 138. { 139. unsigned long hash; crypto/lhash/lhash.c:160:9: Call 158. if ((lh->num_nodes > MIN_NODES) && 159. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) 160. contract(lh); ^ 161. 162. return ret; crypto/lhash/lhash.c:269:1: <Offset trace> 267. } 268. 269. > static void contract(OPENSSL_LHASH *lh) 270. { 271. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:269:1: Parameter `lh->p` 267. } 268. 269. > static void contract(OPENSSL_LHASH *lh) 270. { 271. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:289:9: Assignment 287. lh->b = n; 288. } else 289. lh->p--; ^ 290. 291. lh->num_nodes--; crypto/lhash/lhash.c:269:1: <Length trace> 267. } 268. 269. > static void contract(OPENSSL_LHASH *lh) 270. { 271. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:269:1: Parameter `*lh->b` 267. } 268. 269. > static void contract(OPENSSL_LHASH *lh) 270. { 271. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:294:10: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete` 292. lh->num_contracts++; 293. 294. n1 = lh->b[(int)lh->p]; ^ 295. if (n1 == NULL) 296. lh->b[(int)lh->p] = np;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/lhash/lhash.c/#L294
d2a_code_trace_data_45392
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", _asn1_mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } apps/s_server.c:2746: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `X509_print`. Showing all 40 steps of the trace apps/s_server.c:2741:13: Call 2739. SSL_SESSION_print(io, SSL_get_session(con)); 2740. BIO_printf(io, "---\n"); 2741. print_stats(io, SSL_get_SSL_CTX(con)); ^ 2742. BIO_printf(io, "---\n"); 2743. peer = SSL_get_peer_certificate(con); apps/s_server.c:1950:16: Call 1948. { 1949. BIO_printf(bio, "%4ld items in the session cache\n", 1950. SSL_CTX_sess_number(ssl_ctx)); ^ 1951. BIO_printf(bio, "%4ld client connects (SSL_connect())\n", 1952. SSL_CTX_sess_connect(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1952:16: Call 1950. SSL_CTX_sess_number(ssl_ctx)); 1951. BIO_printf(bio, "%4ld client connects (SSL_connect())\n", 1952. SSL_CTX_sess_connect(ssl_ctx)); ^ 1953. BIO_printf(bio, "%4ld client renegotiates (SSL_connect())\n", 1954. SSL_CTX_sess_connect_renegotiate(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1954:16: Call 1952. SSL_CTX_sess_connect(ssl_ctx)); 1953. BIO_printf(bio, "%4ld client renegotiates (SSL_connect())\n", 1954. SSL_CTX_sess_connect_renegotiate(ssl_ctx)); ^ 1955. BIO_printf(bio, "%4ld client connects that finished\n", 1956. SSL_CTX_sess_connect_good(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1956:16: Call 1954. SSL_CTX_sess_connect_renegotiate(ssl_ctx)); 1955. BIO_printf(bio, "%4ld client connects that finished\n", 1956. SSL_CTX_sess_connect_good(ssl_ctx)); ^ 1957. BIO_printf(bio, "%4ld server accepts (SSL_accept())\n", 1958. SSL_CTX_sess_accept(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1958:16: Call 1956. SSL_CTX_sess_connect_good(ssl_ctx)); 1957. BIO_printf(bio, "%4ld server accepts (SSL_accept())\n", 1958. SSL_CTX_sess_accept(ssl_ctx)); ^ 1959. BIO_printf(bio, "%4ld server renegotiates (SSL_accept())\n", 1960. SSL_CTX_sess_accept_renegotiate(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1960:16: Call 1958. SSL_CTX_sess_accept(ssl_ctx)); 1959. BIO_printf(bio, "%4ld server renegotiates (SSL_accept())\n", 1960. SSL_CTX_sess_accept_renegotiate(ssl_ctx)); ^ 1961. BIO_printf(bio, "%4ld server accepts that finished\n", 1962. SSL_CTX_sess_accept_good(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1962:16: Call 1960. SSL_CTX_sess_accept_renegotiate(ssl_ctx)); 1961. BIO_printf(bio, "%4ld server accepts that finished\n", 1962. SSL_CTX_sess_accept_good(ssl_ctx)); ^ 1963. BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx)); 1964. BIO_printf(bio, "%4ld session cache misses\n", ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1963:50: Call 1961. BIO_printf(bio, "%4ld server accepts that finished\n", 1962. SSL_CTX_sess_accept_good(ssl_ctx)); 1963. BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx)); ^ 1964. BIO_printf(bio, "%4ld session cache misses\n", 1965. SSL_CTX_sess_misses(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1965:16: Call 1963. BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx)); 1964. BIO_printf(bio, "%4ld session cache misses\n", 1965. SSL_CTX_sess_misses(ssl_ctx)); ^ 1966. BIO_printf(bio, "%4ld session cache timeouts\n", 1967. SSL_CTX_sess_timeouts(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1967:16: Call 1965. SSL_CTX_sess_misses(ssl_ctx)); 1966. BIO_printf(bio, "%4ld session cache timeouts\n", 1967. SSL_CTX_sess_timeouts(ssl_ctx)); ^ 1968. BIO_printf(bio, "%4ld callback cache hits\n", 1969. SSL_CTX_sess_cb_hits(ssl_ctx)); ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1969:16: Call 1967. SSL_CTX_sess_timeouts(ssl_ctx)); 1968. BIO_printf(bio, "%4ld callback cache hits\n", 1969. SSL_CTX_sess_cb_hits(ssl_ctx)); ^ 1970. BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n", 1971. SSL_CTX_sess_cache_full(ssl_ctx), ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1971:16: Call 1969. SSL_CTX_sess_cb_hits(ssl_ctx)); 1970. BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n", 1971. SSL_CTX_sess_cache_full(ssl_ctx), ^ 1972. SSL_CTX_sess_get_cache_size(ssl_ctx)); 1973. } ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:1972:16: Call 1970. BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n", 1971. SSL_CTX_sess_cache_full(ssl_ctx), 1972. SSL_CTX_sess_get_cache_size(ssl_ctx)); ^ 1973. } 1974. ssl/ssl_lib.c:1116:1: Parameter `*parg` 1114. } 1115. 1116. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 1117. { 1118. long l; apps/s_server.c:2746:17: Call 2744. if (peer != NULL) { 2745. BIO_printf(io, "Client certificate\n"); 2746. X509_print(io, peer); ^ 2747. PEM_write_bio_X509(io, peer); 2748. } else crypto/x509/t_x509.c:92:1: Parameter `*x->cert_info.validity.notAfter->data` 90. #endif 91. 92. > int X509_print(BIO *bp, X509 *x) 93. { 94. return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); crypto/x509/t_x509.c:94:12: Call 92. int X509_print(BIO *bp, X509 *x) 93. { 94. return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); ^ 95. } 96. crypto/x509/t_x509.c:97:1: Parameter `*x->cert_info.validity.notAfter->data` 95. } 96. 97. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, 98. unsigned long cflag) 99. { crypto/x509/t_x509.c:187:14: Call 185. if (BIO_write(bp, "\n Not After : ", 25) <= 0) 186. goto err; 187. if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) ^ 188. goto err; 189. if (BIO_write(bp, "\n", 1) <= 0) crypto/asn1/a_time.c:202:1: Parameter `*tm->data` 200. } 201. 202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 203. { 204. if (tm->type == V_ASN1_UTCTIME) crypto/asn1/a_time.c:207:16: Call 205. return ASN1_UTCTIME_print(bp, tm); 206. if (tm->type == V_ASN1_GENERALIZEDTIME) 207. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 208. BIO_write(bp, "Bad time value", 14); 209. return (0); crypto/asn1/a_gentm.c:266:1: <Offset trace> 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data` 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:287:5: Assignment 285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 286. + (v[2] - '0') * 10 + (v[3] - '0'); 287. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 288. if ((M > 12) || (M < 1)) 289. goto err; crypto/asn1/a_gentm.c:261:1: <Length trace> 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:261:1: Array declaration 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print` 306. 307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 309. (gmt) ? " GMT" : "") <= 0) 310. return (0);
https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308
d2a_code_trace_data_45393
int dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num, 0); memcpy(frag->fragment, s->init_buf->data, s->init_num); if ( is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_CCS_HEADER_LENGTH == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = s->d1->w_epoch; memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)>>8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if ( item == NULL) { dtls1_hm_fragment_free(frag); return 0; } #if 0 fprintf( stderr, "buffered messge: \ttype = %xx\n", msg_buf->type); fprintf( stderr, "\t\t\t\t\tlen = %d\n", msg_buf->len); fprintf( stderr, "\t\t\t\t\tseq_num = %d\n", msg_buf->seq_num); #endif pqueue_insert(s->d1->sent_messages, item); return 1; } ssl/d1_both.c:1040: error: NULL_DEREFERENCE pointer `frag` last assigned on line 1038 could be null and is dereferenced at line 1040, column 9. Showing all 22 steps of the trace ssl/d1_both.c:1027:1: start of procedure dtls1_buffer_message() 1025. } 1026. 1027. > int 1028. dtls1_buffer_message(SSL *s, int is_ccs) 1029. { ssl/d1_both.c:1036:2: Condition is true 1034. /* this function is called immediately after a message has 1035. * been serialized */ 1036. OPENSSL_assert(s->init_off == 0); ^ 1037. 1038. frag = dtls1_hm_fragment_new(s->init_num, 0); ssl/d1_both.c:1038:2: 1036. OPENSSL_assert(s->init_off == 0); 1037. 1038. > frag = dtls1_hm_fragment_new(s->init_num, 0); 1039. 1040. memcpy(frag->fragment, s->init_buf->data, s->init_num); ssl/d1_both.c:172:1: start of procedure dtls1_hm_fragment_new() 170. long max, int *ok); 171. 172. > static hm_fragment * 173. dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) 174. { ssl/d1_both.c:175:2: 173. dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) 174. { 175. > hm_fragment *frag = NULL; 176. unsigned char *buf = NULL; 177. unsigned char *bitmask = NULL; ssl/d1_both.c:176:2: 174. { 175. hm_fragment *frag = NULL; 176. > unsigned char *buf = NULL; 177. unsigned char *bitmask = NULL; 178. ssl/d1_both.c:177:2: 175. hm_fragment *frag = NULL; 176. unsigned char *buf = NULL; 177. > unsigned char *bitmask = NULL; 178. 179. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); ssl/d1_both.c:179:2: 177. unsigned char *bitmask = NULL; 178. 179. > frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); 180. if ( frag == NULL) 181. return NULL; crypto/mem.c:295:1: start of procedure CRYPTO_malloc() 293. } 294. 295. > void *CRYPTO_malloc(int num, const char *file, int line) 296. { 297. void *ret = NULL; crypto/mem.c:297:2: 295. void *CRYPTO_malloc(int num, const char *file, int line) 296. { 297. > void *ret = NULL; 298. 299. if (num <= 0) return NULL; crypto/mem.c:299:6: Taking false branch 297. void *ret = NULL; 298. 299. if (num <= 0) return NULL; ^ 300. 301. allow_customize = 0; crypto/mem.c:301:2: 299. if (num <= 0) return NULL; 300. 301. > allow_customize = 0; 302. if (malloc_debug_func != NULL) 303. { crypto/mem.c:302:6: Taking false branch 300. 301. allow_customize = 0; 302. if (malloc_debug_func != NULL) ^ 303. { 304. allow_customize_debug = 0; crypto/mem.c:307:2: Skipping __function_pointer__(): unresolved function pointer 305. malloc_debug_func(NULL, num, file, line, 0); 306. } 307. ret = malloc_ex_func(num,file,line); ^ 308. #ifdef LEVITTE_DEBUG_MEM 309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:311:6: Taking false branch 309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 310. #endif 311. if (malloc_debug_func != NULL) ^ 312. malloc_debug_func(ret, num, file, line, 1); 313. crypto/mem.c:318:12: Taking false branch 316. * sanitisation function can't be optimised out. NB: We only do 317. * this for >2Kb so the overhead doesn't bother us. */ 318. if(ret && (num > 2048)) ^ 319. { extern unsigned char cleanse_ctr; 320. ((unsigned char *)ret)[0] = cleanse_ctr; crypto/mem.c:324:2: 322. #endif 323. 324. > return ret; 325. } 326. char *CRYPTO_strdup(const char *str, const char *file, int line) crypto/mem.c:325:2: return from a call to CRYPTO_malloc 323. 324. return ret; 325. } ^ 326. char *CRYPTO_strdup(const char *str, const char *file, int line) 327. { ssl/d1_both.c:180:7: Taking true branch 178. 179. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); 180. if ( frag == NULL) ^ 181. return NULL; 182. ssl/d1_both.c:181:3: 179. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); 180. if ( frag == NULL) 181. > return NULL; 182. 183. if (frag_len) ssl/d1_both.c:212:2: return from a call to dtls1_hm_fragment_new 210. 211. return frag; 212. } ^ 213. 214. static void ssl/d1_both.c:1040:2: 1038. frag = dtls1_hm_fragment_new(s->init_num, 0); 1039. 1040. > memcpy(frag->fragment, s->init_buf->data, s->init_num); 1041. 1042. if ( is_ccs)
https://github.com/openssl/openssl/blob/4221c0dd3004117c63b182af5e8ab345b7265902/ssl/d1_both.c/#L1040
d2a_code_trace_data_45394
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } crypto/bn/bn_prime.c:103: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`. Showing all 47 steps of the trace crypto/bn/bn_prime.c:90:18: Call 88. } else { 89. if (safe) { 90. if (!probable_prime_dh_safe(ret, bits, add, rem, ctx)) ^ 91. goto err; 92. } else { crypto/bn/bn_prime.c:404:1: Parameter `p->top` 402. } 403. 404. > static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd, 405. const BIGNUM *rem, BN_CTX *ctx) 406. { crypto/bn/bn_prime.c:103:13: Call 101. 102. if (!safe) { 103. i = BN_is_prime_fasttest_ex(ret, checks, ctx, 0, cb); ^ 104. if (i == -1) 105. goto err; crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:596:1: Parameter `m->top` 594. * http://www.daemonology.net/hyperthreading-considered-harmful/) 595. */ 596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 597. const BIGNUM *m, BN_CTX *ctx, 598. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:617:10: Call 615. bn_check_top(m); 616. 617. if (!BN_is_odd(m)) { ^ 618. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS); 619. return 0; crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:755:14: Call 753. /* prepare a^1 in Montgomery domain */ 754. if (a->neg || BN_ucmp(a, m) >= 0) { 755. if (!BN_nnmod(&am, a, m, ctx)) ^ 756. goto err; 757. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_45395
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER) *tls13_ciphersuites, STACK_OF(SSL_CIPHER) **cipher_list, STACK_OF(SSL_CIPHER) **cipher_list_by_id, const char *rule_str, CERT *c) { int ok, num_of_ciphers, num_of_alias_max, num_of_group_aliases, i; uint32_t disabled_mkey, disabled_auth, disabled_enc, disabled_mac; STACK_OF(SSL_CIPHER) *cipherstack; const char *rule_p; CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr; const SSL_CIPHER **ca_list = NULL; if (rule_str == NULL || cipher_list == NULL || cipher_list_by_id == NULL) return NULL; #ifndef OPENSSL_NO_EC if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) return NULL; #endif disabled_mkey = disabled_mkey_mask; disabled_auth = disabled_auth_mask; disabled_enc = disabled_enc_mask; disabled_mac = disabled_mac_mask; num_of_ciphers = ssl_method->num_ciphers(); co_list = OPENSSL_malloc(sizeof(*co_list) * num_of_ciphers); if (co_list == NULL) { SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); return NULL; } ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers, disabled_mkey, disabled_auth, disabled_enc, disabled_mac, co_list, &head, &tail); ssl_cipher_apply_rule(0, SSL_kECDHE, SSL_aECDSA, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail); ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail); ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, SSL_AESGCM, 0, 0, 0, CIPHER_ADD, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, SSL_CHACHA20, 0, 0, 0, CIPHER_ADD, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, SSL_AES ^ SSL_AESGCM, 0, 0, 0, CIPHER_ADD, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, 0, SSL_MD5, 0, 0, CIPHER_ORD, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, SSL_aNULL, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail); ssl_cipher_apply_rule(0, SSL_kRSA, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail); ssl_cipher_apply_rule(0, SSL_kPSK, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, SSL_RC4, 0, 0, 0, CIPHER_ORD, -1, &head, &tail); if (!ssl_cipher_strength_sort(&head, &tail)) { OPENSSL_free(co_list); return NULL; } ssl_cipher_apply_rule(0, 0, 0, 0, 0, TLS1_2_VERSION, 0, CIPHER_BUMP, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, 0, SSL_AEAD, 0, 0, CIPHER_BUMP, -1, &head, &tail); ssl_cipher_apply_rule(0, SSL_kDHE | SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_BUMP, -1, &head, &tail); ssl_cipher_apply_rule(0, SSL_kDHE | SSL_kECDHE, 0, 0, SSL_AEAD, 0, 0, CIPHER_BUMP, -1, &head, &tail); ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail); num_of_group_aliases = OSSL_NELEM(cipher_aliases); num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; ca_list = OPENSSL_malloc(sizeof(*ca_list) * num_of_alias_max); if (ca_list == NULL) { OPENSSL_free(co_list); SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); return NULL; } ssl_cipher_collect_aliases(ca_list, num_of_group_aliases, disabled_mkey, disabled_auth, disabled_enc, disabled_mac, head); ok = 1; rule_p = rule_str; if (strncmp(rule_str, "DEFAULT", 7) == 0) { ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, &head, &tail, ca_list, c); rule_p += 7; if (*rule_p == ':') rule_p++; } if (ok && (strlen(rule_p) > 0)) ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); OPENSSL_free(ca_list); if (!ok) { OPENSSL_free(co_list); return NULL; } if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { OPENSSL_free(co_list); return NULL; } for (i = 0; i < sk_SSL_CIPHER_num(tls13_ciphersuites); i++) { if (!sk_SSL_CIPHER_push(cipherstack, sk_SSL_CIPHER_value(tls13_ciphersuites, i))) { sk_SSL_CIPHER_free(cipherstack); return NULL; } } for (curr = head; curr != NULL; curr = curr->next) { if (curr->active) { if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher)) { OPENSSL_free(co_list); sk_SSL_CIPHER_free(cipherstack); return NULL; } #ifdef CIPHER_DEBUG fprintf(stderr, "<%s>\n", curr->cipher->name); #endif } } OPENSSL_free(co_list); if (!update_cipher_list_by_id(cipher_list_by_id, cipherstack)) { sk_SSL_CIPHER_free(cipherstack); return NULL; } sk_SSL_CIPHER_free(*cipher_list); *cipher_list = cipherstack; return cipherstack; } test/dtls_mtu_test.c:162: error: BUFFER_OVERRUN_L1 Offset: 7 Size: 4 by call to `SSL_CTX_set_cipher_list`. Showing all 10 steps of the trace test/dtls_mtu_test.c:162:10: Call 160. * only do (non-DH) PSK. 161. */ 162. if (!TEST_true(SSL_CTX_set_cipher_list(ctx, "PSK"))) ^ 163. goto end; 164. ssl/ssl_lib.c:2511:1: Parameter `*str` 2509. 2510. /** specify the ciphers to be used by default by the SSL_CTX */ 2511. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2512. { 2513. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2515:10: Call 2513. STACK_OF(SSL_CIPHER) *sk; 2514. 2515. sk = ssl_create_cipher_list(ctx->method, ctx->tls13_ciphersuites, ^ 2516. &ctx->cipher_list, &ctx->cipher_list_by_id, str, 2517. ctx->cert); ssl/ssl_ciph.c:1403:1: <Length trace> 1401. } 1402. 1403. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, 1404. STACK_OF(SSL_CIPHER) *tls13_ciphersuites, 1405. STACK_OF(SSL_CIPHER) **cipher_list, ssl/ssl_ciph.c:1403:1: Parameter `*rule_str` 1401. } 1402. 1403. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, 1404. STACK_OF(SSL_CIPHER) *tls13_ciphersuites, 1405. STACK_OF(SSL_CIPHER) **cipher_list, ssl/ssl_ciph.c:1423:10: Call 1421. return NULL; 1422. #ifndef OPENSSL_NO_EC 1423. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1424. return NULL; 1425. #endif ssl/ssl_ciph.c:1223:1: Parameter `**prule_str` 1221. 1222. #ifndef OPENSSL_NO_EC 1223. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1224. const char **prule_str) 1225. { ssl/ssl_ciph.c:1572:5: Assignment 1570. */ 1571. ok = 1; 1572. rule_p = rule_str; ^ 1573. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1574. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1576:9: Assignment 1574. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, 1575. &head, &tail, ca_list, c); 1576. rule_p += 7; ^ 1577. if (*rule_p == ':') 1578. rule_p++; ssl/ssl_ciph.c:1577:13: Array access: Offset: 7 Size: 4 by call to `SSL_CTX_set_cipher_list` 1575. &head, &tail, ca_list, c); 1576. rule_p += 7; 1577. if (*rule_p == ':') ^ 1578. rule_p++; 1579. }
https://github.com/openssl/openssl/blob/4845aeba4c49e1bd65259a5014d7e3ab38657d42/ssl/ssl_ciph.c/#L1577
d2a_code_trace_data_45396
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); if (ref->extended_data != ref->data) av_freep(&ref->extended_data); av_free(ref->video); av_free(ref->audio); av_free(ref); } libavfilter/af_asyncts.c:220: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `ff_filter_samples`. libavfilter/af_asyncts.c:214:9: Assignment 212. 213. avresample_read(s->avr, buf_out->extended_data, out_size); 214. buf_out->pts = s->pts; ^ 215. 216. if (delta > 0) { libavfilter/af_asyncts.c:220:15: Call 218. delta, nb_channels, buf->format); 219. } 220. ret = ff_filter_samples(outlink, buf_out); ^ 221. if (ret < 0) 222. goto fail; libavfilter/audio.c:156:1: Parameter `samplesref->buf->refcount` 154. } 155. 156. int ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) ^ 157. { 158. int (*filter_samples)(AVFilterLink *, AVFilterBufferRef *); libavfilter/audio.c:177:13: Call 175. samplesref->audio->nb_samples); 176. if (!buf_out) { 177. avfilter_unref_buffer(samplesref); ^ 178. return AVERROR(ENOMEM); 179. } libavfilter/buffer.c:75:1: <LHS trace> 73. } 74. 75. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 76. { 77. if (!ref) libavfilter/buffer.c:75:1: Parameter `ref->buf->refcount` 73. } 74. 75. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 76. { 77. if (!ref) libavfilter/buffer.c:79:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_filter_samples` 77. if (!ref) 78. return; 79. if (!(--ref->buf->refcount)) ^ 80. ref->buf->free(ref->buf); 81. if (ref->extended_data != ref->data)
https://github.com/libav/libav/blob/642b4efaf7b3055ab4b26bda252149eb35babc4b/libavfilter/buffer.c/#L79
d2a_code_trace_data_45397
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:1414: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 2]):unsigned64 by call to `ssl_add_serverhello_renegotiate_ext`. Showing all 12 steps of the trace ssl/t1_lib.c:1407:10: Call 1405. #endif 1406. 1407. if (!WPACKET_start_sub_packet_u16(pkt) ^ 1408. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) { 1409. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); 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:1414:14: Call 1412. 1413. if (s->s3->send_connection_binding && 1414. !ssl_add_serverhello_renegotiate_ext(s, pkt)) { ^ 1415. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); 1416. return 0; ssl/t1_reneg.c:53:1: Parameter `pkt->written` 51. 52. /* Add the server's renegotiation binding */ 53. > int ssl_add_serverhello_renegotiate_ext(SSL *s, WPACKET *pkt) 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) ssl/t1_reneg.c:55:10: Call 53. int ssl_add_serverhello_renegotiate_ext(SSL *s, WPACKET *pkt) 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) ^ 56. || !WPACKET_start_sub_packet_u16(pkt) 57. || !WPACKET_start_sub_packet_u8(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] - [pkt->written, pkt->written + 2]):unsigned64 by call to `ssl_add_serverhello_renegotiate_ext` 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_45398
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/bn/bn_rand.c:135: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `bnrand`. Showing all 22 steps of the trace crypto/bn/bn_rand.c:113:1: Parameter `r->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/bn/bn_rand.c:135:18: Call 133. */ 134. do { 135. if (!bnrand(flag, r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) ^ 136. return 0; 137. crypto/bn/bn_rand.c:21:1: Parameter `rnd->top` 19. } BNRAND_FLAG; 20. 21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom) 22. { 23. unsigned char *buf = NULL; crypto/bn/bn_rand.c:29:9: Call 27. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 28. goto toosmall; 29. BN_zero(rnd); ^ 30. return 1; 31. } crypto/bn/bn_lib.c:357:1: Parameter `a->top` 355. } 356. 357. > int BN_set_word(BIGNUM *a, BN_ULONG w) 358. { 359. bn_check_top(a); crypto/bn/bn_lib.c:360:9: Call 358. { 359. bn_check_top(a); 360. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 361. return 0; 362. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `a->top` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `words` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:225:13: Call 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:225:9: Assignment 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `bnrand` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/49cd47eaababc8c57871b929080fc1357e2ad7b8/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_45399
static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) { unsigned char *buf = NULL; int b, ret = 0, bit, bytes, mask; OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes) : rand_priv_bytes_ex(libctx, buf, bytes); if (b <= 0) goto err; if (flag == TESTING) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (rand_bytes_ex(libctx, &c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return ret; toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } crypto/bn/bn_gf2m.c:735: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_priv_rand`. Showing all 14 steps of the trace crypto/bn/bn_gf2m.c:735:30: Call 733. /* generate blinding value */ 734. do { 735. if (!BN_priv_rand(b, BN_num_bits(p) - 1, ^ 736. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) 737. goto err; crypto/bn/bn_lib.c:141:9: Assignment 139. 140. if (BN_is_zero(a)) 141. return 0; ^ 142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 143. } crypto/bn/bn_gf2m.c:735:14: Call 733. /* generate blinding value */ 734. do { 735. if (!BN_priv_rand(b, BN_num_bits(p) - 1, ^ 736. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) 737. goto err; crypto/bn/bn_rand.c:121:1: Parameter `bits` 119. } 120. 121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:62:14: <Offset trace> 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:62:14: Assignment 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:23:1: <Length trace> 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:23:1: Parameter `bits` 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:39:5: Assignment 37. goto toosmall; 38. 39. bytes = (bits + 7) / 8; ^ 40. bit = (bits - 1) % 8; 41. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:43:11: Call 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/bn/bn_rand.c:43:5: Assignment 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_priv_rand` 86. buf[0] &= ~mask; 87. if (bottom) /* set bottom bit if requested */ 88. buf[bytes - 1] |= 1; ^ 89. if (!BN_bin2bn(buf, bytes, rnd)) 90. goto err;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_rand.c/#L88
d2a_code_trace_data_45400
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; } } } test/danetest.c:394: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 20 steps of the trace test/danetest.c:390:20: Call 388. } 389. 390. if ((ssl = SSL_new(ctx)) == NULL) ^ 391. return -1; 392. SSL_set_connect_state(ssl); ssl/ssl_lib.c:614:1: Parameter `ctx->sessions->num_nodes` 612. } 613. 614. > SSL *SSL_new(SSL_CTX *ctx) 615. { 616. SSL *s; test/danetest.c:425:9: Call 423. /* Not needed any more, but lead by example and put the error back. */ 424. SSL_set_verify_result(ssl, err); 425. SSL_free(ssl); ^ 426. 427. if (ok < 0) { ssl/ssl_lib.c:990:1: Parameter `s->initial_ctx->sessions->num_nodes` 988. } 989. 990. > void SSL_free(SSL *s) 991. { 992. int i; test/danetest.c:390:20: Call 388. } 389. 390. if ((ssl = SSL_new(ctx)) == NULL) ^ 391. return -1; 392. SSL_set_connect_state(ssl); ssl/ssl_lib.c:614:1: Parameter `ctx->sessions->num_nodes` 612. } 613. 614. > SSL *SSL_new(SSL_CTX *ctx) 615. { 616. SSL *s; test/danetest.c:394:13: Call 392. SSL_set_connect_state(ssl); 393. if (SSL_dane_enable(ssl, basename) <= 0) { 394. SSL_free(ssl); ^ 395. return -1; 396. } ssl/ssl_lib.c:990:1: Parameter `s->initial_ctx->sessions->num_nodes` 988. } 989. 990. > void SSL_free(SSL *s) 991. { 992. int i; ssl/ssl_lib.c:1044:5: Call 1042. 1043. OPENSSL_free(s->tlsext_hostname); 1044. SSL_CTX_free(s->initial_ctx); ^ 1045. #ifndef OPENSSL_NO_EC 1046. OPENSSL_free(s->tlsext_ecpointformatlist); ssl/ssl_lib.c:2392:1: Parameter `a->sessions->num_nodes` 2390. } 2391. 2392. > void SSL_CTX_free(SSL_CTX *a) 2393. { 2394. int i; ssl/ssl_lib.c:2425:9: Call 2423. */ 2424. if (a->sessions != NULL) 2425. SSL_CTX_flush_sessions(a, 0); ^ 2426. 2427. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1056:1: Parameter `s->sessions->num_nodes` 1054. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1055. 1056. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1057. { 1058. unsigned long i; ssl/ssl_sess.c:1069:5: Call 1067. i = CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; 1068. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = 0; 1069. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1070. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load = i; 1071. CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); ssl/ssl_sess.c:1054:1: Parameter `lh->num_nodes` 1052. } 1053. 1054. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1055. 1056. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1054:1: Call 1052. } 1053. 1054. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1055. 1056. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:273:1: Parameter `lh->num_nodes` 271. } 272. 273. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 274. { 275. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); crypto/lhash/lhash.c:275:5: Call 273. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 274. { 275. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); ^ 276. } 277. crypto/lhash/lhash.c:235:1: <LHS trace> 233. } 234. 235. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 236. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 237. { crypto/lhash/lhash.c:235:1: Parameter `lh->num_nodes` 233. } 234. 235. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 236. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 237. { crypto/lhash/lhash.c:248:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 246. * memory leaks otherwise 247. */ 248. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 249. a = lh->b[i]; 250. while (a != NULL) {
https://github.com/openssl/openssl/blob/0fd2d5fa3c58e0a11f059becd1fcf063c05ea292/crypto/lhash/lhash.c/#L248
d2a_code_trace_data_45401
static void mxf_write_partition(AVFormatContext *s, int bodysid, int indexsid, const uint8_t *key, int write_metadata) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int64_t header_byte_count_offset; unsigned index_byte_count = 0; uint64_t partition_offset = avio_tell(pb); if (!mxf->edit_unit_byte_count && mxf->edit_units_count) index_byte_count = 85 + 12+(s->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4); else if (mxf->edit_unit_byte_count && indexsid) index_byte_count = 80; if (index_byte_count) { index_byte_count += 16 + klv_ber_length(index_byte_count); index_byte_count += klv_fill_size(index_byte_count); } if (!memcmp(key, body_partition_key, 16)) { mxf->body_partition_offset = av_realloc(mxf->body_partition_offset, (mxf->body_partitions_count+1)* sizeof(*mxf->body_partition_offset)); mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset; } avio_write(pb, key, 16); klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count); avio_wb16(pb, 1); avio_wb16(pb, 2); avio_wb32(pb, KAG_SIZE); avio_wb64(pb, partition_offset); if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); else avio_wb64(pb, 0); avio_wb64(pb, mxf->footer_partition_offset); header_byte_count_offset = avio_tell(pb); avio_wb64(pb, 0); avio_wb64(pb, index_byte_count); avio_wb32(pb, index_byte_count ? indexsid : 0); if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) { avio_wb64(pb, mxf->body_offset); } else avio_wb64(pb, 0); avio_wb32(pb, bodysid); avio_write(pb, op1a_ul, 16); mxf_write_essence_container_refs(s); if (write_metadata) { int64_t pos, start; unsigned header_byte_count; mxf_write_klv_fill(s); start = avio_tell(s->pb); mxf_write_primer_pack(s); mxf_write_header_metadata_sets(s); pos = avio_tell(s->pb); header_byte_count = pos - start + klv_fill_size(pos); avio_seek(pb, header_byte_count_offset, SEEK_SET); avio_wb64(pb, header_byte_count); avio_seek(pb, pos, SEEK_SET); } avio_flush(pb); } libavformat/mxfenc.c:1214: error: Null Dereference pointer `mxf->body_partition_offset` last assigned on line 1210 could be null and is dereferenced at line 1214, column 9. libavformat/mxfenc.c:1187:1: start of procedure mxf_write_partition() 1185. } 1186. 1187. static void mxf_write_partition(AVFormatContext *s, int bodysid, ^ 1188. int indexsid, 1189. const uint8_t *key, int write_metadata) libavformat/mxfenc.c:1191:5: 1189. const uint8_t *key, int write_metadata) 1190. { 1191. MXFContext *mxf = s->priv_data; ^ 1192. AVIOContext *pb = s->pb; 1193. int64_t header_byte_count_offset; libavformat/mxfenc.c:1192:5: 1190. { 1191. MXFContext *mxf = s->priv_data; 1192. AVIOContext *pb = s->pb; ^ 1193. int64_t header_byte_count_offset; 1194. unsigned index_byte_count = 0; libavformat/mxfenc.c:1194:5: 1192. AVIOContext *pb = s->pb; 1193. int64_t header_byte_count_offset; 1194. unsigned index_byte_count = 0; ^ 1195. uint64_t partition_offset = avio_tell(pb); 1196. libavformat/mxfenc.c:1195:5: 1193. int64_t header_byte_count_offset; 1194. unsigned index_byte_count = 0; 1195. uint64_t partition_offset = avio_tell(pb); ^ 1196. 1197. if (!mxf->edit_unit_byte_count && mxf->edit_units_count) libavformat/avio.h:219:1: start of procedure avio_tell() 217. * @return position or AVERROR. 218. */ 219. static av_always_inline int64_t avio_tell(AVIOContext *s) ^ 220. { 221. return avio_seek(s, 0, SEEK_CUR); libavformat/avio.h:221:5: Skipping avio_seek(): empty list of specs 219. static av_always_inline int64_t avio_tell(AVIOContext *s) 220. { 221. return avio_seek(s, 0, SEEK_CUR); ^ 222. } 223. libavformat/avio.h:222:1: return from a call to avio_tell 220. { 221. return avio_seek(s, 0, SEEK_CUR); 222. } ^ 223. 224. /** libavformat/mxfenc.c:1197:10: Taking true branch 1195. uint64_t partition_offset = avio_tell(pb); 1196. 1197. if (!mxf->edit_unit_byte_count && mxf->edit_units_count) ^ 1198. index_byte_count = 85 + 12+(s->nb_streams+1)*6 + 1199. 12+mxf->edit_units_count*(11+mxf->slice_count*4); libavformat/mxfenc.c:1197:39: Taking true branch 1195. uint64_t partition_offset = avio_tell(pb); 1196. 1197. if (!mxf->edit_unit_byte_count && mxf->edit_units_count) ^ 1198. index_byte_count = 85 + 12+(s->nb_streams+1)*6 + 1199. 12+mxf->edit_units_count*(11+mxf->slice_count*4); libavformat/mxfenc.c:1198:9: 1196. 1197. if (!mxf->edit_unit_byte_count && mxf->edit_units_count) 1198. index_byte_count = 85 + 12+(s->nb_streams+1)*6 + ^ 1199. 12+mxf->edit_units_count*(11+mxf->slice_count*4); 1200. else if (mxf->edit_unit_byte_count && indexsid) libavformat/mxfenc.c:1203:9: Taking true branch 1201. index_byte_count = 80; 1202. 1203. if (index_byte_count) { ^ 1204. // add encoded ber length 1205. index_byte_count += 16 + klv_ber_length(index_byte_count); libavformat/mxfenc.c:1205:9: 1203. if (index_byte_count) { 1204. // add encoded ber length 1205. index_byte_count += 16 + klv_ber_length(index_byte_count); ^ 1206. index_byte_count += klv_fill_size(index_byte_count); 1207. } libavformat/mxfenc.c:332:1: start of procedure klv_ber_length() 330. } 331. 332. static int klv_ber_length(uint64_t len) ^ 333. { 334. if (len < 128) libavformat/mxfenc.c:334:9: Taking true branch 332. static int klv_ber_length(uint64_t len) 333. { 334. if (len < 128) ^ 335. return 1; 336. else libavformat/mxfenc.c:335:9: 333. { 334. if (len < 128) 335. return 1; ^ 336. else 337. return (av_log2(len) >> 3) + 2; libavformat/mxfenc.c:338:1: return from a call to klv_ber_length 336. else 337. return (av_log2(len) >> 3) + 2; 338. } ^ 339. 340. static int klv_encode_ber_length(AVIOContext *pb, uint64_t len) libavformat/mxfenc.c:1206:9: 1204. // add encoded ber length 1205. index_byte_count += 16 + klv_ber_length(index_byte_count); 1206. index_byte_count += klv_fill_size(index_byte_count); ^ 1207. } 1208. libavformat/mxfenc.c:1032:1: start of procedure klv_fill_size() 1030. } 1031. 1032. static unsigned klv_fill_size(uint64_t size) ^ 1033. { 1034. unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1)); libavformat/mxfenc.c:1034:5: 1032. static unsigned klv_fill_size(uint64_t size) 1033. { 1034. unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1)); ^ 1035. if (pad < 20) // smallest fill item possible 1036. return pad + KAG_SIZE; libavformat/mxfenc.c:1035:9: Taking true branch 1033. { 1034. unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1)); 1035. if (pad < 20) // smallest fill item possible ^ 1036. return pad + KAG_SIZE; 1037. else libavformat/mxfenc.c:1036:9: 1034. unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1)); 1035. if (pad < 20) // smallest fill item possible 1036. return pad + KAG_SIZE; ^ 1037. else 1038. return pad & (KAG_SIZE-1); libavformat/mxfenc.c:1039:1: return from a call to klv_fill_size 1037. else 1038. return pad & (KAG_SIZE-1); 1039. } ^ 1040. 1041. static void mxf_write_index_table_segment(AVFormatContext *s) libavformat/mxfenc.c:1209:10: Taking true branch 1207. } 1208. 1209. if (!memcmp(key, body_partition_key, 16)) { ^ 1210. mxf->body_partition_offset = 1211. av_realloc(mxf->body_partition_offset, libavformat/mxfenc.c:1210:9: 1208. 1209. if (!memcmp(key, body_partition_key, 16)) { 1210. mxf->body_partition_offset = ^ 1211. av_realloc(mxf->body_partition_offset, 1212. (mxf->body_partitions_count+1)* libavutil/mem.c:116:1: start of procedure av_realloc() 114. } 115. 116. void *av_realloc(void *ptr, size_t size) ^ 117. { 118. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:123:9: Taking true branch 121. 122. /* let's disallow possible ambiguous cases */ 123. if (size > (INT_MAX - 16)) ^ 124. return NULL; 125. libavutil/mem.c:124:9: 122. /* let's disallow possible ambiguous cases */ 123. if (size > (INT_MAX - 16)) 124. return NULL; ^ 125. 126. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr) libavformat/mxfenc.c:1214:9: 1212. (mxf->body_partitions_count+1)* 1213. sizeof(*mxf->body_partition_offset)); 1214. mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset; ^ 1215. } 1216.
https://github.com/libav/libav/blob/0c15a9aa7e1654a19144eb594f9639a57fd47482/libavformat/mxfenc.c/#L1214
d2a_code_trace_data_45402
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; } crypto/ec/ec2_smpl.c:699: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_priv_rand`. Showing all 11 steps of the trace crypto/ec/ec2_smpl.c:688:1: Parameter `s->Z->d` 686. * s:= p, r := 2p 687. */ 688. > static 689. int ec_GF2m_simple_ladder_pre(const EC_GROUP *group, 690. EC_POINT *r, EC_POINT *s, crypto/ec/ec2_smpl.c:699:14: Call 697. /* s blinding: make sure lambda (s->Z here) is not zero */ 698. do { 699. if (!BN_priv_rand(s->Z, BN_num_bits(group->field) - 1, ^ 700. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) { 701. ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_PRE, ERR_R_BN_LIB); crypto/bn/bn_rand.c:121:1: Parameter `*rnd->d` 119. } 120. 121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:33:9: Call 31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 32. goto toosmall; 33. BN_zero(rnd); ^ 34. return 1; 35. } crypto/bn/bn_lib.c:361:1: <Length trace> 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:361:1: Parameter `*a->d` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lib.c:367:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_priv_rand` 365. return 0; 366. a->neg = 0; 367. a->d[0] = w; ^ 368. a->top = (w ? 1 : 0); 369. a->flags &= ~BN_FLG_FIXED_TOP;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L367
d2a_code_trace_data_45403
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/ssl_sess.c:596: error: INTEGER_OVERFLOW_L2 ([0, 1+max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`. Showing all 13 steps of the trace ssl/ssl_sess.c:447:1: Parameter `s->initial_ctx->sessions->num_items` 445. * if the server should issue a new session ticket (to 0 otherwise). 446. */ 447. > int ssl_get_prev_session(SSL *s, CLIENTHELLO_MSG *hello) 448. { 449. /* This is used only by servers. */ ssl/ssl_sess.c:596:13: Call 594. if (!(s->s3->flags & TLS1_FLAGS_RECEIVED_EXTMS)) { 595. SSLerr(SSL_F_SSL_GET_PREV_SESSION, SSL_R_INCONSISTENT_EXTMS); 596. ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); ^ 597. fatal = 1; 598. goto err; ssl/s3_msg.c:63:1: Parameter `s->initial_ctx->sessions->num_items` 61. } 62. 63. > int ssl3_send_alert(SSL *s, int level, int desc) 64. { 65. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:74:9: Call 72. /* If a fatal one, remove from cache */ 73. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 74. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 75. 76. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 699. { 700. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:700:12: Call 698. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 699. { 700. return remove_session_lock(ctx, c, 1); ^ 701. } 702. ssl/ssl_sess.c:703:1: Parameter `ctx->sessions->num_items` 701. } 702. 703. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 704. { 705. SSL_SESSION *r; ssl/ssl_sess.c:713:17: Call 711. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 712. ret = 1; 713. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 714. SSL_SESSION_list_remove(ctx, c); 715. } ssl/ssl_locl.h:598:1: Parameter `lh->num_items` 596. }; 597. 598. > DEFINE_LHASH_OF(SSL_SESSION); 599. /* Needed in ssl_cert.c */ 600. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:598:1: Call 596. }; 597. 598. > DEFINE_LHASH_OF(SSL_SESSION); 599. /* Needed in ssl_cert.c */ 600. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, 1+max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_45404
ngx_int_t ngx_atoi(u_char *line, size_t n) { ngx_int_t value, cutoff, cutlim; if (n == 0) { return NGX_ERROR; } cutoff = NGX_MAX_INT_T_VALUE / 10; cutlim = NGX_MAX_INT_T_VALUE % 10; for (value = 0; n--; line++) { if (*line < '0' || *line > '9') { return NGX_ERROR; } if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) { return NGX_ERROR; } value = value * 10 + (*line - '0'); } return value; } src/core/ngx_resolver.c:2432: error: Integer Overflow L2 ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_atoi`. src/core/ngx_resolver.c:2415:9: Call 2413. #endif 2414. 2415. if (ngx_resolver_copy(r, &name, buf, ^ 2416. buf + sizeof(ngx_resolver_hdr_t), buf + n) 2417. != NGX_OK) src/core/ngx_resolver.c:3132:1: Parameter `*src` 3130. 3131. 3132. static ngx_int_t ^ 3133. ngx_resolver_copy(ngx_resolver_t *r, ngx_str_t *name, u_char *buf, u_char *src, 3134. u_char *last) src/core/ngx_resolver.c:2432:17: Call 2430. len = buf[i++]; 2431. 2432. octet = ngx_atoi(&buf[i], len); ^ 2433. if (octet == NGX_ERROR || octet > 255) { 2434. goto invalid_in_addr_arpa; src/core/ngx_string.c:910:5: <LHS trace> 908. } 909. 910. cutoff = NGX_MAX_INT_T_VALUE / 10; ^ 911. cutlim = NGX_MAX_INT_T_VALUE % 10; 912. src/core/ngx_string.c:910:5: Assignment 908. } 909. 910. cutoff = NGX_MAX_INT_T_VALUE / 10; ^ 911. cutlim = NGX_MAX_INT_T_VALUE % 10; 912. src/core/ngx_string.c:901:1: <RHS trace> 899. 900. 901. ngx_int_t ^ 902. ngx_atoi(u_char *line, size_t n) 903. { src/core/ngx_string.c:901:1: Parameter `*line` 899. 900. 901. ngx_int_t ^ 902. ngx_atoi(u_char *line, size_t n) 903. { src/core/ngx_string.c:922:9: Binary operation: ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_atoi` 920. } 921. 922. value = value * 10 + (*line - '0'); ^ 923. } 924.
https://github.com/nginx/nginx/blob/cb173ff6722635188546ce7dd8f2a737050d82d5/src/core/ngx_string.c/#L922
d2a_code_trace_data_45405
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/srp/srp_vfy.c:569: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 25 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:492:9: Assignment 490. n = len; 491. if (n == 0) { 492. ret->top = 0; ^ 493. return (ret); 494. } crypto/srp/srp_vfy.c:569:10: Call 567. } 568. 569. if (!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) ^ 570. goto err; 571. crypto/srp/srp_vfy.c:610:1: Parameter `g->top` 608. * BIGNUMS. 609. */ 610. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 611. BIGNUM **verifier, const BIGNUM *N, 612. const BIGNUM *g) crypto/srp/srp_vfy.c:641:10: Call 639. goto err; 640. 641. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 642. BN_clear_free(*verifier); 643. goto err; crypto/bn/bn_exp.c:90:1: Parameter `a->top` 88. } 89. 90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 91. BN_CTX *ctx) 92. { crypto/bn/bn_exp.c:150:19: Call 148. } else 149. # endif 150. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 151. } else 152. #endif crypto/bn/bn_exp.c:300:1: Parameter `a->top` 298. } 299. 300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 302. { crypto/bn/bn_exp.c:312:16: Call 310. 311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 313. } 314. crypto/bn/bn_exp.c:600:1: Parameter `a->top` 598. * http://www.daemonology.net/hyperthreading-considered-harmful/) 599. */ 600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 601. const BIGNUM *m, BN_CTX *ctx, 602. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:757:17: Call 755. if (!BN_to_montgomery(&am, &am, mont, ctx)) 756. goto err; 757. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 758. goto err; 759. crypto/bn/bn_lib.c:945:1: Parameter `a->top` 943. } 944. 945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 946. BN_CTX *ctx) 947. { crypto/bn/bn_lib.c:948:12: Call 946. BN_CTX *ctx) 947. { 948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 949. } 950. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:110:5: Assignment 108. BN_ULONG *rp; 109. 110. max = n * 2; ^ 111. ap = a; 112. rp = r; crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:113:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 111. ap = a; 112. rp = r; 113. rp[0] = rp[max - 1] = 0; ^ 114. rp++; 115. j = n;
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_sqr.c/#L113
d2a_code_trace_data_45406
void ff_clean_intra_table_entries(MpegEncContext *s) { int wrap = s->b8_stride; int xy = s->block_index[0]; s->dc_val[0][xy ] = s->dc_val[0][xy + 1 ] = s->dc_val[0][xy + wrap] = s->dc_val[0][xy + 1 + wrap] = 1024; memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t)); memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t)); if (s->msmpeg4_version>=3) { s->coded_block[xy ] = s->coded_block[xy + 1 ] = s->coded_block[xy + wrap] = s->coded_block[xy + 1 + wrap] = 0; } wrap = s->mb_stride; xy = s->mb_x + s->mb_y * wrap; s->dc_val[1][xy] = s->dc_val[2][xy] = 1024; memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t)); memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t)); s->mbintra_table[xy]= 0; } libavcodec/mpegvideo.c:1708: error: Buffer Overrun L1 Offset added: 64 Size: 32. libavcodec/mpegvideo.c:1698:1: <Length trace> 1696. * cleans dc, ac, coded_block for the current non intra MB 1697. */ 1698. void ff_clean_intra_table_entries(MpegEncContext *s) ^ 1699. { 1700. int wrap = s->b8_stride; libavcodec/mpegvideo.c:1698:1: Parameter `(*s->ac_val[*])[*]` 1696. * cleans dc, ac, coded_block for the current non intra MB 1697. */ 1698. void ff_clean_intra_table_entries(MpegEncContext *s) ^ 1699. { 1700. int wrap = s->b8_stride; libavcodec/mpegvideo.c:1708:5: Array access: Offset added: 64 Size: 32 1706. s->dc_val[0][xy + 1 + wrap] = 1024; 1707. /* ac pred */ 1708. memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t)); ^ 1709. memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t)); 1710. if (s->msmpeg4_version>=3) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo.c/#L1708
d2a_code_trace_data_45407
static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, const unsigned char *sess_id, int sesslen, SSL_SESSION **psess) { SSL_SESSION *sess; unsigned char *sdec; const unsigned char *p; int slen, mlen, renew_ticket = 0; unsigned char tick_hmac[EVP_MAX_MD_SIZE]; HMAC_CTX *hctx = NULL; EVP_CIPHER_CTX ctx; SSL_CTX *tctx = s->initial_ctx; if (eticklen < 48) return 2; hctx = HMAC_CTX_new(); if (hctx == NULL) return -2; EVP_CIPHER_CTX_init(&ctx); if (tctx->tlsext_ticket_key_cb) { unsigned char *nctick = (unsigned char *)etick; int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, &ctx, hctx, 0); if (rv < 0) return -1; if (rv == 0) return 2; if (rv == 2) renew_ticket = 1; } else { if (memcmp(etick, tctx->tlsext_tick_key_name, 16)) return 2; if (HMAC_Init_ex(hctx, tctx->tlsext_tick_hmac_key, 16, EVP_sha256(), NULL) <= 0 || EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, tctx->tlsext_tick_aes_key, etick + 16) <= 0) { goto err; } } mlen = HMAC_size(hctx); if (mlen < 0) { goto err; } eticklen -= mlen; if (HMAC_Update(hctx, etick, eticklen) <= 0 || HMAC_Final(hctx, tick_hmac, NULL) <= 0) { goto err; } HMAC_CTX_free(hctx); if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) { EVP_CIPHER_CTX_cleanup(&ctx); return 2; } p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); sdec = OPENSSL_malloc(eticklen); if (sdec == NULL || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { EVP_CIPHER_CTX_cleanup(&ctx); return -1; } if (EVP_DecryptFinal(&ctx, sdec + slen, &mlen) <= 0) { EVP_CIPHER_CTX_cleanup(&ctx); OPENSSL_free(sdec); return 2; } slen += mlen; EVP_CIPHER_CTX_cleanup(&ctx); p = sdec; sess = d2i_SSL_SESSION(NULL, &p, slen); OPENSSL_free(sdec); if (sess) { if (sesslen) memcpy(sess->session_id, sess_id, sesslen); sess->session_id_length = sesslen; *psess = sess; if (renew_ticket) return 4; else return 3; } ERR_clear_error(); return 2; err: EVP_CIPHER_CTX_cleanup(&ctx); HMAC_CTX_free(hctx); return -1; } ssl/t1_lib.c:3078: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `HMAC_CTX_new()` at line 3069, column 12 is not reachable after line 3078, column 13. Showing all 37 steps of the trace ssl/t1_lib.c:3053:1: start of procedure tls_decrypt_ticket() 3051. * 4: same as 3, but the ticket needs to be renewed. 3052. */ 3053. > static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, 3054. int eticklen, const unsigned char *sess_id, 3055. int sesslen, SSL_SESSION **psess) ssl/t1_lib.c:3060:5: 3058. unsigned char *sdec; 3059. const unsigned char *p; 3060. > int slen, mlen, renew_ticket = 0; 3061. unsigned char tick_hmac[EVP_MAX_MD_SIZE]; 3062. HMAC_CTX *hctx = NULL; ssl/t1_lib.c:3062:5: 3060. int slen, mlen, renew_ticket = 0; 3061. unsigned char tick_hmac[EVP_MAX_MD_SIZE]; 3062. > HMAC_CTX *hctx = NULL; 3063. EVP_CIPHER_CTX ctx; 3064. SSL_CTX *tctx = s->initial_ctx; ssl/t1_lib.c:3064:5: 3062. HMAC_CTX *hctx = NULL; 3063. EVP_CIPHER_CTX ctx; 3064. > SSL_CTX *tctx = s->initial_ctx; 3065. /* Need at least keyname + iv + some encrypted data */ 3066. if (eticklen < 48) ssl/t1_lib.c:3066:9: Taking false branch 3064. SSL_CTX *tctx = s->initial_ctx; 3065. /* Need at least keyname + iv + some encrypted data */ 3066. if (eticklen < 48) ^ 3067. return 2; 3068. /* Initialize session ticket encryption and HMAC contexts */ ssl/t1_lib.c:3069:5: 3067. return 2; 3068. /* Initialize session ticket encryption and HMAC contexts */ 3069. > hctx = HMAC_CTX_new(); 3070. if (hctx == NULL) 3071. return -2; crypto/hmac/hmac.c:173:1: start of procedure HMAC_CTX_new() 171. } 172. 173. > HMAC_CTX *HMAC_CTX_new(void) 174. { 175. HMAC_CTX *ctx = (HMAC_CTX *)OPENSSL_zalloc(sizeof(HMAC_CTX)); crypto/hmac/hmac.c:175:5: 173. HMAC_CTX *HMAC_CTX_new(void) 174. { 175. > HMAC_CTX *ctx = (HMAC_CTX *)OPENSSL_zalloc(sizeof(HMAC_CTX)); 176. if (ctx) 177. if (!HMAC_CTX_reset(ctx)) { 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/hmac/hmac.c:176:9: Taking true branch 174. { 175. HMAC_CTX *ctx = (HMAC_CTX *)OPENSSL_zalloc(sizeof(HMAC_CTX)); 176. if (ctx) ^ 177. if (!HMAC_CTX_reset(ctx)) { 178. HMAC_CTX_free(ctx); crypto/hmac/hmac.c:177:14: Taking false branch 175. HMAC_CTX *ctx = (HMAC_CTX *)OPENSSL_zalloc(sizeof(HMAC_CTX)); 176. if (ctx) 177. if (!HMAC_CTX_reset(ctx)) { ^ 178. HMAC_CTX_free(ctx); 179. ctx = NULL; crypto/hmac/hmac.c:181:5: 179. ctx = NULL; 180. } 181. > return ctx; 182. } 183. crypto/hmac/hmac.c:182:1: return from a call to HMAC_CTX_new 180. } 181. return ctx; 182. > } 183. 184. static void hmac_ctx_cleanup(HMAC_CTX *ctx) ssl/t1_lib.c:3070:9: Taking false branch 3068. /* Initialize session ticket encryption and HMAC contexts */ 3069. hctx = HMAC_CTX_new(); 3070. if (hctx == NULL) ^ 3071. return -2; 3072. EVP_CIPHER_CTX_init(&ctx); ssl/t1_lib.c:3072:5: 3070. if (hctx == NULL) 3071. return -2; 3072. > EVP_CIPHER_CTX_init(&ctx); 3073. if (tctx->tlsext_ticket_key_cb) { 3074. unsigned char *nctick = (unsigned char *)etick; crypto/evp/evp_enc.c:69:1: start of procedure EVP_CIPHER_CTX_init() 67. #include "evp_locl.h" 68. 69. > void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) 70. { 71. memset(ctx, 0, sizeof(*ctx)); crypto/evp/evp_enc.c:71:5: 69. void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) 70. { 71. > memset(ctx, 0, sizeof(*ctx)); 72. } 73. crypto/evp/evp_enc.c:72:1: return from a call to EVP_CIPHER_CTX_init 70. { 71. memset(ctx, 0, sizeof(*ctx)); 72. > } 73. 74. EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) ssl/t1_lib.c:3073:9: Taking true branch 3071. return -2; 3072. EVP_CIPHER_CTX_init(&ctx); 3073. if (tctx->tlsext_ticket_key_cb) { ^ 3074. unsigned char *nctick = (unsigned char *)etick; 3075. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, ssl/t1_lib.c:3074:9: 3072. EVP_CIPHER_CTX_init(&ctx); 3073. if (tctx->tlsext_ticket_key_cb) { 3074. > unsigned char *nctick = (unsigned char *)etick; 3075. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, 3076. &ctx, hctx, 0); ssl/t1_lib.c:3075:9: Skipping __function_pointer__(): unresolved function pointer 3073. if (tctx->tlsext_ticket_key_cb) { 3074. unsigned char *nctick = (unsigned char *)etick; 3075. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, ^ 3076. &ctx, hctx, 0); 3077. if (rv < 0) ssl/t1_lib.c:3077:13: Taking true branch 3075. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, 3076. &ctx, hctx, 0); 3077. if (rv < 0) ^ 3078. return -1; 3079. if (rv == 0) ssl/t1_lib.c:3078:13: 3076. &ctx, hctx, 0); 3077. if (rv < 0) 3078. > return -1; 3079. if (rv == 0) 3080. return 2;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/t1_lib.c/#L3078
d2a_code_trace_data_45408
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t scan_start = 0; size_t i, j; size_t div_spoiler; size_t rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); div_spoiler = md_size >> 1; div_spoiler <<= (sizeof(div_spoiler) - 1) * 8; rotate_offset = (div_spoiler + mac_start - scan_start) % md_size; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { unsigned char mac_started = constant_time_ge_8_s(i, mac_start); unsigned char mac_ended = constant_time_ge_8_s(i, mac_end); unsigned char b = rec->data[i]; rotated_mac[j++] |= b & mac_started & ~mac_ended; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif } ssl/record/ssl3_record.c:1683: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 64]):unsigned64 by call to `dtls1_process_record`. Showing all 11 steps of the trace ssl/record/ssl3_record.c:1571:13: Unknown value from: non-const function 1569. 1570. if (s->msg_callback) 1571. s->msg_callback(0, 0, SSL3_RT_HEADER, p, DTLS1_RT_HEADER_LENGTH, ^ 1572. s, s->msg_callback_arg); 1573. ssl/record/ssl3_record.c:1586:9: Assignment 1584. p += 6; 1585. 1586. n2s(p, rr->length); ^ 1587. 1588. /* Lets check version */ ssl/record/ssl3_record.c:1683:10: Call 1681. } 1682. 1683. if (!dtls1_process_record(s, bitmap)) { ^ 1684. rr->length = 0; 1685. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */ ssl/record/ssl3_record.c:1308:1: Parameter `s->rlayer.rrec.length` 1306. } 1307. 1308. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1309. { 1310. int i, al; ssl/record/ssl3_record.c:1433:13: Call 1431. */ 1432. mac = mac_tmp; 1433. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 1434. rr->length -= mac_size; 1435. } else { ssl/record/ssl3_record.c:1231:1: <LHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `rec->length` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1244:5: Assignment 1242. * mac_end is the index of |rec->data| just after the end of the MAC. 1243. */ 1244. size_t mac_end = rec->length; ^ 1245. size_t mac_start = mac_end - md_size; 1246. /* ssl/record/ssl3_record.c:1231:1: <RHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `md_size` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1245:5: Binary operation: ([0, +oo] - [0, 64]):unsigned64 by call to `dtls1_process_record` 1243. */ 1244. size_t mac_end = rec->length; 1245. size_t mac_start = mac_end - md_size; ^ 1246. /* 1247. * scan_start contains the number of bytes that we can ignore because the
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1245
d2a_code_trace_data_45409
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, size_t *written) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; size_t currbuf = 0; size_t tmpwrit = 0; if ((s->rlayer.wpend_tot > len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return -1; } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); if (i >= 0) tmpwrit = i; } else { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; *written = s->rlayer.wpend_ret; return 1; } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return i; } SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); SSL3_BUFFER_sub_left(&wb[currbuf], tmpwrit); } } ssl/record/rec_layer_s3.c:613: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `do_ssl3_write`. Showing all 9 steps of the trace ssl/record/rec_layer_s3.c:337:1: Parameter `s->rlayer.numwpipes` 335. * not all data has been sent or non-blocking IO. 336. */ 337. > int ssl3_write_bytes(SSL *s, int type, const void *buf_, size_t len, 338. size_t *written) 339. { ssl/record/rec_layer_s3.c:613:13: Call 611. } 612. 613. i = do_ssl3_write(s, type, &(buf[tot]), pipelens, numpipes, 0, ^ 614. &tmpwrit); 615. if (i <= 0) { ssl/record/rec_layer_s3.c:644:1: Parameter `s->rlayer.numwpipes` 642. } 643. 644. > int do_ssl3_write(SSL *s, int type, const unsigned char *buf, 645. size_t *pipelens, size_t numpipes, 646. int create_empty_fragment, size_t *written) ssl/record/rec_layer_s3.c:668:9: Call 666. * will happen with non blocking IO 667. */ 668. if (RECORD_LAYER_write_pending(&s->rlayer)) { ^ 669. /* Calls SSLfatal() as required */ 670. return ssl3_write_pending(s, type, buf, totlen, written); ssl/record/rec_layer_s3.c:95:1: Parameter `rl->numwpipes` 93. } 94. 95. > int RECORD_LAYER_write_pending(const RECORD_LAYER *rl) 96. { 97. return (rl->numwpipes > 0) ssl/record/rec_layer_s3.c:670:16: Call 668. if (RECORD_LAYER_write_pending(&s->rlayer)) { 669. /* Calls SSLfatal() as required */ 670. return ssl3_write_pending(s, type, buf, totlen, written); ^ 671. } 672. ssl/record/rec_layer_s3.c:1108:1: <LHS trace> 1106. * Return values are as per SSL_write() 1107. */ 1108. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1109. size_t *written) 1110. { ssl/record/rec_layer_s3.c:1108:1: Parameter `s->rlayer.numwpipes` 1106. * Return values are as per SSL_write() 1107. */ 1108. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1109. size_t *written) 1110. { ssl/record/rec_layer_s3.c:1128:16: Binary operation: ([0, +oo] - 1):unsigned64 by call to `do_ssl3_write` 1126. /* Loop until we find a buffer we haven't written out yet */ 1127. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 1128. && currbuf < s->rlayer.numwpipes - 1) { ^ 1129. currbuf++; 1130. continue;
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/rec_layer_s3.c/#L1128
d2a_code_trace_data_45410
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/ecdsa_ossl.c:244: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `bn_mul_mont_fixed_top`. Showing all 21 steps of the trace crypto/ec/ecdsa_ossl.c:212:10: Call 210. if (8 * dgst_len > i) 211. dgst_len = (i + 7) / 8; 212. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 214. goto err; crypto/bn/bn_lib.c:372:1: Parameter `ret->top` 370. } 371. 372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 373. { 374. unsigned int i, m; crypto/ec/ecdsa_ossl.c:244:17: Call 242. */ 243. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx) 244. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) { ^ 245. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 246. goto err; crypto/bn/bn_mont.c:37:1: Parameter `r->top` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/bn/bn_mont.c:46:13: Call 44. #if defined(OPENSSL_BN_ASM_MONT) && defined(MONT_WORD) 45. if (num > 1 && a->top == num && b->top == num) { 46. if (bn_wexpand(r, num) == NULL) ^ 47. return 0; 48. if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) { crypto/bn/bn_lib.c:948:1: Parameter `a->top` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `bn_mul_mont_fixed_top` 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_45411
static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; uint32_t atom_size; int i; ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); ctts_entries[0].count = 1; ctts_entries[0].duration = track->cluster[0].cts; for (i=1; i<track->entry; i++) { if (track->cluster[i].cts == ctts_entries[entries].duration) { ctts_entries[entries].count++; } else { entries++; ctts_entries[entries].duration = track->cluster[i].cts; ctts_entries[entries].count = 1; } } entries++; atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); ffio_wfourcc(pb, "ctts"); avio_wb32(pb, 0); avio_wb32(pb, entries); for (i=0; i<entries; i++) { avio_wb32(pb, ctts_entries[i].count); avio_wb32(pb, ctts_entries[i].duration); } av_free(ctts_entries); return atom_size; } libavformat/movenc.c:909: error: Null Dereference pointer `ctts_entries` last assigned on line 908 could be null and is dereferenced at line 909, column 5. libavformat/movenc.c:901:1: start of procedure mov_write_ctts_tag() 899. } 900. 901. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ^ 902. { 903. MOVStts *ctts_entries; libavformat/movenc.c:904:5: 902. { 903. MOVStts *ctts_entries; 904. uint32_t entries = 0; ^ 905. uint32_t atom_size; 906. int i; libavformat/movenc.c:908:5: 906. int i; 907. 908. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ^ 909. ctts_entries[0].count = 1; 910. ctts_entries[0].duration = track->cluster[0].cts; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/movenc.c:909:5: 907. 908. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ 909. ctts_entries[0].count = 1; ^ 910. ctts_entries[0].duration = track->cluster[0].cts; 911. for (i=1; i<track->entry; i++) {
https://github.com/libav/libav/blob/304e983dc760176501b748ca99bcde23e7851013/libavformat/movenc.c/#L909
d2a_code_trace_data_45412
static int config_props_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; TransContext *trans = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format); const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format); trans->hsub = desc_in->log2_chroma_w; trans->vsub = desc_in->log2_chroma_h; av_image_fill_max_pixsteps(trans->pixsteps, NULL, desc_out); outlink->w = inlink->h; outlink->h = inlink->w; if (inlink->sample_aspect_ratio.num) outlink->sample_aspect_ratio = av_div_q((AVRational) { 1, 1 }, inlink->sample_aspect_ratio); else outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n", inlink->w, inlink->h, trans->dir, outlink->w, outlink->h, trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise", trans->dir == 0 || trans->dir == 3); return 0; } libavfilter/vf_transpose.c:94: error: Null Dereference pointer `desc_in` last assigned on line 92 could be null and is dereferenced at line 94, column 19. libavfilter/vf_transpose.c:86:1: start of procedure config_props_output() 84. } 85. 86. static int config_props_output(AVFilterLink *outlink) ^ 87. { 88. AVFilterContext *ctx = outlink->src; libavfilter/vf_transpose.c:88:5: 86. static int config_props_output(AVFilterLink *outlink) 87. { 88. AVFilterContext *ctx = outlink->src; ^ 89. TransContext *trans = ctx->priv; 90. AVFilterLink *inlink = ctx->inputs[0]; libavfilter/vf_transpose.c:89:5: 87. { 88. AVFilterContext *ctx = outlink->src; 89. TransContext *trans = ctx->priv; ^ 90. AVFilterLink *inlink = ctx->inputs[0]; 91. const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format); libavfilter/vf_transpose.c:90:5: 88. AVFilterContext *ctx = outlink->src; 89. TransContext *trans = ctx->priv; 90. AVFilterLink *inlink = ctx->inputs[0]; ^ 91. const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format); 92. const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format); libavfilter/vf_transpose.c:91:5: 89. TransContext *trans = ctx->priv; 90. AVFilterLink *inlink = ctx->inputs[0]; 91. const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format); ^ 92. const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format); 93. libavutil/pixdesc.c:1559:1: start of procedure av_pix_fmt_desc_get() 1557. } 1558. 1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1561:9: Taking false branch 1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1561:24: Taking false branch 1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1563:5: 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; ^ 1564. } 1565. libavutil/pixdesc.c:1564:1: return from a call to av_pix_fmt_desc_get 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; 1564. } ^ 1565. 1566. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavfilter/vf_transpose.c:92:5: 90. AVFilterLink *inlink = ctx->inputs[0]; 91. const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format); 92. const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format); ^ 93. 94. trans->hsub = desc_in->log2_chroma_w; libavutil/pixdesc.c:1559:1: start of procedure av_pix_fmt_desc_get() 1557. } 1558. 1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1561:9: Taking false branch 1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1561:24: Taking true branch 1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1562:9: 1560. { 1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1562. return NULL; ^ 1563. return &av_pix_fmt_descriptors[pix_fmt]; 1564. } libavutil/pixdesc.c:1564:1: return from a call to av_pix_fmt_desc_get 1562. return NULL; 1563. return &av_pix_fmt_descriptors[pix_fmt]; 1564. } ^ 1565. 1566. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavfilter/vf_transpose.c:94:5: 92. const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format); 93. 94. trans->hsub = desc_in->log2_chroma_w; ^ 95. trans->vsub = desc_in->log2_chroma_h; 96.
https://github.com/libav/libav/blob/dc0c70e018f6b04488333e7e26ec26359e614e4e/libavfilter/vf_transpose.c/#L94
d2a_code_trace_data_45413
static int mac_test_init(struct evp_test *t, const char *alg) { int type; struct mac_data *mdat; if (strcmp(alg, "HMAC") == 0) type = EVP_PKEY_HMAC; else if (strcmp(alg, "CMAC") == 0) type = EVP_PKEY_CMAC; else return 0; mdat = OPENSSL_malloc(sizeof(*mdat)); mdat->type = type; mdat->alg = NULL; mdat->key = NULL; mdat->input = NULL; mdat->output = NULL; t->data = mdat; return 1; } test/evp_test.c:1032: error: NULL_DEREFERENCE pointer `mdat` last assigned on line 1031 could be null and is dereferenced at line 1032, column 5. Showing all 14 steps of the trace test/evp_test.c:1020:1: start of procedure mac_test_init() 1018. }; 1019. 1020. > static int mac_test_init(struct evp_test *t, const char *alg) 1021. { 1022. int type; test/evp_test.c:1024:9: Taking true branch 1022. int type; 1023. struct mac_data *mdat; 1024. if (strcmp(alg, "HMAC") == 0) ^ 1025. type = EVP_PKEY_HMAC; 1026. else if (strcmp(alg, "CMAC") == 0) test/evp_test.c:1025:9: 1023. struct mac_data *mdat; 1024. if (strcmp(alg, "HMAC") == 0) 1025. > type = EVP_PKEY_HMAC; 1026. else if (strcmp(alg, "CMAC") == 0) 1027. type = EVP_PKEY_CMAC; test/evp_test.c:1031:5: 1029. return 0; 1030. 1031. > mdat = OPENSSL_malloc(sizeof(*mdat)); 1032. mdat->type = type; 1033. mdat->alg = 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) test/evp_test.c:1032:5: 1030. 1031. mdat = OPENSSL_malloc(sizeof(*mdat)); 1032. > mdat->type = type; 1033. mdat->alg = NULL; 1034. mdat->key = NULL;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/evp_test.c/#L1032
d2a_code_trace_data_45414
static enum CodecID find_codec_or_die(const char *name, int type, int encoder) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); ffmpeg_exit(1); } return codec->id; } ffmpeg.c:3151: error: Null Dereference pointer `codec` last assigned on line 3144 could be null and is dereferenced at line 3151, column 8. ffmpeg.c:3137:1: start of procedure find_codec_or_die() 3135. } 3136. 3137. static enum CodecID find_codec_or_die(const char *name, int type, int encoder) ^ 3138. { 3139. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:3139:32: Condition is true 3137. static enum CodecID find_codec_or_die(const char *name, int type, int encoder) 3138. { 3139. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3140. AVCodec *codec; 3141. ffmpeg.c:3139:5: 3137. static enum CodecID find_codec_or_die(const char *name, int type, int encoder) 3138. { 3139. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3140. AVCodec *codec; 3141. ffmpeg.c:3142:9: Taking false branch 3140. AVCodec *codec; 3141. 3142. if(!name) ^ 3143. return CODEC_ID_NONE; 3144. codec = encoder ? ffmpeg.c:3144:13: Condition is true 3142. if(!name) 3143. return CODEC_ID_NONE; 3144. codec = encoder ? ^ 3145. avcodec_find_encoder_by_name(name) : 3146. avcodec_find_decoder_by_name(name); ffmpeg.c:3144:5: 3142. if(!name) 3143. return CODEC_ID_NONE; 3144. codec = encoder ? ^ 3145. avcodec_find_encoder_by_name(name) : 3146. avcodec_find_decoder_by_name(name); ffmpeg.c:3147:9: Taking true branch 3145. avcodec_find_encoder_by_name(name) : 3146. avcodec_find_decoder_by_name(name); 3147. if(!codec) { ^ 3148. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3149. ffmpeg_exit(1); ffmpeg.c:3148:9: 3146. avcodec_find_decoder_by_name(name); 3147. if(!codec) { 3148. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 3149. ffmpeg_exit(1); 3150. } ffmpeg.c:3149:9: Skipping ffmpeg_exit(): empty list of specs 3147. if(!codec) { 3148. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3149. ffmpeg_exit(1); ^ 3150. } 3151. if(codec->type != type) { ffmpeg.c:3151:8: 3149. ffmpeg_exit(1); 3150. } 3151. if(codec->type != type) { ^ 3152. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 3153. ffmpeg_exit(1);
https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/ffmpeg.c/#L3151
d2a_code_trace_data_45415
static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; uint8_t *buf; if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) return -1; buf= av_realloc(st->codec->extradata, size); if(!buf) return -1; st->codec->extradata= buf; buf+= st->codec->extradata_size; st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; AV_WB32( buf , atom.size + 8); AV_WL32( buf + 4, atom.type); get_buffer(pb, buf + 8, atom.size); return 0; } libavformat/mov.c:565: error: Buffer Overrun L3 Offset: 3 Size: [0, 2147483631]. libavformat/mov.c:555:5: <Length trace> 553. { 554. AVStream *st = c->fc->streams[c->fc->nb_streams-1]; 555. uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; ^ 556. uint8_t *buf; 557. if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) libavformat/mov.c:555:5: Assignment 553. { 554. AVStream *st = c->fc->streams[c->fc->nb_streams-1]; 555. uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; ^ 556. uint8_t *buf; 557. if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) libavformat/mov.c:559:10: Call 557. if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) 558. return -1; 559. buf= av_realloc(st->codec->extradata, size); ^ 560. if(!buf) 561. return -1; libavutil/mem.c:102:9: Assignment 100. /* let's disallow possible ambiguous cases */ 101. if(size > (INT_MAX-16) ) 102. return NULL; ^ 103. 104. #ifdef CONFIG_MEMALIGN_HACK libavformat/mov.c:559:5: Assignment 557. if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) 558. return -1; 559. buf= av_realloc(st->codec->extradata, size); ^ 560. if(!buf) 561. return -1; libavformat/mov.c:563:5: Assignment 561. return -1; 562. st->codec->extradata= buf; 563. buf+= st->codec->extradata_size; ^ 564. st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; 565. AV_WB32( buf , atom.size + 8); libavformat/mov.c:565:5: Array access: Offset: 3 Size: [0, 2147483631] 563. buf+= st->codec->extradata_size; 564. st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; 565. AV_WB32( buf , atom.size + 8); ^ 566. AV_WL32( buf + 4, atom.type); 567. get_buffer(pb, buf + 8, atom.size);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mov.c/#L565
d2a_code_trace_data_45416
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } test/asynciotest.c:350: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/asynciotest.c:293:10: Call 291. 292. /* BIOs get freed on error */ 293. if (!TEST_true(create_ssl_objects(serverctx, clientctx, &serverssl, ^ 294. &clientssl, s_to_c_fbio, c_to_s_fbio)) 295. || !TEST_true(create_ssl_connection(serverssl, clientssl, test/ssltestlib.c:559:15: Call 557. if (*sssl != NULL) 558. serverssl = *sssl; 559. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 560. goto error; 561. if (*cssl != NULL) ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items` 520. } 521. 522. > SSL *SSL_new(SSL_CTX *ctx) 523. { 524. SSL *s; test/asynciotest.c:350:5: Call 348. 349. /* Also frees the BIOs */ 350. SSL_free(clientssl); ^ 351. SSL_free(serverssl); 352. clientssl = serverssl = NULL; ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items` 966. } 967. 968. > void SSL_free(SSL *s) 969. { 970. int i; ssl/ssl_lib.c:999:9: Call 997. /* Make the next call work :-) */ 998. if (s->session != NULL) { 999. ssl_clear_bad_session(s); ^ 1000. SSL_SESSION_free(s->session); 1001. } ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items` 1047. } 1048. 1049. > int ssl_clear_bad_session(SSL *s) 1050. { 1051. if ((s->session != NULL) && ssl/ssl_sess.c:1054:9: Call 1052. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1053. !(SSL_in_init(s) || SSL_in_before(s))) { 1054. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1055. return (1); 1056. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:721:1: Parameter `lh->num_items` 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:721:1: Call 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_45417
static int encode_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; int mb_x, mb_y, pdif = 0; int i, j; MpegEncContext best_s, backup_s; uint8_t bit_buf[2][MAX_MB_BYTES]; uint8_t bit_buf2[2][MAX_MB_BYTES]; uint8_t bit_buf_tex[2][MAX_MB_BYTES]; PutBitContext pb[2], pb2[2], tex_pb[2]; ff_check_alignment(); for(i=0; i<2; i++){ init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES); init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES); init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES); } s->last_bits= put_bits_count(&s->pb); s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->f_count=0; s->b_count=0; s->skip_count=0; for(i=0; i<3; i++){ s->last_dc[i] = 128 << s->intra_dc_precision; s->current_picture.error[i] = 0; } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); s->last_mv_dir = 0; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER) s->gob_index = ff_h263_get_gob_height(s); break; case CODEC_ID_MPEG4: if(ENABLE_MPEG4_ENCODER && s->partitioned_frame) ff_mpeg4_init_partitions(s); break; } s->resync_mb_x=0; s->resync_mb_y=0; s->first_slice_line = 1; s->ptr_lastgob = s->pb.buf; for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { s->mb_x=0; s->mb_y= mb_y; ff_set_qscale(s, s->qscale); ff_init_block_index(s); for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xy= mb_y*s->mb_stride + mb_x; int mb_type= s->mb_type[xy]; int dmin= INT_MAX; int dir; if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } if(s->data_partitioning){ if( s->pb2 .buf_end - s->pb2 .buf - (put_bits_count(&s-> pb2)>>3) < MAX_MB_BYTES || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } } s->mb_x = mb_x; s->mb_y = mb_y; ff_update_block_index(s); if(ENABLE_H261_ENCODER && s->codec_id == CODEC_ID_H261){ ff_h261_reorder_mb_index(s); xy= s->mb_y*s->mb_stride + s->mb_x; mb_type= s->mb_type[xy]; } if(s->rtp_mode){ int current_packet_size, is_gob_start; current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf); is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0; if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: if(!s->h263_slice_structured) if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0; break; case CODEC_ID_MPEG2VIDEO: if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1; case CODEC_ID_MPEG1VIDEO: if(s->mb_skip_run) is_gob_start=0; break; } if(is_gob_start){ if(s->start_mb_y != mb_y || mb_x!=0){ write_slice_end(s); if(ENABLE_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){ ff_mpeg4_init_partitions(s); } } assert((put_bits_count(&s->pb)&7) == 0); current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob; if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; int d= 100 / s->avctx->error_rate; if(r % d == 0){ current_packet_size=0; #ifndef ALT_BITSTREAM_WRITER s->pb.buf_ptr= s->ptr_lastgob; #endif assert(pbBufPtr(&s->pb) == s->ptr_lastgob); } } if (s->avctx->rtp_callback){ int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x; s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb); } switch(s->codec_id){ case CODEC_ID_MPEG4: if (ENABLE_MPEG4_ENCODER) { ff_mpeg4_encode_video_packet_header(s); ff_mpeg4_clean_buffers(s); } break; case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) { ff_mpeg1_encode_slice_header(s); ff_mpeg1_clean_buffers(s); } break; case CODEC_ID_H263: case CODEC_ID_H263P: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER) h263_encode_gob_header(s, mb_y); break; } if(s->flags&CODEC_FLAG_PASS1){ int bits= put_bits_count(&s->pb); s->misc_bits+= bits - s->last_bits; s->last_bits= bits; } s->ptr_lastgob += current_packet_size; s->first_slice_line=1; s->resync_mb_x=mb_x; s->resync_mb_y=mb_y; } } if( (s->resync_mb_x == s->mb_x) && s->resync_mb_y+1 == s->mb_y){ s->first_slice_line=0; } s->mb_skipped=0; s->dquant=0; if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ int next_block=0; int pb_bits_count, pb2_bits_count, tex_pb_bits_count; copy_context_before_encode(&backup_s, s, -1); backup_s.pb= s->pb; best_s.data_partitioning= s->data_partitioning; best_s.partitioned_frame= s->partitioned_frame; if(s->data_partitioning){ backup_s.pb2= s->pb2; backup_s.tex_pb= s->tex_pb; } if(mb_type&CANDIDATE_MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER4V){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_INTRA){ s->mv_dir = 0; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); if(s->h263_pred || s->h263_aic){ if(best_s.mb_intra) s->mbintra_table[mb_x + mb_y*s->mb_stride]=1; else ff_clean_intra_table_entries(s); } } if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){ if(best_s.mv_type==MV_TYPE_16X16){ const int last_qp= backup_s.qscale; int qpi, qp, dc[6]; DCTELEM ac[6][16]; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; static const int dquant_tab[4]={-1,1,-2,2}; assert(backup_s.dquant == 0); s->mv_dir= best_s.mv_dir; s->mv_type = MV_TYPE_16X16; s->mb_intra= best_s.mb_intra; s->mv[0][0][0] = best_s.mv[0][0][0]; s->mv[0][0][1] = best_s.mv[0][0][1]; s->mv[1][0][0] = best_s.mv[1][0][0]; s->mv[1][0][1] = best_s.mv[1][0][1]; qpi = s->pict_type == FF_B_TYPE ? 2 : 0; for(; qpi<4; qpi++){ int dquant= dquant_tab[qpi]; qp= last_qp + dquant; if(qp < s->avctx->qmin || qp > s->avctx->qmax) continue; backup_s.dquant= dquant; if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ dc[i]= s->dc_val[0][ s->block_index[i] ]; memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16); } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb, &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]); if(best_s.qscale != qp){ if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ s->dc_val[0][ s->block_index[i] ]= dc[i]; memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16); } } } } } } if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){ int mx= s->b_direct_mv_table[xy][0]; int my= s->b_direct_mv_table[xy][1]; backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, mx, my); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){ backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){ int coded=0; for(i=0; i<6; i++) coded |= s->block_last_index[i]; if(coded){ int mx,my; memcpy(s->mv, best_s.mv, sizeof(s->mv)); if(ENABLE_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){ mx=my=0; ff_mpeg4_set_direct_mv(s, mx, my); }else if(best_s.mv_dir&MV_DIR_BACKWARD){ mx= s->mv[1][0][0]; my= s->mv[1][0][1]; }else{ mx= s->mv[0][0][0]; my= s->mv[0][0][1]; } s->mv_dir= best_s.mv_dir; s->mv_type = best_s.mv_type; s->mb_intra= 0; backup_s.dquant= 0; s->skipdct=1; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb, &dmin, &next_block, mx, my); s->skipdct=0; } } s->current_picture.qscale_table[xy]= best_s.qscale; copy_context_after_encode(s, &best_s, -1); pb_bits_count= put_bits_count(&s->pb); flush_put_bits(&s->pb); ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); s->pb= backup_s.pb; if(s->data_partitioning){ pb2_bits_count= put_bits_count(&s->pb2); flush_put_bits(&s->pb2); ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); s->pb2= backup_s.pb2; tex_pb_bits_count= put_bits_count(&s->tex_pb); flush_put_bits(&s->tex_pb); ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); s->tex_pb= backup_s.tex_pb; } s->last_bits= put_bits_count(&s->pb); if (ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); if(next_block==0){ s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16); s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8); s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8); } if(s->avctx->mb_decision == FF_MB_DECISION_BITS) MPV_decode_mb(s, s->block); } else { int motion_x = 0, motion_y = 0; s->mv_type=MV_TYPE_16X16; switch(mb_type){ case CANDIDATE_MB_TYPE_INTRA: s->mv_dir = 0; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case CANDIDATE_MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_INTER_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_INTER4V: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } break; case CANDIDATE_MB_TYPE_DIRECT: if (ENABLE_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; ff_mpeg4_set_direct_mv(s, motion_x, motion_y); } break; case CANDIDATE_MB_TYPE_DIRECT0: if (ENABLE_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); } break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BACKWARD_I: s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BIDIR_I: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } break; default: av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n"); } encode_mb(s, motion_x, motion_y); s->last_mv_dir = s->mv_dir; if (ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); MPV_decode_mb(s, s->block); } if(s->mb_intra ){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } if(s->flags&CODEC_FLAG_PSNR){ int w= 16; int h= 16; if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; s->current_picture.error[0] += sse( s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize); s->current_picture.error[1] += sse( s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8, s->dest[1], w>>1, h>>1, s->uvlinesize); s->current_picture.error[2] += sse( s, s->new_picture .data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8, s->dest[2], w>>1, h>>1, s->uvlinesize); } if(s->loop_filter){ if(ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263) ff_h263_loop_filter(s); } } } if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE) msmpeg4_encode_ext_header(s); write_slice_end(s); if (s->avctx->rtp_callback) { int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x; pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; emms_c(); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb); } return 0; } libavcodec/mpegvideo_enc.c:2431: error: Uninitialized Value The value read from best_s.qscale was never initialized. libavcodec/mpegvideo_enc.c:2431:17: 2429. } 2430. 2431. s->current_picture.qscale_table[xy]= best_s.qscale; ^ 2432. 2433. copy_context_after_encode(s, &best_s, -1);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L2431
d2a_code_trace_data_45418
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/rand/drbg_ctr.c:76: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/rand/drbg_ctr.c:76:10: Call 74. out[i] ^= in[i]; 75. 76. if (!EVP_CipherUpdate(ctr->ctx_df, out, &outlen, out, AES_BLOCK_SIZE) ^ 77. || outlen != AES_BLOCK_SIZE) 78. return 0; crypto/evp/evp_enc.c:209:1: Parameter `ctx->cipher->block_size` 207. } 208. 209. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 210. const unsigned char *in, int inl) 211. { crypto/evp/evp_enc.c:215:16: Call 213. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 214. else 215. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 216. } 217. crypto/evp/evp_enc.c:423:1: Parameter `ctx->cipher->block_size` 421. } 422. 423. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 424. const unsigned char *in, int inl) 425. { crypto/evp/evp_enc.c:429:5: Assignment 427. unsigned int b; 428. 429. b = ctx->cipher->block_size; ^ 430. 431. if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) crypto/evp/evp_enc.c:462:16: Call 460. /* see comment about PTRDIFF_T comparison above */ 461. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 462. || is_partially_overlapping(out, in, b)) { ^ 463. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 464. return 0; crypto/evp/evp_enc.c:283:1: <RHS trace> 281. #endif 282. 283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 284. { 285. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:283:1: Parameter `len` 281. #endif 282. 283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 284. { 285. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:292:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 290. */ 291. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 292. (diff > (0 - (PTRDIFF_T)len))); ^ 293. 294. return overlapped;
https://github.com/openssl/openssl/blob/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/evp/evp_enc.c/#L292
d2a_code_trace_data_45419
void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; poly1305_emit_f poly1305_emit_p = ctx->func.emit; #endif size_t num; if ((num = ctx->num)) { ctx->data[num++] = 1; while (num < POLY1305_BLOCK_SIZE) ctx->data[num++] = 0; poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0); } poly1305_emit(ctx->opaque, mac, ctx->nonce); OPENSSL_cleanse(ctx, sizeof(*ctx)); } test/poly1305_internal_test.c:1588: error: BUFFER_OVERRUN_L2 Offset: [1, 29] Size: 16 by call to `Poly1305_Final`. Showing all 15 steps of the trace test/poly1305_internal_test.c:1585:9: Call 1583. 1584. if (inlen > 16) { 1585. Poly1305_Init(&poly1305, key); ^ 1586. Poly1305_Update(&poly1305, in, 1); 1587. Poly1305_Update(&poly1305, in+1, inlen-1); crypto/poly1305/poly1305.c:458:5: Assignment 456. #endif 457. 458. ctx->num = 0; ^ 459. 460. } test/poly1305_internal_test.c:1586:9: Call 1584. if (inlen > 16) { 1585. Poly1305_Init(&poly1305, key); 1586. Poly1305_Update(&poly1305, in, 1); ^ 1587. Poly1305_Update(&poly1305, in+1, inlen-1); 1588. Poly1305_Final(&poly1305, out); crypto/poly1305/poly1305.c:471:1: Parameter `len` 469. #endif 470. 471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 472. { 473. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:494:13: Assignment 492. /* Still not enough data to process a block. */ 493. memcpy(ctx->data + num, inp, len); 494. ctx->num = num + len; ^ 495. return; 496. } test/poly1305_internal_test.c:1587:9: Call 1585. Poly1305_Init(&poly1305, key); 1586. Poly1305_Update(&poly1305, in, 1); 1587. Poly1305_Update(&poly1305, in+1, inlen-1); ^ 1588. Poly1305_Final(&poly1305, out); 1589. crypto/poly1305/poly1305.c:471:1: Parameter `len` 469. #endif 470. 471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 472. { 473. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:494:13: Assignment 492. /* Still not enough data to process a block. */ 493. memcpy(ctx->data + num, inp, len); 494. ctx->num = num + len; ^ 495. return; 496. } test/poly1305_internal_test.c:1588:9: Call 1586. Poly1305_Update(&poly1305, in, 1); 1587. Poly1305_Update(&poly1305, in+1, inlen-1); 1588. Poly1305_Final(&poly1305, out); ^ 1589. 1590. if (memcmp(out, expected, expectedlen) != 0) { crypto/poly1305/poly1305.c:513:1: <Offset trace> 511. } 512. 513. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 514. { 515. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:513:1: Parameter `ctx->num` 511. } 512. 513. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 514. { 515. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:521:10: Assignment 519. size_t num; 520. 521. if ((num = ctx->num)) { ^ 522. ctx->data[num++] = 1; /* pad bit */ 523. while (num < POLY1305_BLOCK_SIZE) crypto/poly1305/poly1305.c:513:1: <Length trace> 511. } 512. 513. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 514. { 515. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:513:1: Parameter `ctx->data[*]` 511. } 512. 513. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 514. { 515. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:522:9: Array access: Offset: [1, 29] Size: 16 by call to `Poly1305_Final` 520. 521. if ((num = ctx->num)) { 522. ctx->data[num++] = 1; /* pad bit */ ^ 523. while (num < POLY1305_BLOCK_SIZE) 524. ctx->data[num++] = 0;
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/crypto/poly1305/poly1305.c/#L522
d2a_code_trace_data_45420
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } apps/s_client.c:244: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_exp`. Showing all 40 steps of the trace apps/s_client.c:231:1: Parameter `N->top` 229. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 230. 231. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 232. { 233. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:237:53: Call 235. BIGNUM *r = BN_new(); 236. int ret = 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 239. p != NULL && BN_rshift1(p, N) && crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); apps/s_client.c:238:9: Call 236. int ret = 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 239. p != NULL && BN_rshift1(p, N) && 240. /* p = (N-1)/2 */ crypto/bn/bn_prime.c:147:1: Parameter `a->top` 145. } 146. 147. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 148. BN_GENCB *cb) 149. { crypto/bn/bn_prime.c:150:12: Call 148. BN_GENCB *cb) 149. { 150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 151. } 152. crypto/bn/bn_prime.c:153:1: Parameter `a->top` 151. } 152. 153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 154. int do_trial_division, BN_GENCB *cb) 155. { crypto/bn/bn_prime.c:162:9: Call 160. BN_MONT_CTX *mont = NULL; 161. 162. if (BN_cmp(a, BN_value_one()) <= 0) ^ 163. return 0; 164. crypto/bn/bn_lib.c:577:1: Parameter `a->top` 575. } 576. 577. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 578. { 579. int i; apps/s_client.c:239:22: Call 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 239. p != NULL && BN_rshift1(p, N) && ^ 240. /* p = (N-1)/2 */ 241. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && crypto/bn/bn_shift.c:54:9: Call 52. bn_check_top(a); 53. 54. if (BN_is_zero(a)) { ^ 55. BN_zero(r); 56. return (1); crypto/bn/bn_lib.c:852:1: Parameter `a->top` 850. } 851. 852. > int BN_is_zero(const BIGNUM *a) 853. { 854. return a->top == 0; apps/s_client.c:244:9: Call 242. r != NULL && 243. /* verify g^((N-1)/2) == -1 (mod N) */ 244. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 245. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 246. crypto/bn/bn_exp.c:91:1: Parameter `m->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:136:9: Call 134. 135. #ifdef MONT_MUL_MOD 136. if (BN_is_odd(m)) { ^ 137. # ifdef MONT_EXP_WORD 138. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `m->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:737:14: Assignment 735. /* 2^(top*BN_BITS2) - m */ 736. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 737. for (i = 1; i < top; i++) ^ 738. tmp.d[i] = (~m->d[i]) & BN_MASK2; 739. tmp.top = top; crypto/bn/bn_exp.c:1036:14: Call 1034. for (wvalue = 0, i = bits % window; i >= 0; i--, bits--) 1035. wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); 1036. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1037. window)) 1038. goto err; crypto/bn/bn_exp.c:518:1: Parameter `top` 516. } 517. 518. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 519. unsigned char *buf, int idx, 520. int window) crypto/bn/bn_exp.c:575:5: Assignment 573. } 574. 575. b->top = top; ^ 576. bn_correct_top(b); 577. return 1; crypto/bn/bn_exp.c:576:5: Call 574. 575. b->top = top; 576. bn_correct_top(b); ^ 577. return 1; 578. } crypto/bn/bn_lib.c:953:1: Parameter `a->top` 951. } 952. 953. > void bn_correct_top(BIGNUM *a) 954. { 955. BN_ULONG *ftl; crypto/bn/bn_exp.c:1049:22: Call 1047. /* Scan the window, squaring the result as we go */ 1048. for (i = 0; i < window; i++, bits--) { 1049. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1050. goto err; 1051. wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_exp` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_45421
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavformat/rtpdec_qt.c:81: error: Integer Overflow L2 ([0, 64] - [0, 64]):unsigned32 by call to `bitstream_skip`. libavformat/rtpdec_qt.c:75:5: Call 73. * http://developer.apple.com/quicktime/icefloe/dispatch026.html 74. */ 75. bitstream_init(&bc, buf, len << 3); ^ 76. ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL); 77. libavcodec/bitstream.h:85:9: Assignment 83. bc->buffer = 84. bc->ptr = NULL; 85. bc->bits_left = 0; ^ 86. return AVERROR_INVALIDDATA; 87. } libavformat/rtpdec_qt.c:81:5: Call 79. return AVERROR_INVALIDDATA; 80. 81. bitstream_skip(&bc, 4); // version ^ 82. if ((packing_scheme = bitstream_read(&bc, 2)) == 0) 83. return AVERROR_INVALIDDATA; libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:247:9: Call 245. else { 246. n -= bc->bits_left; 247. skip_remaining(bc, bc->bits_left); ^ 248. if (n >= 64) { 249. unsigned skip = n / 8; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([0, 64] - [0, 64]):unsigned32 by call to `bitstream_skip` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L237
d2a_code_trace_data_45422
static void vp6_parse_coeff(vp56_context_t *s) { vp56_range_coder_t *c = s->ccp; vp56_model_t *model = s->modelp; uint8_t *permute = s->scantable.permutated; uint8_t *model1, *model2, *model3; int coeff, sign, coeff_idx; int b, i, cg, idx, ctx; int pt = 0; for (b=0; b<6; b++) { int ct = 1; int run = 1; if (b > 3) pt = 1; ctx = s->left_block[vp56_b6to4[b]].not_null_dc + s->above_blocks[s->above_block_idx[b]].not_null_dc; model1 = model->coeff_dccv[pt]; model2 = model->coeff_dcct[pt][ctx]; for (coeff_idx=0; coeff_idx<64; ) { if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) { if (vp56_rac_get_prob(c, model2[2])) { if (vp56_rac_get_prob(c, model2[3])) { idx = vp56_rac_get_tree(c, vp56_pc_tree, model1); coeff = vp56_coeff_bias[idx+5]; for (i=vp56_coeff_bit_length[idx]; i>=0; i--) coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; } else { if (vp56_rac_get_prob(c, model2[4])) coeff = 3 + vp56_rac_get_prob(c, model1[5]); else coeff = 2; } ct = 2; } else { ct = 1; coeff = 1; } sign = vp56_rac_get(c); coeff = (coeff ^ -sign) + sign; if (coeff_idx) coeff *= s->dequant_ac; idx = model->coeff_index_to_pos[coeff_idx]; s->block_coeff[b][permute[idx]] = coeff; run = 1; } else { ct = 0; if (coeff_idx > 0) { if (!vp56_rac_get_prob(c, model2[1])) break; model3 = model->coeff_runv[coeff_idx >= 6]; run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); if (!run) for (run=9, i=0; i<6; i++) run += vp56_rac_get_prob(c, model3[i+8]) << i; } } cg = vp6_coeff_groups[coeff_idx+=run]; model1 = model2 = model->coeff_ract[pt][ct][cg]; } s->left_block[vp56_b6to4[b]].not_null_dc = s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0]; } } libavcodec/vp6.c:464: error: Buffer Overrun L1 Offset: [8, 14] (⇐ [0, 1] + [8, 13]) Size: 2. libavcodec/vp6.c:463:37: <Offset trace> 461. run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); 462. if (!run) 463. for (run=9, i=0; i<6; i++) ^ 464. run += vp56_rac_get_prob(c, model3[i+8]) << i; 465. } libavcodec/vp6.c:463:37: Assignment 461. run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); 462. if (!run) 463. for (run=9, i=0; i<6; i++) ^ 464. run += vp56_rac_get_prob(c, model3[i+8]) << i; 465. } libavcodec/vp6.c:405:1: <Length trace> 403. } 404. 405. static void vp6_parse_coeff(vp56_context_t *s) ^ 406. { 407. vp56_range_coder_t *c = s->ccp; libavcodec/vp6.c:405:1: Parameter `s->modelp->coeff_runv[*]` 403. } 404. 405. static void vp6_parse_coeff(vp56_context_t *s) ^ 406. { 407. vp56_range_coder_t *c = s->ccp; libavcodec/vp6.c:460:21: Assignment 458. break; 459. 460. model3 = model->coeff_runv[coeff_idx >= 6]; ^ 461. run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); 462. if (!run) libavcodec/vp6.c:464:57: Array access: Offset: [8, 14] (⇐ [0, 1] + [8, 13]) Size: 2 462. if (!run) 463. for (run=9, i=0; i<6; i++) 464. run += vp56_rac_get_prob(c, model3[i+8]) << i; ^ 465. } 466. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp6.c/#L464
d2a_code_trace_data_45423
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/t1_lib.c:1429: 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 12 steps of the trace ssl/t1_lib.c:1428:14: Call 1426. if (!s->hit && s->servername_done == 1 1427. && s->session->tlsext_hostname != NULL) { 1428. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) ^ 1429. || !WPACKET_put_bytes_u16(pkt, 0)) { 1430. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:261:1: Parameter `pkt->buf->length` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/t1_lib.c:1429:21: Call 1427. && s->session->tlsext_hostname != NULL) { 1428. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) 1429. || !WPACKET_put_bytes_u16(pkt, 0)) { ^ 1430. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); 1431. return 0; ssl/packet.c:261:1: Parameter `pkt->written` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/packet.c:269:17: Call 267. 268. if (size > sizeof(unsigned int) 269. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 270. || !put_value(data, val, size)) 271. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 13]):unsigned64 by call to `WPACKET_put_bytes__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_45424
static int gif_parse_next_image(GifState *s) { ByteIOContext *f = s->f; int ret, code; for (;;) { code = url_fgetc(f); #ifdef DEBUG printf("gif: code=%02x '%c'\n", code, code); #endif switch (code) { case ',': if (gif_read_image(s) < 0) return AVERROR(EIO); ret = 0; goto the_end; case ';': ret = AVERROR(EIO); goto the_end; case '!': if (gif_read_extension(s) < 0) return AVERROR(EIO); break; case EOF: default: ret = AVERROR(EIO); goto the_end; } } the_end: return ret; } libavformat/gifdec.c:519: error: Uninitialized Value The value read from ret was never initialized. libavformat/gifdec.c:519:5: 517. } 518. the_end: 519. return ret; ^ 520. } 521.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/gifdec.c/#L519
d2a_code_trace_data_45425
static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, unsigned char *iv, size_t ivlen, unsigned char *seq) { unsigned char *pt = NULL, *sq = NULL, *ivtmp = NULL; size_t ptlen; *key = OPENSSL_hexstr2buf(recd->key, NULL); ivtmp = OPENSSL_hexstr2buf(recd->iv, NULL); sq = OPENSSL_hexstr2buf(recd->seq, NULL); pt = multihexstr2buf(recd->plaintext, &ptlen); if (*key == NULL || ivtmp == NULL || sq == NULL || pt == NULL) goto err; rec->data = rec->input = OPENSSL_malloc(ptlen + EVP_GCM_TLS_TAG_LEN); if (rec->data == NULL) goto err; rec->length = ptlen; memcpy(rec->data, pt, ptlen); OPENSSL_free(pt); memcpy(seq, sq, SEQ_NUM_SIZE); OPENSSL_free(sq); memcpy(iv, ivtmp, ivlen); OPENSSL_free(ivtmp); return 1; err: OPENSSL_free(*key); *key = NULL; OPENSSL_free(ivtmp); OPENSSL_free(sq); OPENSSL_free(pt); return 0; } test/tls13encryptiontest.c:318: error: BUFFER_OVERRUN_L3 Offset added: 8 Size: [1, +oo] by call to `load_record`. Showing all 9 steps of the trace test/tls13encryptiontest.c:348:13: Call 346. 347. /* Decrypt it */ 348. if (tls13_enc(s, &rec, 1, 0) != 1) { ^ 349. fprintf(stderr, "Failed to decrypt record %"OSSLzu"\n", ctr); 350. goto err; ssl/record/ssl3_record_tls13.c:23:1: Parameter `recs->data->strlen` 21. * an internal error occurred. 22. */ 23. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int send) 24. { 25. EVP_CIPHER_CTX *ctx; test/tls13encryptiontest.c:318:14: Call 316. /* Load the record */ 317. ivlen = EVP_CIPHER_iv_length(ciph); 318. if (!load_record(&rec, &refdata[ctr], &key, s->read_iv, ivlen, ^ 319. RECORD_LAYER_get_read_sequence(&s->rlayer))) { 320. fprintf(stderr, "Failed loading key into EVP_CIPHER_CTX\n"); test/tls13encryptiontest.c:214:1: <Length trace> 212. } 213. 214. > static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, 215. unsigned char *iv, size_t ivlen, unsigned char *seq) 216. { test/tls13encryptiontest.c:214:1: Parameter `recd->seq->strlen` 212. } 213. 214. > static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, 215. unsigned char *iv, size_t ivlen, unsigned char *seq) 216. { test/tls13encryptiontest.c:222:10: Call 220. *key = OPENSSL_hexstr2buf(recd->key, NULL); 221. ivtmp = OPENSSL_hexstr2buf(recd->iv, NULL); 222. sq = OPENSSL_hexstr2buf(recd->seq, NULL); ^ 223. pt = multihexstr2buf(recd->plaintext, &ptlen); 224. crypto/o_str.c:161:9: Assignment 159. if ((hexbuf = OPENSSL_malloc(s >> 1)) == NULL) { 160. CRYPTOerr(CRYPTO_F_OPENSSL_HEXSTR2BUF, ERR_R_MALLOC_FAILURE); 161. return NULL; ^ 162. } 163. for (p = (const unsigned char *)str, q = hexbuf; *p; ) { test/tls13encryptiontest.c:222:5: Assignment 220. *key = OPENSSL_hexstr2buf(recd->key, NULL); 221. ivtmp = OPENSSL_hexstr2buf(recd->iv, NULL); 222. sq = OPENSSL_hexstr2buf(recd->seq, NULL); ^ 223. pt = multihexstr2buf(recd->plaintext, &ptlen); 224. test/tls13encryptiontest.c:236:5: Array access: Offset added: 8 Size: [1, +oo] by call to `load_record` 234. memcpy(rec->data, pt, ptlen); 235. OPENSSL_free(pt); 236. memcpy(seq, sq, SEQ_NUM_SIZE); ^ 237. OPENSSL_free(sq); 238. memcpy(iv, ivtmp, ivlen);
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/test/tls13encryptiontest.c/#L236
d2a_code_trace_data_45426
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:3585: error: Null Dereference pointer `file_oformat` last assigned on line 3574 could be null and is dereferenced at line 3585, column 17. ffmpeg.c:3548:1: start of procedure opt_output_file() 3546. } 3547. 3548. static void opt_output_file(const char *filename) ^ 3549. { 3550. AVFormatContext *oc; ffmpeg.c:3553:5: 3551. int err, use_video, use_audio, use_subtitle; 3552. int input_has_video, input_has_audio, input_has_subtitle; 3553. AVFormatParameters params, *ap = &params; ^ 3554. AVOutputFormat *file_oformat; 3555. AVMetadataTag *tag = NULL; ffmpeg.c:3555:5: 3553. AVFormatParameters params, *ap = &params; 3554. AVOutputFormat *file_oformat; 3555. AVMetadataTag *tag = NULL; ^ 3556. 3557. if (!strcmp(filename, "-")) ffmpeg.c:3557:10: Taking false branch 3555. AVMetadataTag *tag = NULL; 3556. 3557. if (!strcmp(filename, "-")) ^ 3558. filename = "pipe:"; 3559. ffmpeg.c:3560:5: 3558. filename = "pipe:"; 3559. 3560. oc = avformat_alloc_context(); ^ 3561. if (!oc) { 3562. 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(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int 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, unsigned int size) libavformat/options.c:86:10: Taking false branch 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:87:5: Skipping avformat_get_context_defaults(): empty list of specs 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); ^ 88. ic->av_class = &av_format_context_class; 89. return ic; libavformat/options.c:88:5: 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; ^ 89. return ic; 90. } libavformat/options.c:89:5: 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; 89. return ic; ^ 90. } 91. libavformat/options.c:90:1: return from a call to avformat_alloc_context 88. ic->av_class = &av_format_context_class; 89. return ic; 90. } ^ 91. 92. #if FF_API_ALLOC_FORMAT_CONTEXT ffmpeg.c:3561:10: Taking false branch 3559. 3560. oc = avformat_alloc_context(); 3561. if (!oc) { ^ 3562. print_error(filename, AVERROR(ENOMEM)); 3563. ffmpeg_exit(1); ffmpeg.c:3566:9: Taking false branch 3564. } 3565. 3566. if (last_asked_format) { ^ 3567. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3568. if (!file_oformat) { ffmpeg.c:3574:9: Skipping av_guess_format(): empty list of specs 3572. last_asked_format = NULL; 3573. } else { 3574. file_oformat = av_guess_format(NULL, filename, NULL); ^ 3575. if (!file_oformat) { 3576. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3575:14: Taking true branch 3573. } else { 3574. file_oformat = av_guess_format(NULL, filename, NULL); 3575. if (!file_oformat) { ^ 3576. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3577. filename); ffmpeg.c:3576:13: 3574. file_oformat = av_guess_format(NULL, filename, NULL); 3575. if (!file_oformat) { 3576. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3577. filename); 3578. ffmpeg_exit(1); ffmpeg.c:3578:13: Skipping ffmpeg_exit(): empty list of specs 3576. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3577. filename); 3578. ffmpeg_exit(1); ^ 3579. } 3580. } ffmpeg.c:3582:5: 3580. } 3581. 3582. oc->oformat = file_oformat; ^ 3583. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3584. ffmpeg.c:3583:5: 3581. 3582. oc->oformat = file_oformat; 3583. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3584. 3585. if (!strcmp(file_oformat->name, "ffm") && libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3585:10: 3583. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3584. 3585. if (!strcmp(file_oformat->name, "ffm") && ^ 3586. av_strstart(filename, "http:", NULL)) { 3587. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/ffmpeg.c/#L3585
d2a_code_trace_data_45427
AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) { AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); *ret = *ref; if (ref->type == AVMEDIA_TYPE_VIDEO) { ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); *ret->video = *ref->video; } ret->perms &= pmask; ret->buf->refcount ++; return ret; } libavfilter/avfilter.c:51: error: Null Dereference pointer `ret` last assigned on line 50 could be null and is dereferenced at line 51, column 5. libavfilter/avfilter.c:48:1: start of procedure avfilter_ref_buffer() 46. #define link_spad(link) link->src->output_pads[link->srcpad] 47. 48. AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) ^ 49. { 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); libavfilter/avfilter.c:50:5: 48. AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) 49. { 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); ^ 51. *ret = *ref; 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking true branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(16,size); libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavfilter/avfilter.c:51:5: 49. { 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); 51. *ret = *ref; ^ 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { 53. ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L51
d2a_code_trace_data_45428
static int ocsp_server_cb(SSL *s, void *arg) { int *argi = (int *)arg; unsigned char *copy = NULL; STACK_OF(OCSP_RESPID) *ids = NULL; OCSP_RESPID *id = NULL; if (*argi == 2) { SSL_get_tlsext_status_ids(s, &ids); if (ids == NULL || sk_OCSP_RESPID_num(ids) != 1) return SSL_TLSEXT_ERR_ALERT_FATAL; id = sk_OCSP_RESPID_value(ids, 0); if (id == NULL || !OCSP_RESPID_match(id, ocspcert)) return SSL_TLSEXT_ERR_ALERT_FATAL; } else if (*argi != 1) { return SSL_TLSEXT_ERR_ALERT_FATAL; } if (!TEST_ptr(copy = OPENSSL_memdup(orespder, sizeof(orespder)))) return SSL_TLSEXT_ERR_ALERT_FATAL; SSL_set_tlsext_status_ocsp_resp(s, copy, sizeof(orespder)); ocsp_server_called = 1; return SSL_TLSEXT_ERR_OK; } test/sslapitest.c:1052: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_memdup()` at line 1049, column 10 is not reachable after line 1052, column 5. Showing all 31 steps of the trace test/sslapitest.c:1029:1: start of procedure ocsp_server_cb() 1027. 1028. #ifndef OPENSSL_NO_OCSP 1029. > static int ocsp_server_cb(SSL *s, void *arg) 1030. { 1031. int *argi = (int *)arg; test/sslapitest.c:1031:5: 1029. static int ocsp_server_cb(SSL *s, void *arg) 1030. { 1031. > int *argi = (int *)arg; 1032. unsigned char *copy = NULL; 1033. STACK_OF(OCSP_RESPID) *ids = NULL; test/sslapitest.c:1032:5: 1030. { 1031. int *argi = (int *)arg; 1032. > unsigned char *copy = NULL; 1033. STACK_OF(OCSP_RESPID) *ids = NULL; 1034. OCSP_RESPID *id = NULL; test/sslapitest.c:1033:5: 1031. int *argi = (int *)arg; 1032. unsigned char *copy = NULL; 1033. > STACK_OF(OCSP_RESPID) *ids = NULL; 1034. OCSP_RESPID *id = NULL; 1035. test/sslapitest.c:1034:5: 1032. unsigned char *copy = NULL; 1033. STACK_OF(OCSP_RESPID) *ids = NULL; 1034. > OCSP_RESPID *id = NULL; 1035. 1036. if (*argi == 2) { test/sslapitest.c:1036:9: Taking false branch 1034. OCSP_RESPID *id = NULL; 1035. 1036. if (*argi == 2) { ^ 1037. /* In this test we are expecting exactly 1 OCSP_RESPID */ 1038. SSL_get_tlsext_status_ids(s, &ids); test/sslapitest.c:1045:16: Taking false branch 1043. if (id == NULL || !OCSP_RESPID_match(id, ocspcert)) 1044. return SSL_TLSEXT_ERR_ALERT_FATAL; 1045. } else if (*argi != 1) { ^ 1046. return SSL_TLSEXT_ERR_ALERT_FATAL; 1047. } test/sslapitest.c:1049:10: 1047. } 1048. 1049. > if (!TEST_ptr(copy = OPENSSL_memdup(orespder, sizeof(orespder)))) 1050. return SSL_TLSEXT_ERR_ALERT_FATAL; 1051. crypto/o_str.c:57:1: start of procedure CRYPTO_memdup() 55. } 56. 57. > void *CRYPTO_memdup(const void *data, size_t siz, const char* file, int line) 58. { 59. void *ret; crypto/o_str.c:61:9: Taking false branch 59. void *ret; 60. 61. if (data == NULL || siz >= INT_MAX) ^ 62. return NULL; 63. crypto/o_str.c:61:25: Taking false branch 59. void *ret; 60. 61. if (data == NULL || siz >= INT_MAX) ^ 62. return NULL; 63. crypto/o_str.c:64:5: 62. return NULL; 63. 64. > ret = CRYPTO_malloc(siz, file, line); 65. if (ret == NULL) { 66. CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking false branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:65:9: Taking false branch 63. 64. ret = CRYPTO_malloc(siz, file, line); 65. if (ret == NULL) { ^ 66. CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE); 67. return NULL; crypto/o_str.c:69:5: 67. return NULL; 68. } 69. > return memcpy(ret, data, siz); 70. } 71. crypto/o_str.c:70:1: return from a call to CRYPTO_memdup 68. } 69. return memcpy(ret, data, siz); 70. > } 71. 72. size_t OPENSSL_strnlen(const char *str, size_t maxlen) test/testutil/tests.c:229:1: start of procedure test_ptr() 227. } 228. 229. > int test_ptr(const char *file, int line, const char *s, const void *p) 230. { 231. if (p != NULL) test/testutil/tests.c:231:9: Taking true branch 229. int test_ptr(const char *file, int line, const char *s, const void *p) 230. { 231. if (p != NULL) ^ 232. return 1; 233. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); test/testutil/tests.c:232:9: 230. { 231. if (p != NULL) 232. > return 1; 233. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 234. return 0; test/testutil/tests.c:235:1: return from a call to test_ptr 233. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 234. return 0; 235. > } 236. 237. int test_true(const char *file, int line, const char *s, int b) test/sslapitest.c:1049:10: Taking false branch 1047. } 1048. 1049. if (!TEST_ptr(copy = OPENSSL_memdup(orespder, sizeof(orespder)))) ^ 1050. return SSL_TLSEXT_ERR_ALERT_FATAL; 1051. test/sslapitest.c:1052:5: Skipping SSL_ctrl(): empty list of specs 1050. return SSL_TLSEXT_ERR_ALERT_FATAL; 1051. 1052. SSL_set_tlsext_status_ocsp_resp(s, copy, sizeof(orespder)); ^ 1053. ocsp_server_called = 1; 1054. return SSL_TLSEXT_ERR_OK;
https://github.com/openssl/openssl/blob/cc8926ec8fcecae89ceab91ef753de93e49568f9/test/sslapitest.c/#L1052
d2a_code_trace_data_45429
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/bn/bn_prime.c:227: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `witness`. Showing all 25 steps of the trace crypto/bn/bn_prime.c:197:10: Call 195. 196. /* compute A1 := a - 1 */ 197. if (!BN_copy(A1, a)) ^ 198. goto err; 199. if (!BN_sub_word(A1, 1)) crypto/bn/bn_lib.c:323:1: Parameter `a->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_prime.c:227:13: Call 225. /* now 1 <= check < a */ 226. 227. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 228. if (j == -1) 229. goto err; crypto/bn/bn_prime.c:249:1: Parameter `w->top` 247. } 248. 249. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 250. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 251. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:253:10: Call 251. BN_MONT_CTX *mont) 252. { 253. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 254. return -1; 255. if (BN_is_one(w)) crypto/bn/bn_exp.c:294:1: Parameter `a->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:594:1: Parameter `a->top` 592. * http://www.daemonology.net/hyperthreading-considered-harmful/) 593. */ 594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 595. const BIGNUM *m, BN_CTX *ctx, 596. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:751:17: Call 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) 750. goto err; 751. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 752. goto err; 753. crypto/bn/bn_lib.c:877:1: Parameter `a->top` 875. } 876. 877. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 878. BN_CTX *ctx) 879. { crypto/bn/bn_lib.c:880:12: Call 878. BN_CTX *ctx) 879. { 880. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 881. } 882. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `witness` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_45430
static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) { RTSPState *rt = s->priv_data; AVStream *st = NULL; if (rtsp_st->stream_index >= 0) st = s->streams[rtsp_st->stream_index]; if (!st) s->ctx_flags |= AVFMTCTX_NOHEADER; if (s->oformat && CONFIG_RTSP_MUXER) { rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, rtsp_st->rtp_handle, RTSP_TCP_MAX_PACKET_SIZE); rtsp_st->rtp_handle = NULL; } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); else if (CONFIG_RTPDEC) rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); if (!rtsp_st->transport_priv) { return AVERROR(ENOMEM); } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { if (rtsp_st->dynamic_handler) { rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); } } return 0; } libavformat/rtsp.c:561: error: Null Dereference pointer `st` last assigned on line 546 could be null and is dereferenced at line 561, column 56. libavformat/rtsp.c:543:1: start of procedure rtsp_open_transport_ctx() 541. } 542. 543. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) ^ 544. { 545. RTSPState *rt = s->priv_data; libavformat/rtsp.c:545:5: 543. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) 544. { 545. RTSPState *rt = s->priv_data; ^ 546. AVStream *st = NULL; 547. libavformat/rtsp.c:546:5: 544. { 545. RTSPState *rt = s->priv_data; 546. AVStream *st = NULL; ^ 547. 548. /* open the RTP context */ libavformat/rtsp.c:549:9: Taking false branch 547. 548. /* open the RTP context */ 549. if (rtsp_st->stream_index >= 0) ^ 550. st = s->streams[rtsp_st->stream_index]; 551. if (!st) libavformat/rtsp.c:551:10: Taking true branch 549. if (rtsp_st->stream_index >= 0) 550. st = s->streams[rtsp_st->stream_index]; 551. if (!st) ^ 552. s->ctx_flags |= AVFMTCTX_NOHEADER; 553. libavformat/rtsp.c:552:9: 550. st = s->streams[rtsp_st->stream_index]; 551. if (!st) 552. s->ctx_flags |= AVFMTCTX_NOHEADER; ^ 553. 554. if (s->oformat && CONFIG_RTSP_MUXER) { libavformat/rtsp.c:554:9: Taking false branch 552. s->ctx_flags |= AVFMTCTX_NOHEADER; 553. 554. if (s->oformat && CONFIG_RTSP_MUXER) { ^ 555. rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, 556. rtsp_st->rtp_handle, libavformat/rtsp.c:560:16: Taking true branch 558. /* Ownership of rtp_handle is passed to the rtp mux context */ 559. rtsp_st->rtp_handle = NULL; 560. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ^ 561. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, 562. rtsp_st->dynamic_protocol_context, libavformat/rtsp.c:560:55: Taking true branch 558. /* Ownership of rtp_handle is passed to the rtp mux context */ 559. rtsp_st->rtp_handle = NULL; 560. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ^ 561. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, 562. rtsp_st->dynamic_protocol_context, libavformat/rtsp.c:561:9: 559. rtsp_st->rtp_handle = NULL; 560. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) 561. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, ^ 562. rtsp_st->dynamic_protocol_context, 563. rtsp_st->dynamic_handler);
https://github.com/libav/libav/blob/d9c0510e22821baa364306d867ffac45da0620c8/libavformat/rtsp.c/#L561
d2a_code_trace_data_45431
EC_KEY *EC_KEY_new_method(ENGINE *engine) { EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_MALLOC_FAILURE); return (NULL); } ret->meth = EC_KEY_get_default_method(); #ifndef OPENSSL_NO_ENGINE if (engine != NULL) { if (!ENGINE_init(engine)) { ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); OPENSSL_free(ret); return NULL; } ret->engine = engine; } else ret->engine = ENGINE_get_default_EC(); if (ret->engine != NULL) { ret->meth = ENGINE_get_EC(ret->engine); if (ret->meth == NULL) { ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); ENGINE_finish(ret->engine); OPENSSL_free(ret); return NULL; } } #endif ret->version = 1; ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; ret->references = 1; if (ret->meth->init != NULL && ret->meth->init(ret) == 0) { EC_KEY_free(ret); return NULL; } return ret; } crypto/ec/ec_kmeth.c:130: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 98, column 19 is not reachable after line 130, column 9. Showing all 65 steps of the trace crypto/ec/ec_kmeth.c:96:1: start of procedure EC_KEY_new_method() 94. } 95. 96. > EC_KEY *EC_KEY_new_method(ENGINE *engine) 97. { 98. EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); crypto/ec/ec_kmeth.c:98:5: 96. EC_KEY *EC_KEY_new_method(ENGINE *engine) 97. { 98. > EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); 99. 100. if (ret == 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/ec/ec_kmeth.c:100:9: Taking false branch 98. EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); 99. 100. if (ret == NULL) { ^ 101. ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_MALLOC_FAILURE); 102. return (NULL); crypto/ec/ec_kmeth.c:104:5: 102. return (NULL); 103. } 104. > ret->meth = EC_KEY_get_default_method(); 105. #ifndef OPENSSL_NO_ENGINE 106. if (engine != NULL) { crypto/ec/ec_kmeth.c:83:1: start of procedure EC_KEY_get_default_method() 81. } 82. 83. > const EC_KEY_METHOD *EC_KEY_get_default_method(void) 84. { 85. return default_ec_key_meth; crypto/ec/ec_kmeth.c:85:5: 83. const EC_KEY_METHOD *EC_KEY_get_default_method(void) 84. { 85. > return default_ec_key_meth; 86. } 87. crypto/ec/ec_kmeth.c:86:1: return from a call to EC_KEY_get_default_method 84. { 85. return default_ec_key_meth; 86. > } 87. 88. void EC_KEY_set_default_method(const EC_KEY_METHOD *meth) crypto/ec/ec_kmeth.c:106:9: Taking true branch 104. ret->meth = EC_KEY_get_default_method(); 105. #ifndef OPENSSL_NO_ENGINE 106. if (engine != NULL) { ^ 107. if (!ENGINE_init(engine)) { 108. ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); crypto/ec/ec_kmeth.c:107:14: 105. #ifndef OPENSSL_NO_ENGINE 106. if (engine != NULL) { 107. > if (!ENGINE_init(engine)) { 108. ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); 109. OPENSSL_free(ret); crypto/engine/eng_init.c:127:1: start of procedure ENGINE_init() 125. 126. /* The API (locked) version of "init" */ 127. > int ENGINE_init(ENGINE *e) 128. { 129. int ret; crypto/engine/eng_init.c:130:9: Taking false branch 128. { 129. int ret; 130. if (e == NULL) { ^ 131. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER); 132. return 0; crypto/engine/eng_init.c:134:5: 132. return 0; 133. } 134. > CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 135. ret = engine_unlocked_init(e); 136. CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); crypto/lock.c:414:1: start of procedure CRYPTO_lock() 412. } 413. 414. > void CRYPTO_lock(int mode, int type, const char *file, int line) 415. { 416. #ifdef LOCK_DEBUG crypto/lock.c:441:9: Taking false branch 439. } 440. #endif 441. if (type < 0) { ^ 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:452:16: Taking true branch 450. CRYPTO_destroy_dynlockid(type); 451. } 452. } else if (locking_callback != NULL) ^ 453. locking_callback(mode, type, file, line); 454. } crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer 451. } 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); ^ 454. } 455. crypto/lock.c:441:5: 439. } 440. #endif 441. > if (type < 0) { 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:454:1: return from a call to CRYPTO_lock 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); 454. > } 455. 456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/engine/eng_init.c:135:5: 133. } 134. CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 135. > ret = engine_unlocked_init(e); 136. CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 137. return ret; crypto/engine/eng_init.c:62:1: start of procedure engine_unlocked_init() 60. * it's already in use). This version is only used internally. 61. */ 62. > int engine_unlocked_init(ENGINE *e) 63. { 64. int to_return = 1; crypto/engine/eng_init.c:64:5: 62. int engine_unlocked_init(ENGINE *e) 63. { 64. > int to_return = 1; 65. 66. if ((e->funct_ref == 0) && e->init) crypto/engine/eng_init.c:66:10: Taking false branch 64. int to_return = 1; 65. 66. if ((e->funct_ref == 0) && e->init) ^ 67. /* 68. * This is the first functional reference and the engine requires crypto/engine/eng_init.c:72:9: Taking true branch 70. */ 71. to_return = e->init(e); 72. if (to_return) { ^ 73. /* 74. * OK, we return a functional reference which is also a structural crypto/engine/eng_init.c:77:9: 75. * reference. 76. */ 77. > e->struct_ref++; 78. e->funct_ref++; 79. engine_ref_debug(e, 0, 1) crypto/engine/eng_init.c:78:9: 76. */ 77. e->struct_ref++; 78. > e->funct_ref++; 79. engine_ref_debug(e, 0, 1) 80. engine_ref_debug(e, 1, 1) crypto/engine/eng_init.c:82:5: 80. engine_ref_debug(e, 1, 1) 81. } 82. > return to_return; 83. } 84. crypto/engine/eng_init.c:83:1: return from a call to engine_unlocked_init 81. } 82. return to_return; 83. > } 84. 85. /* crypto/engine/eng_init.c:136:5: 134. CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 135. ret = engine_unlocked_init(e); 136. > CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 137. return ret; 138. } crypto/lock.c:414:1: start of procedure CRYPTO_lock() 412. } 413. 414. > void CRYPTO_lock(int mode, int type, const char *file, int line) 415. { 416. #ifdef LOCK_DEBUG crypto/lock.c:441:9: Taking false branch 439. } 440. #endif 441. if (type < 0) { ^ 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:452:16: Taking true branch 450. CRYPTO_destroy_dynlockid(type); 451. } 452. } else if (locking_callback != NULL) ^ 453. locking_callback(mode, type, file, line); 454. } crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer 451. } 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); ^ 454. } 455. crypto/lock.c:441:5: 439. } 440. #endif 441. > if (type < 0) { 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:454:1: return from a call to CRYPTO_lock 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); 454. > } 455. 456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/engine/eng_init.c:137:5: 135. ret = engine_unlocked_init(e); 136. CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 137. > return ret; 138. } 139. crypto/engine/eng_init.c:138:1: return from a call to ENGINE_init 136. CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 137. return ret; 138. > } 139. 140. /* The API (locked) version of "finish" */ crypto/ec/ec_kmeth.c:107:14: Taking false branch 105. #ifndef OPENSSL_NO_ENGINE 106. if (engine != NULL) { 107. if (!ENGINE_init(engine)) { ^ 108. ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); 109. OPENSSL_free(ret); crypto/ec/ec_kmeth.c:112:9: 110. return NULL; 111. } 112. > ret->engine = engine; 113. } else 114. ret->engine = ENGINE_get_default_EC(); crypto/ec/ec_kmeth.c:115:9: Taking true branch 113. } else 114. ret->engine = ENGINE_get_default_EC(); 115. if (ret->engine != NULL) { ^ 116. ret->meth = ENGINE_get_EC(ret->engine); 117. if (ret->meth == NULL) { crypto/ec/ec_kmeth.c:116:9: 114. ret->engine = ENGINE_get_default_EC(); 115. if (ret->engine != NULL) { 116. > ret->meth = ENGINE_get_EC(ret->engine); 117. if (ret->meth == NULL) { 118. ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); crypto/engine/tb_eckey.c:114:1: start of procedure ENGINE_get_EC() 112. 113. /* Obtains an EC_KEY implementation from an ENGINE functional reference */ 114. > const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e) 115. { 116. return e->ec_meth; crypto/engine/tb_eckey.c:116:5: 114. const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e) 115. { 116. > return e->ec_meth; 117. } 118. crypto/engine/tb_eckey.c:117:1: return from a call to ENGINE_get_EC 115. { 116. return e->ec_meth; 117. > } 118. 119. /* Sets an EC_KEY implementation in an ENGINE structure */ crypto/ec/ec_kmeth.c:117:13: Taking false branch 115. if (ret->engine != NULL) { 116. ret->meth = ENGINE_get_EC(ret->engine); 117. if (ret->meth == NULL) { ^ 118. ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB); 119. ENGINE_finish(ret->engine); crypto/ec/ec_kmeth.c:126:5: 124. #endif 125. 126. > ret->version = 1; 127. ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; 128. ret->references = 1; crypto/ec/ec_kmeth.c:127:5: 125. 126. ret->version = 1; 127. > ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; 128. ret->references = 1; 129. if (ret->meth->init != NULL && ret->meth->init(ret) == 0) { crypto/ec/ec_kmeth.c:128:5: 126. ret->version = 1; 127. ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; 128. > ret->references = 1; 129. if (ret->meth->init != NULL && ret->meth->init(ret) == 0) { 130. EC_KEY_free(ret); crypto/ec/ec_kmeth.c:129:9: Taking true branch 127. ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; 128. ret->references = 1; 129. if (ret->meth->init != NULL && ret->meth->init(ret) == 0) { ^ 130. EC_KEY_free(ret); 131. return NULL; crypto/ec/ec_kmeth.c:129:36: Taking true branch 127. ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; 128. ret->references = 1; 129. if (ret->meth->init != NULL && ret->meth->init(ret) == 0) { ^ 130. EC_KEY_free(ret); 131. return NULL; crypto/ec/ec_kmeth.c:130:9: Skipping EC_KEY_free(): empty list of specs 128. ret->references = 1; 129. if (ret->meth->init != NULL && ret->meth->init(ret) == 0) { 130. EC_KEY_free(ret); ^ 131. return NULL; 132. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/ec/ec_kmeth.c/#L130
d2a_code_trace_data_45432
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; char *codec_name = *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { fprintf(stderr, "File for preset '%s' not found\n", arg); ffmpeg_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ffmpeg_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else if(opt_default(tmp, tmp2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ffmpeg_exit(1); } } fclose(f); return 0; } ffmpeg.c:4042: error: Null Dereference pointer `f` last assigned on line 4037 could be null and is dereferenced by call to `feof()` at line 4042, column 12. ffmpeg.c:4029:1: start of procedure opt_preset() 4027. } 4028. 4029. static int opt_preset(const char *opt, const char *arg) ^ 4030. { 4031. FILE *f=NULL; ffmpeg.c:4031:5: 4029. static int opt_preset(const char *opt, const char *arg) 4030. { 4031. FILE *f=NULL; ^ 4032. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4033. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4033:24: Condition is false 4031. FILE *f=NULL; 4032. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4033. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4034. *opt == 'a' ? audio_codec_name : 4035. subtitle_codec_name; ffmpeg.c:4034:24: Condition is false 4032. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4033. char *codec_name = *opt == 'v' ? video_codec_name : 4034. *opt == 'a' ? audio_codec_name : ^ 4035. subtitle_codec_name; 4036. ffmpeg.c:4033:24: 4031. FILE *f=NULL; 4032. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4033. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4034. *opt == 'a' ? audio_codec_name : 4035. subtitle_codec_name; ffmpeg.c:4033:5: 4031. FILE *f=NULL; 4032. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4033. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4034. *opt == 'a' ? audio_codec_name : 4035. subtitle_codec_name; ffmpeg.c:4037:64: Condition is false 4035. subtitle_codec_name; 4036. 4037. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4038. fprintf(stderr, "File for preset '%s' not found\n", arg); 4039. ffmpeg_exit(1); ffmpeg.c:4037:11: Taking true branch 4035. subtitle_codec_name; 4036. 4037. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4038. fprintf(stderr, "File for preset '%s' not found\n", arg); 4039. ffmpeg_exit(1); ffmpeg.c:4038:9: 4036. 4037. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4038. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4039. ffmpeg_exit(1); 4040. } ffmpeg.c:4039:9: Skipping ffmpeg_exit(): empty list of specs 4037. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4038. fprintf(stderr, "File for preset '%s' not found\n", arg); 4039. ffmpeg_exit(1); ^ 4040. } 4041. ffmpeg.c:4042:12: 4040. } 4041. 4042. while(!feof(f)){ ^ 4043. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4044. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/c4d5ee233abcce9159b699f4e695db96864f2b00/ffmpeg.c/#L4042
d2a_code_trace_data_45433
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, CERT *c) { uint32_t alg_mkey, alg_auth, alg_enc, alg_mac, algo_strength; int min_tls; const char *l, *buf; int j, multi, found, rule, retval, ok, buflen; uint32_t cipher_id = 0; char ch; retval = 1; l = rule_str; for ( ; ; ) { ch = *l; if (ch == '\0') break; if (ch == '-') { rule = CIPHER_DEL; l++; } else if (ch == '+') { rule = CIPHER_ORD; l++; } else if (ch == '!') { rule = CIPHER_KILL; l++; } else if (ch == '@') { rule = CIPHER_SPECIAL; l++; } else { rule = CIPHER_ADD; } if (ITEM_SEP(ch)) { l++; continue; } alg_mkey = 0; alg_auth = 0; alg_enc = 0; alg_mac = 0; min_tls = 0; algo_strength = 0; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while (((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.') || (ch == '=')) #else while (isalnum((unsigned char)ch) || (ch == '-') || (ch == '.') || (ch == '=')) #endif { ch = *(++l); buflen++; } if (buflen == 0) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); retval = found = 0; l++; break; } if (rule == CIPHER_SPECIAL) { found = 0; break; } if (ch == '+') { multi = 1; l++; } else { multi = 0; } j = found = 0; cipher_id = 0; while (ca_list[j]) { if (strncmp(buf, ca_list[j]->name, buflen) == 0 && (ca_list[j]->name[buflen] == '\0')) { found = 1; break; } else j++; } if (!found) break; if (ca_list[j]->algorithm_mkey) { if (alg_mkey) { alg_mkey &= ca_list[j]->algorithm_mkey; if (!alg_mkey) { found = 0; break; } } else { alg_mkey = ca_list[j]->algorithm_mkey; } } if (ca_list[j]->algorithm_auth) { if (alg_auth) { alg_auth &= ca_list[j]->algorithm_auth; if (!alg_auth) { found = 0; break; } } else { alg_auth = ca_list[j]->algorithm_auth; } } if (ca_list[j]->algorithm_enc) { if (alg_enc) { alg_enc &= ca_list[j]->algorithm_enc; if (!alg_enc) { found = 0; break; } } else { alg_enc = ca_list[j]->algorithm_enc; } } if (ca_list[j]->algorithm_mac) { if (alg_mac) { alg_mac &= ca_list[j]->algorithm_mac; if (!alg_mac) { found = 0; break; } } else { alg_mac = ca_list[j]->algorithm_mac; } } if (ca_list[j]->algo_strength & SSL_STRONG_MASK) { if (algo_strength & SSL_STRONG_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~SSL_STRONG_MASK; if (!(algo_strength & SSL_STRONG_MASK)) { found = 0; break; } } else { algo_strength = ca_list[j]->algo_strength & SSL_STRONG_MASK; } } if (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) { if (algo_strength & SSL_DEFAULT_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) | ~SSL_DEFAULT_MASK; if (!(algo_strength & SSL_DEFAULT_MASK)) { found = 0; break; } } else { algo_strength |= ca_list[j]->algo_strength & SSL_DEFAULT_MASK; } } if (ca_list[j]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->min_tls) { if (min_tls != 0 && min_tls != ca_list[j]->min_tls) { found = 0; break; } else { min_tls = ca_list[j]->min_tls; } } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && strncmp(buf, "STRENGTH", 8) == 0) { ok = ssl_cipher_strength_sort(head_p, tail_p); } else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { int level = buf[9] - '0'; if (level < 0 || level > 5) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } else { c->sec_level = level; ok = 1; } } else { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } if (ok == 0) retval = 0; while ((*l != '\0') && !ITEM_SEP(*l)) l++; } else if (found) { ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return retval; } test/sslapitest.c:282: error: BUFFER_OVERRUN_L1 Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 4 by call to `SSL_CTX_set_cipher_list`. Showing all 13 steps of the trace test/sslapitest.c:282:10: Call 280. 281. /* We also want to ensure that we use RSA-based key exchange. */ 282. if (!TEST_true(SSL_CTX_set_cipher_list(cctx, "RSA"))) ^ 283. goto end; 284. ssl/ssl_lib.c:2527:1: Parameter `*str` 2525. 2526. /** specify the ciphers to be used by default by the SSL_CTX */ 2527. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2528. { 2529. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2531:10: Call 2529. STACK_OF(SSL_CIPHER) *sk; 2530. 2531. sk = ssl_create_cipher_list(ctx->method, ctx->tls13_ciphersuites, ^ 2532. &ctx->cipher_list, &ctx->cipher_list_by_id, str, 2533. ctx->cert); ssl/ssl_ciph.c:1277:1: Parameter `*rule_str` 1275. #endif 1276. 1277. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, 1278. STACK_OF(SSL_CIPHER) *tls13_ciphersuites, 1279. STACK_OF(SSL_CIPHER) **cipher_list, ssl/ssl_ciph.c:1297:10: Call 1295. return NULL; 1296. #ifndef OPENSSL_NO_EC 1297. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1298. return NULL; 1299. #endif ssl/ssl_ciph.c:1222:1: Parameter `**prule_str` 1220. 1221. #ifndef OPENSSL_NO_EC 1222. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1223. const char **prule_str) 1224. { ssl/ssl_ciph.c:1446:5: Assignment 1444. */ 1445. ok = 1; 1446. rule_p = rule_str; ^ 1447. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1448. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1456:14: Call 1454. 1455. if (ok && (strlen(rule_p) > 0)) 1456. ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); ^ 1457. 1458. OPENSSL_free(ca_list); /* Not needed anymore */ ssl/ssl_ciph.c:957:1: <Length trace> 955. } 956. 957. > static int ssl_cipher_process_rulestr(const char *rule_str, 958. CIPHER_ORDER **head_p, 959. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:957:1: Parameter `*rule_str` 955. } 956. 957. > static int ssl_cipher_process_rulestr(const char *rule_str, 958. CIPHER_ORDER **head_p, 959. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:970:5: Assignment 968. 969. retval = 1; 970. l = rule_str; ^ 971. for ( ; ; ) { 972. ch = *l; ssl/ssl_ciph.c:1006:13: Assignment 1004. for (;;) { 1005. ch = *l; 1006. buf = l; ^ 1007. buflen = 0; 1008. #ifndef CHARSET_EBCDIC ssl/ssl_ciph.c:1184:29: Array access: Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 4 by call to `SSL_CTX_set_cipher_list` 1182. ok = ssl_cipher_strength_sort(head_p, tail_p); 1183. } else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { 1184. int level = buf[9] - '0'; ^ 1185. if (level < 0 || level > 5) { 1186. SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
https://github.com/openssl/openssl/blob/2b527b9b3233eb312a4bf17b044660aa213883b6/ssl/ssl_ciph.c/#L1184
d2a_code_trace_data_45434
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:1160: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1160:9: 1158. if (s->first_slice_line) { 1159. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1160. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, ^ 1161. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1162. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1160
d2a_code_trace_data_45435
static void put_audio_specific_config(AVCodecContext *avctx) { PutBitContext pb; AACEncContext *s = avctx->priv_data; init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); put_bits(&pb, 5, 2); put_bits(&pb, 4, s->samplerate_index); put_bits(&pb, 4, avctx->channels); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 11, 0x2b7); put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 1, 0); flush_put_bits(&pb); } libavcodec/aacenc.c:158: error: Null Dereference pointer `&pb->buf_ptr` last assigned on line 147 could be null and is dereferenced by call to `put_bits()` at line 158, column 5. libavcodec/aacenc.c:142:1: start of procedure put_audio_specific_config() 140. * @see 1.6.2.1 "Syntax - AudioSpecificConfig" 141. */ 142. static void put_audio_specific_config(AVCodecContext *avctx) ^ 143. { 144. PutBitContext pb; libavcodec/aacenc.c:145:5: 143. { 144. PutBitContext pb; 145. AACEncContext *s = avctx->priv_data; ^ 146. 147. init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); libavcodec/aacenc.c:147:5: 145. AACEncContext *s = avctx->priv_data; 146. 147. init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); ^ 148. put_bits(&pb, 5, 2); //object type - AAC-LC 149. put_bits(&pb, 4, s->samplerate_index); //sample rate index libavcodec/put_bits.h:60:1: start of procedure init_put_bits() 58. * @param buffer_size the size in bytes of buffer 59. */ 60. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) ^ 61. { 62. if(buffer_size < 0) { libavcodec/put_bits.h:62:8: Taking true branch 60. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) 61. { 62. if(buffer_size < 0) { ^ 63. buffer_size = 0; 64. buffer = NULL; libavcodec/put_bits.h:63:9: 61. { 62. if(buffer_size < 0) { 63. buffer_size = 0; ^ 64. buffer = NULL; 65. } libavcodec/put_bits.h:64:9: 62. if(buffer_size < 0) { 63. buffer_size = 0; 64. buffer = NULL; ^ 65. } 66. libavcodec/put_bits.h:67:5: 65. } 66. 67. s->size_in_bits= 8*buffer_size; ^ 68. s->buf = buffer; 69. s->buf_end = s->buf + buffer_size; libavcodec/put_bits.h:68:5: 66. 67. s->size_in_bits= 8*buffer_size; 68. s->buf = buffer; ^ 69. s->buf_end = s->buf + buffer_size; 70. #ifdef ALT_BITSTREAM_WRITER libavcodec/put_bits.h:69:5: 67. s->size_in_bits= 8*buffer_size; 68. s->buf = buffer; 69. s->buf_end = s->buf + buffer_size; ^ 70. #ifdef ALT_BITSTREAM_WRITER 71. s->index=0; libavcodec/put_bits.h:75:5: 73. // memset(buffer, 0, buffer_size); 74. #else 75. s->buf_ptr = s->buf; ^ 76. s->bit_left=32; 77. s->bit_buf=0; libavcodec/put_bits.h:76:5: 74. #else 75. s->buf_ptr = s->buf; 76. s->bit_left=32; ^ 77. s->bit_buf=0; 78. #endif libavcodec/put_bits.h:77:5: 75. s->buf_ptr = s->buf; 76. s->bit_left=32; 77. s->bit_buf=0; ^ 78. #endif 79. } libavcodec/put_bits.h:79:1: return from a call to init_put_bits 77. s->bit_buf=0; 78. #endif 79. } ^ 80. 81. /** libavcodec/aacenc.c:148:5: 146. 147. init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); 148. put_bits(&pb, 5, 2); //object type - AAC-LC ^ 149. put_bits(&pb, 4, s->samplerate_index); //sample rate index 150. put_bits(&pb, 4, avctx->channels); libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:149:5: 147. init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); 148. put_bits(&pb, 5, 2); //object type - AAC-LC 149. put_bits(&pb, 4, s->samplerate_index); //sample rate index ^ 150. put_bits(&pb, 4, avctx->channels); 151. //GASpecificConfig libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:150:5: 148. put_bits(&pb, 5, 2); //object type - AAC-LC 149. put_bits(&pb, 4, s->samplerate_index); //sample rate index 150. put_bits(&pb, 4, avctx->channels); ^ 151. //GASpecificConfig 152. put_bits(&pb, 1, 0); //frame length - 1024 samples libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:152:5: 150. put_bits(&pb, 4, avctx->channels); 151. //GASpecificConfig 152. put_bits(&pb, 1, 0); //frame length - 1024 samples ^ 153. put_bits(&pb, 1, 0); //does not depend on core coder 154. put_bits(&pb, 1, 0); //is not extension libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:153:5: 151. //GASpecificConfig 152. put_bits(&pb, 1, 0); //frame length - 1024 samples 153. put_bits(&pb, 1, 0); //does not depend on core coder ^ 154. put_bits(&pb, 1, 0); //is not extension 155. libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:154:5: 152. put_bits(&pb, 1, 0); //frame length - 1024 samples 153. put_bits(&pb, 1, 0); //does not depend on core coder 154. put_bits(&pb, 1, 0); //is not extension ^ 155. 156. //Explicitly Mark SBR absent libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:157:5: 155. 156. //Explicitly Mark SBR absent 157. put_bits(&pb, 11, 0x2b7); //sync extension ^ 158. put_bits(&pb, 5, AOT_SBR); 159. put_bits(&pb, 1, 0); libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking true branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:179:9: 177. #else 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; ^ 180. bit_left-=n; 181. } else { libavcodec/put_bits.h:180:9: 178. if (n < bit_left) { 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; ^ 181. } else { 182. bit_buf<<=bit_left; libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. { libavcodec/aacenc.c:158:5: 156. //Explicitly Mark SBR absent 157. put_bits(&pb, 11, 0x2b7); //sync extension 158. put_bits(&pb, 5, AOT_SBR); ^ 159. put_bits(&pb, 1, 0); 160. flush_put_bits(&pb); libavcodec/put_bits.h:149:1: start of procedure put_bits() 147. * Use put_bits32 to write 32 bits. 148. */ 149. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 150. #ifndef ALT_BITSTREAM_WRITER 151. { libavcodec/put_bits.h:156:5: 154. 155. // printf("put_bits=%d %x\n", n, value); 156. assert(n <= 31 && value < (1U << n)); ^ 157. 158. bit_buf = s->bit_buf; libavcodec/put_bits.h:158:5: 156. assert(n <= 31 && value < (1U << n)); 157. 158. bit_buf = s->bit_buf; ^ 159. bit_left = s->bit_left; 160. libavcodec/put_bits.h:159:5: 157. 158. bit_buf = s->bit_buf; 159. bit_left = s->bit_left; ^ 160. 161. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:178:9: Taking false branch 176. bit_left-=n; 177. #else 178. if (n < bit_left) { ^ 179. bit_buf = (bit_buf<<n) | value; 180. bit_left-=n; libavcodec/put_bits.h:182:9: 180. bit_left-=n; 181. } else { 182. bit_buf<<=bit_left; ^ 183. bit_buf |= value >> (n - bit_left); 184. #if !HAVE_FAST_UNALIGNED libavcodec/put_bits.h:183:9: 181. } else { 182. bit_buf<<=bit_left; 183. bit_buf |= value >> (n - bit_left); ^ 184. #if !HAVE_FAST_UNALIGNED 185. if (3 & (intptr_t) s->buf_ptr) { libavcodec/put_bits.h:185:13: Taking false branch 183. bit_buf |= value >> (n - bit_left); 184. #if !HAVE_FAST_UNALIGNED 185. if (3 & (intptr_t) s->buf_ptr) { ^ 186. AV_WB32(s->buf_ptr, bit_buf); 187. } else libavcodec/put_bits.h:189:9: 187. } else 188. #endif 189. *(uint32_t *)s->buf_ptr = av_be2ne32(bit_buf); ^ 190. //printf("bitbuf = %08x\n", bit_buf); 191. s->buf_ptr+=4; libavutil/bswap.h:66:1: start of procedure av_bswap32() 64. 65. #ifndef av_bswap32 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) ^ 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); libavutil/bswap.h:68:5: 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); ^ 69. x= (x>>16) | (x<<16); 70. return x; libavutil/bswap.h:69:5: 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); ^ 70. return x; 71. } libavutil/bswap.h:70:5: 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); 70. return x; ^ 71. } 72. #endif libavutil/bswap.h:71:1: return from a call to av_bswap32 69. x= (x>>16) | (x<<16); 70. return x; 71. } ^ 72. #endif 73. libavcodec/put_bits.h:191:9: 189. *(uint32_t *)s->buf_ptr = av_be2ne32(bit_buf); 190. //printf("bitbuf = %08x\n", bit_buf); 191. s->buf_ptr+=4; ^ 192. bit_left+=32 - n; 193. bit_buf = value; libavcodec/put_bits.h:192:9: 190. //printf("bitbuf = %08x\n", bit_buf); 191. s->buf_ptr+=4; 192. bit_left+=32 - n; ^ 193. bit_buf = value; 194. } libavcodec/put_bits.h:193:9: 191. s->buf_ptr+=4; 192. bit_left+=32 - n; 193. bit_buf = value; ^ 194. } 195. #endif libavcodec/put_bits.h:197:5: 195. #endif 196. 197. s->bit_buf = bit_buf; ^ 198. s->bit_left = bit_left; 199. } libavcodec/put_bits.h:198:5: 196. 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; ^ 199. } 200. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:199:1: return from a call to put_bits 197. s->bit_buf = bit_buf; 198. s->bit_left = bit_left; 199. } ^ 200. #else /* ALT_BITSTREAM_WRITER defined */ 201. {
https://github.com/libav/libav/blob/6a9c85944427e3c4355bce67d7f677ec69527bff/libavcodec/aacenc.c/#L158
d2a_code_trace_data_45436
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/t1_reneg.c:57: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 6]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_reneg.c:56:17: Call 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) 56. || !WPACKET_start_sub_packet_u16(pkt) ^ 57. || !WPACKET_start_sub_packet_u8(pkt) 58. || !WPACKET_memcpy(pkt, s->s3->previous_client_finished, ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/t1_reneg.c:57:17: Call 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) 56. || !WPACKET_start_sub_packet_u16(pkt) 57. || !WPACKET_start_sub_packet_u8(pkt) ^ 58. || !WPACKET_memcpy(pkt, s->s3->previous_client_finished, 59. s->s3->previous_client_finished_len) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 6]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_45437
size_t ssl3_final_finish_mac(SSL *s, const char *sender, size_t len, unsigned char *p) { int ret; EVP_MD_CTX *ctx = NULL; if (!ssl3_digest_cached_records(s, 0)) { return 0; } if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, SSL_R_NO_REQUIRED_DIGEST); return 0; } ctx = EVP_MD_CTX_new(); if (ctx == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, ERR_R_MALLOC_FAILURE); return 0; } if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, ERR_R_INTERNAL_ERROR); return 0; } ret = EVP_MD_CTX_size(ctx); if (ret < 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, ERR_R_INTERNAL_ERROR); EVP_MD_CTX_reset(ctx); return 0; } if ((sender != NULL && EVP_DigestUpdate(ctx, sender, len) <= 0) || EVP_MD_CTX_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET, (int)s->session->master_key_length, s->session->master_key) <= 0 || EVP_DigestFinal_ex(ctx, p, NULL) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, ERR_R_INTERNAL_ERROR); ret = 0; } EVP_MD_CTX_free(ctx); return ret; } ssl/s3_enc.c:444: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 437, column 11 is not reachable after line 444, column 9. Showing all 61 steps of the trace ssl/s3_enc.c:420:1: start of procedure ssl3_final_finish_mac() 418. } 419. 420. > size_t ssl3_final_finish_mac(SSL *s, const char *sender, size_t len, 421. unsigned char *p) 422. { ssl/s3_enc.c:424:5: 422. { 423. int ret; 424. > EVP_MD_CTX *ctx = NULL; 425. 426. if (!ssl3_digest_cached_records(s, 0)) { ssl/s3_enc.c:426:10: 424. EVP_MD_CTX *ctx = NULL; 425. 426. > if (!ssl3_digest_cached_records(s, 0)) { 427. /* SSLfatal() already called */ 428. return 0; test/tls13secretstest.c:145:1: start of procedure ssl3_digest_cached_records() 143. 144. /* Mocked out implementations of various functions */ 145. > int ssl3_digest_cached_records(SSL *s, int keep) 146. { 147. return 1; test/tls13secretstest.c:147:5: 145. int ssl3_digest_cached_records(SSL *s, int keep) 146. { 147. > return 1; 148. } 149. test/tls13secretstest.c:148:1: return from a call to ssl3_digest_cached_records 146. { 147. return 1; 148. > } 149. 150. static int full_hash = 0; ssl/s3_enc.c:426:10: Taking false branch 424. EVP_MD_CTX *ctx = NULL; 425. 426. if (!ssl3_digest_cached_records(s, 0)) { ^ 427. /* SSLfatal() already called */ 428. return 0; ssl/s3_enc.c:431:9: 429. } 430. 431. > if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) { 432. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, 433. SSL_R_NO_REQUIRED_DIGEST); crypto/evp/evp_lib.c:439:1: start of procedure EVP_MD_CTX_md() 437. } 438. 439. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) 440. { 441. if (!ctx) crypto/evp/evp_lib.c:441:10: Taking false branch 439. const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) 440. { 441. if (!ctx) ^ 442. return NULL; 443. return ctx->digest; crypto/evp/evp_lib.c:443:5: 441. if (!ctx) 442. return NULL; 443. > return ctx->digest; 444. } 445. crypto/evp/evp_lib.c:444:1: return from a call to EVP_MD_CTX_md 442. return NULL; 443. return ctx->digest; 444. > } 445. 446. EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx) crypto/evp/evp_lib.c:291:1: start of procedure EVP_MD_type() 289. } 290. 291. > int EVP_MD_type(const EVP_MD *md) 292. { 293. return md->type; crypto/evp/evp_lib.c:293:5: 291. int EVP_MD_type(const EVP_MD *md) 292. { 293. > return md->type; 294. } 295. crypto/evp/evp_lib.c:294:1: return from a call to EVP_MD_type 292. { 293. return md->type; 294. > } 295. 296. int EVP_MD_pkey_type(const EVP_MD *md) ssl/s3_enc.c:431:9: Taking false branch 429. } 430. 431. if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) { ^ 432. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, 433. SSL_R_NO_REQUIRED_DIGEST); ssl/s3_enc.c:437:5: 435. } 436. 437. > ctx = EVP_MD_CTX_new(); 438. if (ctx == NULL) { 439. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking false branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/s3_enc.c:438:9: Taking false branch 436. 437. ctx = EVP_MD_CTX_new(); 438. if (ctx == NULL) { ^ 439. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, 440. ERR_R_MALLOC_FAILURE); ssl/s3_enc.c:443:10: 441. return 0; 442. } 443. > if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) { 444. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, 445. ERR_R_INTERNAL_ERROR); crypto/evp/digest.c:204:1: start of procedure EVP_MD_CTX_copy_ex() 202. } 203. 204. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) 205. { 206. unsigned char *tmp_buf; crypto/evp/digest.c:207:10: Taking false branch 205. { 206. unsigned char *tmp_buf; 207. if ((in == NULL) || (in->digest == NULL)) { ^ 208. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED); 209. return 0; crypto/evp/digest.c:207:26: Taking false branch 205. { 206. unsigned char *tmp_buf; 207. if ((in == NULL) || (in->digest == NULL)) { ^ 208. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED); 209. return 0; crypto/evp/digest.c:213:9: Taking true branch 211. #ifndef OPENSSL_NO_ENGINE 212. /* Make sure it's safe to copy a digest context using an ENGINE */ 213. if (in->engine && !ENGINE_init(in->engine)) { ^ 214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB); 215. return 0; crypto/evp/digest.c:213:24: 211. #ifndef OPENSSL_NO_ENGINE 212. /* Make sure it's safe to copy a digest context using an ENGINE */ 213. > if (in->engine && !ENGINE_init(in->engine)) { 214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB); 215. return 0; crypto/engine/eng_init.c:77:1: start of procedure ENGINE_init() 75. 76. /* The API (locked) version of "init" */ 77. > int ENGINE_init(ENGINE *e) 78. { 79. int ret; crypto/engine/eng_init.c:80:9: Taking false branch 78. { 79. int ret; 80. if (e == NULL) { ^ 81. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER); 82. return 0; crypto/engine/eng_init.c:84:10: 82. return 0; 83. } 84. > if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) { 85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE); 86. return 0; crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking true branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:108:9: 106. { 107. if (pthread_once(once, init) != 0) 108. > return 0; 109. 110. return 1; crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/engine/eng_init.c:84:10: Condition is false 82. return 0; 83. } 84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) { ^ 85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE); 86. return 0; crypto/engine/eng_init.c:84:10: Taking true branch 82. return 0; 83. } 84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) { ^ 85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE); 86. return 0; crypto/engine/eng_init.c:85:9: Skipping ERR_put_error(): empty list of specs 83. } 84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) { 85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE); ^ 86. return 0; 87. } crypto/engine/eng_init.c:86:9: 84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) { 85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE); 86. > return 0; 87. } 88. CRYPTO_THREAD_write_lock(global_engine_lock); crypto/engine/eng_init.c:92:1: return from a call to ENGINE_init 90. CRYPTO_THREAD_unlock(global_engine_lock); 91. return ret; 92. > } 93. 94. /* The API (locked) version of "finish" */ crypto/evp/digest.c:213:24: Taking true branch 211. #ifndef OPENSSL_NO_ENGINE 212. /* Make sure it's safe to copy a digest context using an ENGINE */ 213. if (in->engine && !ENGINE_init(in->engine)) { ^ 214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB); 215. return 0; crypto/evp/digest.c:214:9: Skipping ERR_put_error(): empty list of specs 212. /* Make sure it's safe to copy a digest context using an ENGINE */ 213. if (in->engine && !ENGINE_init(in->engine)) { 214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB); ^ 215. return 0; 216. } crypto/evp/digest.c:215:9: 213. if (in->engine && !ENGINE_init(in->engine)) { 214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB); 215. > return 0; 216. } 217. #endif crypto/evp/digest.c:261:1: return from a call to EVP_MD_CTX_copy_ex 259. 260. return 1; 261. > } 262. 263. int EVP_Digest(const void *data, size_t count, ssl/s3_enc.c:443:10: Taking true branch 441. return 0; 442. } 443. if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) { ^ 444. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, 445. ERR_R_INTERNAL_ERROR); ssl/s3_enc.c:444:9: 442. } 443. if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) { 444. > SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC, 445. ERR_R_INTERNAL_ERROR); 446. return 0;
https://github.com/openssl/openssl/blob/f39276fdff6ccc1c71bdb30a8050fa1c0bf6e20a/ssl/s3_enc.c/#L444
d2a_code_trace_data_45438
MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) { EVP_PKEY *pkey = NULL; unsigned char *sig, *data; int al, ret = MSG_PROCESS_ERROR; int type = 0, j; unsigned int len; X509 *peer; const EVP_MD *md = NULL; long hdatalen = 0; void *hdata; EVP_MD_CTX *mctx = EVP_MD_CTX_new(); if (mctx == NULL) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE); al = SSL_AD_INTERNAL_ERROR; goto f_err; } peer = s->session->peer; pkey = X509_get0_pubkey(peer); type = X509_certificate_type(peer, pkey); if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al = SSL_AD_ILLEGAL_PARAMETER; goto f_err; } #ifndef OPENSSL_NO_GOST if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { len = 64; } else #endif { if (SSL_USE_SIGALGS(s)) { int rv; if (!PACKET_get_bytes(pkt, &sig, 2)) { al = SSL_AD_DECODE_ERROR; goto f_err; } rv = tls12_check_peer_sigalg(&md, s, sig, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif } else { int idx = ssl_cert_type(NULL, pkey); if (idx >= 0) md = s->s3->tmp.md[idx]; if (md == NULL) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } } if (!PACKET_get_net_2(pkt, &len)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } } j = EVP_PKEY_size(pkey); if (((int)len > j) || ((int)PACKET_remaining(pkt) > j) || (PACKET_remaining(pkt) == 0)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE); al = SSL_AD_DECODE_ERROR; goto f_err; } if (!PACKET_get_bytes(pkt, &data, len)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using client verify alg %s\n", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(mctx, md, NULL) || !EVP_VerifyUpdate(mctx, hdata, hdatalen)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB); al = SSL_AD_INTERNAL_ERROR; goto f_err; } #ifndef OPENSSL_NO_GOST if (pkey->type == NID_id_GostR3410_2001 || pkey->type == NID_id_GostR3410_2012_256 || pkey->type == NID_id_GostR3410_2012_512) { BUF_reverse(data, NULL, len); } #endif if (s->version == SSL3_VERSION && !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET, s->session->master_key_length, s->session->master_key)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB); al = SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(mctx, data, len, pkey) <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_SIGNATURE); goto f_err; } ret = MSG_PROCESS_CONTINUE_PROCESSING; if (0) { f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); ossl_statem_set_error(s); } BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; EVP_MD_CTX_free(mctx); return ret; } ssl/statem/statem_srvr.c:2685: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 2669 could be null and is dereferenced at line 2685, column 40. Showing all 51 steps of the trace ssl/statem/statem_srvr.c:2648:1: start of procedure tls_process_cert_verify() 2646. } 2647. 2648. > MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 2649. { 2650. EVP_PKEY *pkey = NULL; ssl/statem/statem_srvr.c:2650:5: 2648. MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 2649. { 2650. > EVP_PKEY *pkey = NULL; 2651. unsigned char *sig, *data; 2652. int al, ret = MSG_PROCESS_ERROR; ssl/statem/statem_srvr.c:2652:5: 2650. EVP_PKEY *pkey = NULL; 2651. unsigned char *sig, *data; 2652. > int al, ret = MSG_PROCESS_ERROR; 2653. int type = 0, j; 2654. unsigned int len; ssl/statem/statem_srvr.c:2653:5: 2651. unsigned char *sig, *data; 2652. int al, ret = MSG_PROCESS_ERROR; 2653. > int type = 0, j; 2654. unsigned int len; 2655. X509 *peer; ssl/statem/statem_srvr.c:2656:5: 2654. unsigned int len; 2655. X509 *peer; 2656. > const EVP_MD *md = NULL; 2657. long hdatalen = 0; 2658. void *hdata; ssl/statem/statem_srvr.c:2657:5: 2655. X509 *peer; 2656. const EVP_MD *md = NULL; 2657. > long hdatalen = 0; 2658. void *hdata; 2659. ssl/statem/statem_srvr.c:2660:5: 2658. void *hdata; 2659. 2660. > EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 2661. 2662. if (mctx == NULL) { crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new() 151. } 152. 153. > EVP_MD_CTX *EVP_MD_CTX_new(void) 154. { 155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:155:5: 153. EVP_MD_CTX *EVP_MD_CTX_new(void) 154. { 155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 156. } 157. 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/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new 154. { 155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 156. > } 157. 158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/statem/statem_srvr.c:2662:9: Taking false branch 2660. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 2661. 2662. if (mctx == NULL) { ^ 2663. SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE); 2664. al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_srvr.c:2668:5: 2666. } 2667. 2668. > peer = s->session->peer; 2669. pkey = X509_get0_pubkey(peer); 2670. type = X509_certificate_type(peer, pkey); ssl/statem/statem_srvr.c:2669:5: 2667. 2668. peer = s->session->peer; 2669. > pkey = X509_get0_pubkey(peer); 2670. type = X509_certificate_type(peer, pkey); 2671. crypto/x509/x509_cmp.c:308:1: start of procedure X509_get0_pubkey() 306. } 307. 308. > EVP_PKEY *X509_get0_pubkey(X509 *x) 309. { 310. if (x == NULL) crypto/x509/x509_cmp.c:310:9: Taking false branch 308. EVP_PKEY *X509_get0_pubkey(X509 *x) 309. { 310. if (x == NULL) ^ 311. return NULL; 312. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:312:5: 310. if (x == NULL) 311. return NULL; 312. > return X509_PUBKEY_get0(x->cert_info.key); 313. } 314. crypto/asn1/x_pubkey.c:124:1: start of procedure X509_PUBKEY_get0() 122. } 123. 124. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 125. { 126. EVP_PKEY *ret = NULL; crypto/asn1/x_pubkey.c:126:5: 124. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 125. { 126. > EVP_PKEY *ret = NULL; 127. 128. if (key == NULL) crypto/asn1/x_pubkey.c:128:9: Taking true branch 126. EVP_PKEY *ret = NULL; 127. 128. if (key == NULL) ^ 129. goto error; 130. crypto/asn1/x_pubkey.c:170:2: 168. return ret; 169. 170. > error: 171. EVP_PKEY_free(ret); 172. return (NULL); crypto/asn1/x_pubkey.c:171:5: 169. 170. error: 171. > EVP_PKEY_free(ret); 172. return (NULL); 173. } crypto/evp/p_lib.c:420:1: start of procedure EVP_PKEY_free() 418. } 419. 420. > void EVP_PKEY_free(EVP_PKEY *x) 421. { 422. int i; crypto/evp/p_lib.c:424:9: Taking true branch 422. int i; 423. 424. if (x == NULL) ^ 425. return; 426. crypto/evp/p_lib.c:425:9: 423. 424. if (x == NULL) 425. > return; 426. 427. i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_EVP_PKEY); crypto/evp/p_lib.c:442:1: return from a call to EVP_PKEY_free 440. sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); 441. OPENSSL_free(x); 442. > } 443. 444. static void EVP_PKEY_free_it(EVP_PKEY *x) crypto/asn1/x_pubkey.c:172:5: 170. error: 171. EVP_PKEY_free(ret); 172. > return (NULL); 173. } 174. crypto/asn1/x_pubkey.c:173:1: return from a call to X509_PUBKEY_get0 171. EVP_PKEY_free(ret); 172. return (NULL); 173. > } 174. 175. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:313:1: return from a call to X509_get0_pubkey 311. return NULL; 312. return X509_PUBKEY_get0(x->cert_info.key); 313. > } 314. 315. EVP_PKEY *X509_get_pubkey(X509 *x) ssl/statem/statem_srvr.c:2670:5: Skipping X509_certificate_type(): empty list of specs 2668. peer = s->session->peer; 2669. pkey = X509_get0_pubkey(peer); 2670. type = X509_certificate_type(peer, pkey); ^ 2671. 2672. if (!(type & EVP_PKT_SIGN)) { ssl/statem/statem_srvr.c:2672:11: Taking false branch 2670. type = X509_certificate_type(peer, pkey); 2671. 2672. if (!(type & EVP_PKT_SIGN)) { ^ 2673. SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, 2674. SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/statem/statem_srvr.c:2685:9: 2683. */ 2684. #ifndef OPENSSL_NO_GOST 2685. > if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { 2686. len = 64; 2687. } else ssl/packet_locl.h:91:1: start of procedure PACKET_remaining() 89. * Returns the number of bytes remaining to be read in the PACKET 90. */ 91. > static ossl_inline size_t PACKET_remaining(const PACKET *pkt) 92. { 93. return pkt->remaining; ssl/packet_locl.h:93:5: 91. static ossl_inline size_t PACKET_remaining(const PACKET *pkt) 92. { 93. > return pkt->remaining; 94. } 95. ssl/packet_locl.h:94:1: return from a call to PACKET_remaining 92. { 93. return pkt->remaining; 94. > } 95. 96. /* ssl/statem/statem_srvr.c:2685:9: Taking true branch 2683. */ 2684. #ifndef OPENSSL_NO_GOST 2685. if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { ^ 2686. len = 64; 2687. } else ssl/statem/statem_srvr.c:2685:40: 2683. */ 2684. #ifndef OPENSSL_NO_GOST 2685. > if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { 2686. len = 64; 2687. } else
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/statem/statem_srvr.c/#L2685
d2a_code_trace_data_45439
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:930: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:930:13: 928. 929. //check(x + dia_size - dir, y - dir,0, a1) 930. CHECK_MV(x + dia_size - dir, y - dir ); ^ 931. } 932.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L930
d2a_code_trace_data_45440
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/srptest.c:177: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 30 steps of the trace test/srptest.c:177:10: Call 175. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 176. /* Set up server's password entry */ 177. if (!TEST_true(SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 178. GN->g))) 179. goto err; crypto/srp/srp_vfy.c:633:1: Parameter `N->top` 631. * BIGNUMS. 632. */ 633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 634. BIGNUM **verifier, const BIGNUM *N, 635. const BIGNUM *g) crypto/srp/srp_vfy.c:664:10: Call 662. goto err; 663. 664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 665. BN_clear_free(*verifier); 666. goto err; crypto/bn/bn_exp.c:91:1: Parameter `m->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:136:9: Call 134. 135. #ifdef MONT_MUL_MOD 136. if (BN_is_odd(m)) { ^ 137. # ifdef MONT_EXP_WORD 138. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `m->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:737:14: Assignment 735. /* 2^(top*BN_BITS2) - m */ 736. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 737. for (i = 1; i < top; i++) ^ 738. tmp.d[i] = (~m->d[i]) & BN_MASK2; 739. tmp.top = top; crypto/bn/bn_exp.c:1036:14: Call 1034. for (wvalue = 0, i = bits % window; i >= 0; i--, bits--) 1035. wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); 1036. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1037. window)) 1038. goto err; crypto/bn/bn_exp.c:518:1: Parameter `top` 516. } 517. 518. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 519. unsigned char *buf, int idx, 520. int window) crypto/bn/bn_exp.c:575:5: Assignment 573. } 574. 575. b->top = top; ^ 576. bn_correct_top(b); 577. return 1; crypto/bn/bn_exp.c:576:5: Call 574. 575. b->top = top; 576. bn_correct_top(b); ^ 577. return 1; 578. } crypto/bn/bn_lib.c:953:1: Parameter `a->top` 951. } 952. 953. > void bn_correct_top(BIGNUM *a) 954. { 955. BN_ULONG *ftl; crypto/bn/bn_exp.c:1049:22: Call 1047. /* Scan the window, squaring the result as we go */ 1048. for (i = 0; i < window; i++, bits--) { 1049. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1050. goto err; 1051. wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_45441
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/bntest.c:1941: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_rand`. Showing all 19 steps of the trace test/bntest.c:1940:10: Call 1938. 1939. /* Test BN_rand for degenerate cases with |top| and |bottom| parameters. */ 1940. if (!TEST_false(BN_rand(bn, 0, 0 /* top */ , 0 /* bottom */ )) ^ 1941. || !TEST_false(BN_rand(bn, 0, 1 /* top */ , 1 /* bottom */ )) 1942. || !TEST_true(BN_rand(bn, 1, 0 /* top */ , 0 /* bottom */ )) 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. { test/bntest.c:1941:17: Call 1939. /* Test BN_rand for degenerate cases with |top| and |bottom| parameters. */ 1940. if (!TEST_false(BN_rand(bn, 0, 0 /* top */ , 0 /* bottom */ )) 1941. || !TEST_false(BN_rand(bn, 0, 1 /* top */ , 1 /* bottom */ )) ^ 1942. || !TEST_true(BN_rand(bn, 1, 0 /* top */ , 0 /* bottom */ )) 1943. || !TEST_BN_eq_one(bn) crypto/bn/bn_rand.c:106:1: Parameter `*rnd->d` 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->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:33:9: Call 31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 32. goto toosmall; 33. BN_zero(rnd); ^ 34. return 1; 35. } crypto/bn/bn_lib.c:361:1: Parameter `*a->d` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_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_45442
static void new_subtitle_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *subtitle_enc; 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, CODEC_TYPE_SUBTITLE); bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc = st->codec; subtitle_enc->codec_type = CODEC_TYPE_SUBTITLE; if (subtitle_stream_copy) { st->stream_copy = 1; } else { set_context_opts(avcodec_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM); subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 1); output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name); } nb_ocodecs++; if (subtitle_language) { av_metadata_set(&st->metadata, "language", subtitle_language); av_free(subtitle_language); subtitle_language = NULL; } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3204: error: Null Dereference pointer `st` last assigned on line 3199 could be null and is dereferenced at line 3204, column 35. ffmpeg.c:3194:1: start of procedure new_subtitle_stream() 3192. } 3193. 3194. static void new_subtitle_stream(AVFormatContext *oc) ^ 3195. { 3196. AVStream *st; ffmpeg.c:3199:5: 3197. AVCodecContext *subtitle_enc; 3198. 3199. st = av_new_stream(oc, oc->nb_streams); ^ 3200. if (!st) { 3201. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2344:1: start of procedure av_new_stream() 2342. } 2343. 2344. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2345. { 2346. AVStream *st; libavformat/utils.c:2349:9: Taking true branch 2347. int i; 2348. 2349. if (s->nb_streams >= MAX_STREAMS) ^ 2350. return NULL; 2351. libavformat/utils.c:2350:9: 2348. 2349. if (s->nb_streams >= MAX_STREAMS) 2350. return NULL; ^ 2351. 2352. st = av_mallocz(sizeof(AVStream)); libavformat/utils.c:2383:1: return from a call to av_new_stream 2381. s->streams[s->nb_streams++] = st; 2382. return st; 2383. } ^ 2384. 2385. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3200:10: Taking true branch 3198. 3199. st = av_new_stream(oc, oc->nb_streams); 3200. if (!st) { ^ 3201. fprintf(stderr, "Could not alloc stream\n"); 3202. av_exit(1); ffmpeg.c:3201:9: 3199. st = av_new_stream(oc, oc->nb_streams); 3200. if (!st) { 3201. fprintf(stderr, "Could not alloc stream\n"); ^ 3202. av_exit(1); 3203. } ffmpeg.c:3202:9: Skipping av_exit(): empty list of specs 3200. if (!st) { 3201. fprintf(stderr, "Could not alloc stream\n"); 3202. av_exit(1); ^ 3203. } 3204. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_SUBTITLE); ffmpeg.c:3204:5: 3202. av_exit(1); 3203. } 3204. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_SUBTITLE); ^ 3205. 3206. bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L3204
d2a_code_trace_data_45443
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; 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 (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); BUF_MEM_free(b); return (NULL); } apps/s_client.c:2586: 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_client.c:2586:17: Call 2584. BIO_printf(bio, "---\nCertificate chain\n"); 2585. for (i = 0; i < sk_X509_num(sk); i++) { 2586. X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, i)), ^ 2587. buf, sizeof buf); 2588. BIO_printf(bio, "%2d s:%s\n", i, buf); crypto/x509/x509_obj.c:66:1: <Offset trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `len` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: <Length trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `*buf` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:97:9: Array access: Offset added: [200, 8192] Size: [1, 2147483644] by call to `X509_NAME_oneline` 95. OPENSSL_free(b); 96. } 97. strncpy(buf, "NO X509_NAME", len); ^ 98. buf[len - 1] = '\0'; 99. return buf;
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97
d2a_code_trace_data_45444
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/ngx_http_file_cache.c:1283: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/ngx_http_file_cache.c:1283:9: Unknown value from: __errno_location 1281. 1282. if (ngx_delete_file(path->data) == NGX_FILE_ERROR) { 1283. ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno, ^ 1284. ngx_delete_file_n " \"%s\" failed", path->data); 1285. } src/http/ngx_http_file_cache.c:1283:9: Call 1281. 1282. if (ngx_delete_file(path->data) == NGX_FILE_ERROR) { 1283. ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno, ^ 1284. ngx_delete_file_n " \"%s\" failed", path->data); 1285. } src/core/ngx_log.c:67:1: Array declaration 65. #if (NGX_HAVE_VARIADIC_MACROS) 66. 67. void ^ 68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 69. const char *fmt, ...) src/core/ngx_log.c:88:5: Assignment 86. } 87. 88. last = errstr + NGX_MAX_ERROR_STR; ^ 89. 90. ngx_memcpy(errstr, ngx_cached_err_log_time.data, src/core/ngx_log.c:133:13: Call 131. ? " (%d: " : " (%Xd: ", err); 132. #else 133. p = ngx_snprintf(p, last - p, " (%d: ", err); ^ 134. #endif 135. src/core/ngx_string.c:109:1: Parameter `max` 107. 108. 109. u_char * ngx_cdecl ^ 110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) 111. { src/core/ngx_string.c:116:9: Call 114. 115. va_start(args, fmt); 116. p = ngx_vsnprintf(buf, max, fmt, args); ^ 117. va_end(args); 118. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_45445
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_gf2m.c:875: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr_arr`. Showing all 16 steps of the trace crypto/bn/bn_gf2m.c:851:1: Parameter `ctx->stack.depth` 849. * P1363. 850. */ 851. > int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 852. const int p[], BN_CTX *ctx) 853. { crypto/bn/bn_gf2m.c:866:5: Call 864. return (BN_copy(r, a) != NULL); 865. 866. BN_CTX_start(ctx); ^ 867. if ((u = BN_CTX_get(ctx)) == NULL) 868. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:867:14: Call 865. 866. BN_CTX_start(ctx); 867. if ((u = BN_CTX_get(ctx)) == NULL) ^ 868. goto err; 869. crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:875:14: Call 873. n = BN_num_bits(b) - 1; 874. for (i = n - 1; i >= 0; i--) { 875. if (!BN_GF2m_mod_sqr_arr(u, u, p, ctx)) ^ 876. goto err; 877. if (BN_is_bit_set(b, i)) { crypto/bn/bn_gf2m.c:496:5: Call 494. 495. bn_check_top(a); 496. BN_CTX_start(ctx); ^ 497. if ((s = BN_CTX_get(ctx)) == NULL) 498. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:514:5: Call 512. ret = 1; 513. err: 514. BN_CTX_end(ctx); ^ 515. return ret; 516. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr_arr` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45446
static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size) { uint32_t c=-1; int i; for(i=0; i<size-4 && c!=0x100; i++){ c = (c<<8) + buf[i]; if(c == 0x1B8 && sc->first_gop_closed == -1) sc->first_gop_closed= (buf[i+4]>>6)&1; } return (buf[i+1]>>3)&7; } libavformat/gxfenc.c:703: error: Integer Overflow L1 ([1099511627520, +oo] + `*buf`):unsigned32. libavformat/gxfenc.c:700:5: <LHS trace> 698. static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size) 699. { 700. uint32_t c=-1; ^ 701. int i; 702. for(i=0; i<size-4 && c!=0x100; i++){ libavformat/gxfenc.c:700:5: Assignment 698. static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size) 699. { 700. uint32_t c=-1; ^ 701. int i; 702. for(i=0; i<size-4 && c!=0x100; i++){ libavformat/gxfenc.c:698:1: <RHS trace> 696. } 697. 698. static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size) ^ 699. { 700. uint32_t c=-1; libavformat/gxfenc.c:698:1: Parameter `*buf` 696. } 697. 698. static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size) ^ 699. { 700. uint32_t c=-1; libavformat/gxfenc.c:703:9: Binary operation: ([1099511627520, +oo] + *buf):unsigned32 701. int i; 702. for(i=0; i<size-4 && c!=0x100; i++){ 703. c = (c<<8) + buf[i]; ^ 704. if(c == 0x1B8 && sc->first_gop_closed == -1) /* GOP start code */ 705. sc->first_gop_closed= (buf[i+4]>>6)&1;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/gxfenc.c/#L703
d2a_code_trace_data_45447
static int write_begin(URLContext *s) { RTMPContext *rt = s->priv_data; PutByteContext pbc; RTMPPacket spkt = { 0 }; int ret; if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, 0, 6)) < 0) { av_log(s, AV_LOG_ERROR, "Unable to create response packet\n"); return ret; } bytestream2_init_writer(&pbc, spkt.data, spkt.size); bytestream2_put_be16(&pbc, 0); bytestream2_put_be32(&pbc, rt->nb_streamid); ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size, &rt->prev_pkt[1], &rt->nb_prev_pkt[1]); ff_rtmp_packet_destroy(&spkt); return ret; } libavformat/rtmpproto.c:1843: error: Memory Leak memory dynamically allocated to `spkt.data` by call to `ff_rtmp_packet_create()` at line 1827, column 16 is not reachable after line 1843, column 1. libavformat/rtmpproto.c:1819:1: start of procedure write_begin() 1817. } 1818. 1819. static int write_begin(URLContext *s) ^ 1820. { 1821. RTMPContext *rt = s->priv_data; libavformat/rtmpproto.c:1821:5: 1819. static int write_begin(URLContext *s) 1820. { 1821. RTMPContext *rt = s->priv_data; ^ 1822. PutByteContext pbc; 1823. RTMPPacket spkt = { 0 }; libavformat/rtmpproto.c:1823:5: 1821. RTMPContext *rt = s->priv_data; 1822. PutByteContext pbc; 1823. RTMPPacket spkt = { 0 }; ^ 1824. int ret; 1825. libavformat/rtmpproto.c:1827:9: 1825. 1826. // Send Stream Begin 1 1827. if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL, ^ 1828. RTMP_PT_PING, 0, 6)) < 0) { 1829. av_log(s, AV_LOG_ERROR, "Unable to create response packet\n"); libavformat/rtmppkt.c:401:1: start of procedure ff_rtmp_packet_create() 399. } 400. 401. int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type, ^ 402. int timestamp, int size) 403. { libavformat/rtmppkt.c:404:9: Taking true branch 402. int timestamp, int size) 403. { 404. if (size) { ^ 405. pkt->data = av_realloc(NULL, size); 406. if (!pkt->data) libavformat/rtmppkt.c:405:9: 403. { 404. if (size) { 405. pkt->data = av_realloc(NULL, size); ^ 406. if (!pkt->data) 407. return AVERROR(ENOMEM); libavutil/mem.c:107:1: start of procedure av_realloc() 105. } 106. 107. void *av_realloc(void *ptr, size_t size) ^ 108. { 109. /* let's disallow possibly ambiguous cases */ libavutil/mem.c:110:9: Taking false branch 108. { 109. /* let's disallow possibly ambiguous cases */ 110. if (size > (INT_MAX - 16)) ^ 111. return NULL; 112. libavutil/mem.c:116:5: 114. return _aligned_realloc(ptr, size, 32); 115. #else 116. return realloc(ptr, size); ^ 117. #endif 118. } libavutil/mem.c:118:1: return from a call to av_realloc 116. return realloc(ptr, size); 117. #endif 118. } ^ 119. 120. int av_reallocp(void *ptr, size_t size) libavformat/rtmppkt.c:406:14: Taking false branch 404. if (size) { 405. pkt->data = av_realloc(NULL, size); 406. if (!pkt->data) ^ 407. return AVERROR(ENOMEM); 408. } libavformat/rtmppkt.c:409:5: 407. return AVERROR(ENOMEM); 408. } 409. pkt->size = size; ^ 410. pkt->channel_id = channel_id; 411. pkt->type = type; libavformat/rtmppkt.c:410:5: 408. } 409. pkt->size = size; 410. pkt->channel_id = channel_id; ^ 411. pkt->type = type; 412. pkt->timestamp = timestamp; libavformat/rtmppkt.c:411:5: 409. pkt->size = size; 410. pkt->channel_id = channel_id; 411. pkt->type = type; ^ 412. pkt->timestamp = timestamp; 413. pkt->extra = 0; libavformat/rtmppkt.c:412:5: 410. pkt->channel_id = channel_id; 411. pkt->type = type; 412. pkt->timestamp = timestamp; ^ 413. pkt->extra = 0; 414. pkt->ts_field = 0; libavformat/rtmppkt.c:413:5: 411. pkt->type = type; 412. pkt->timestamp = timestamp; 413. pkt->extra = 0; ^ 414. pkt->ts_field = 0; 415. libavformat/rtmppkt.c:414:5: 412. pkt->timestamp = timestamp; 413. pkt->extra = 0; 414. pkt->ts_field = 0; ^ 415. 416. return 0; libavformat/rtmppkt.c:416:5: 414. pkt->ts_field = 0; 415. 416. return 0; ^ 417. } 418. libavformat/rtmppkt.c:417:1: return from a call to ff_rtmp_packet_create 415. 416. return 0; 417. } ^ 418. 419. void ff_rtmp_packet_destroy(RTMPPacket *pkt) libavformat/rtmpproto.c:1827:9: Taking false branch 1825. 1826. // Send Stream Begin 1 1827. if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL, ^ 1828. RTMP_PT_PING, 0, 6)) < 0) { 1829. av_log(s, AV_LOG_ERROR, "Unable to create response packet\n"); libavformat/rtmpproto.c:1833:5: 1831. } 1832. 1833. bytestream2_init_writer(&pbc, spkt.data, spkt.size); ^ 1834. bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin 1835. bytestream2_put_be32(&pbc, rt->nb_streamid); libavcodec/bytestream.h:141:1: start of procedure bytestream2_init_writer() 139. } 140. 141. static av_always_inline void bytestream2_init_writer(PutByteContext *p, ^ 142. uint8_t *buf, 143. int buf_size) libavcodec/bytestream.h:145:5: 143. int buf_size) 144. { 145. p->buffer = buf; ^ 146. p->buffer_start = buf; 147. p->buffer_end = buf + buf_size; libavcodec/bytestream.h:146:5: 144. { 145. p->buffer = buf; 146. p->buffer_start = buf; ^ 147. p->buffer_end = buf + buf_size; 148. p->eof = 0; libavcodec/bytestream.h:147:5: 145. p->buffer = buf; 146. p->buffer_start = buf; 147. p->buffer_end = buf + buf_size; ^ 148. p->eof = 0; 149. } libavcodec/bytestream.h:148:5: 146. p->buffer_start = buf; 147. p->buffer_end = buf + buf_size; 148. p->eof = 0; ^ 149. } 150. libavcodec/bytestream.h:149:1: return from a call to bytestream2_init_writer 147. p->buffer_end = buf + buf_size; 148. p->eof = 0; 149. } ^ 150. 151. static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g) libavformat/rtmpproto.c:1834:5: 1832. 1833. bytestream2_init_writer(&pbc, spkt.data, spkt.size); 1834. bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin ^ 1835. bytestream2_put_be32(&pbc, rt->nb_streamid); 1836. libavcodec/bytestream.h:93:1: start of procedure bytestream2_put_be16() 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavcodec/bytestream.h:93:1: Taking true branch 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavcodec/bytestream.h:93:1: Taking true branch 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavutil/ppc/intreadwrite.h:54:1: start of procedure av_write_bswap16() 52. } 53. 54. static av_always_inline void av_write_bswap16(void *p, uint16_t v) ^ 55. { 56. __asm__ ("sthbrx %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v)); libavutil/ppc/intreadwrite.h:56:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found 54. static av_always_inline void av_write_bswap16(void *p, uint16_t v) 55. { 56. __asm__ ("sthbrx %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v)); ^ 57. } 58. libavutil/ppc/intreadwrite.h:57:1: return from a call to av_write_bswap16 55. { 56. __asm__ ("sthbrx %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v)); 57. } ^ 58. 59. static av_always_inline uint32_t av_read_bswap32(const void *p) libavcodec/bytestream.h:93:1: return from a call to bytestream2_put_be16 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavformat/rtmpproto.c:1835:5: 1833. bytestream2_init_writer(&pbc, spkt.data, spkt.size); 1834. bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin 1835. bytestream2_put_be32(&pbc, rt->nb_streamid); ^ 1836. 1837. ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size, libavcodec/bytestream.h:91:1: start of procedure bytestream2_put_be32() 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavcodec/bytestream.h:91:1: Taking true branch 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavcodec/bytestream.h:91:1: Taking true branch 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavutil/ppc/intreadwrite.h:66:1: start of procedure av_write_bswap32() 64. } 65. 66. static av_always_inline void av_write_bswap32(void *p, uint32_t v) ^ 67. { 68. __asm__ ("stwbrx %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v)); libavutil/ppc/intreadwrite.h:68:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found 66. static av_always_inline void av_write_bswap32(void *p, uint32_t v) 67. { 68. __asm__ ("stwbrx %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v)); ^ 69. } 70. libavutil/ppc/intreadwrite.h:69:1: return from a call to av_write_bswap32 67. { 68. __asm__ ("stwbrx %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v)); 69. } ^ 70. 71. #if HAVE_LDBRX libavcodec/bytestream.h:91:1: return from a call to bytestream2_put_be32 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavformat/rtmpproto.c:1837:5: Skipping ff_rtmp_packet_write(): empty list of specs 1835. bytestream2_put_be32(&pbc, rt->nb_streamid); 1836. 1837. ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size, ^ 1838. &rt->prev_pkt[1], &rt->nb_prev_pkt[1]); 1839. libavformat/rtmpproto.c:1840:5: 1838. &rt->prev_pkt[1], &rt->nb_prev_pkt[1]); 1839. 1840. ff_rtmp_packet_destroy(&spkt); ^ 1841. 1842. return ret; libavformat/rtmppkt.c:419:1: start of procedure ff_rtmp_packet_destroy() 417. } 418. 419. void ff_rtmp_packet_destroy(RTMPPacket *pkt) ^ 420. { 421. if (!pkt) libavformat/rtmppkt.c:421:10: Taking false branch 419. void ff_rtmp_packet_destroy(RTMPPacket *pkt) 420. { 421. if (!pkt) ^ 422. return; 423. av_freep(&pkt->data); libavformat/rtmppkt.c:423:5: Skipping av_freep(): empty list of specs 421. if (!pkt) 422. return; 423. av_freep(&pkt->data); ^ 424. pkt->size = 0; 425. } libavformat/rtmppkt.c:424:5: 422. return; 423. av_freep(&pkt->data); 424. pkt->size = 0; ^ 425. } 426. libavformat/rtmppkt.c:425:1: return from a call to ff_rtmp_packet_destroy 423. av_freep(&pkt->data); 424. pkt->size = 0; 425. } ^ 426. 427. int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end) libavformat/rtmpproto.c:1842:5: 1840. ff_rtmp_packet_destroy(&spkt); 1841. 1842. return ret; ^ 1843. } 1844. libavformat/rtmpproto.c:1843:1: return from a call to write_begin 1841. 1842. return ret; 1843. } ^ 1844. 1845. static int write_status(URLContext *s, RTMPPacket *pkt,
https://github.com/libav/libav/blob/2e55e26b40e269816bba54da7d0e03955731b8fe/libavformat/rtmpproto.c/#L1843
d2a_code_trace_data_45448
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; char *codec_name = *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { fprintf(stderr, "File for preset '%s' not found\n", arg); ffmpeg_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ffmpeg_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else if(!strcmp(tmp, "dcodec")){ opt_data_codec(tmp2); }else if(opt_default(tmp, tmp2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ffmpeg_exit(1); } } fclose(f); return 0; } ffmpeg.c:4181: error: Null Dereference pointer `f` last assigned on line 4176 could be null and is dereferenced by call to `feof()` at line 4181, column 12. ffmpeg.c:4168:1: start of procedure opt_preset() 4166. } 4167. 4168. static int opt_preset(const char *opt, const char *arg) ^ 4169. { 4170. FILE *f=NULL; ffmpeg.c:4170:5: 4168. static int opt_preset(const char *opt, const char *arg) 4169. { 4170. FILE *f=NULL; ^ 4171. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4172. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4172:24: Condition is false 4170. FILE *f=NULL; 4171. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4172. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4173. *opt == 'a' ? audio_codec_name : 4174. subtitle_codec_name; ffmpeg.c:4173:24: Condition is false 4171. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4172. char *codec_name = *opt == 'v' ? video_codec_name : 4173. *opt == 'a' ? audio_codec_name : ^ 4174. subtitle_codec_name; 4175. ffmpeg.c:4172:24: 4170. FILE *f=NULL; 4171. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4172. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4173. *opt == 'a' ? audio_codec_name : 4174. subtitle_codec_name; ffmpeg.c:4172:5: 4170. FILE *f=NULL; 4171. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4172. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4173. *opt == 'a' ? audio_codec_name : 4174. subtitle_codec_name; ffmpeg.c:4176:64: Condition is false 4174. subtitle_codec_name; 4175. 4176. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4177. fprintf(stderr, "File for preset '%s' not found\n", arg); 4178. ffmpeg_exit(1); ffmpeg.c:4176:11: Taking true branch 4174. subtitle_codec_name; 4175. 4176. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4177. fprintf(stderr, "File for preset '%s' not found\n", arg); 4178. ffmpeg_exit(1); ffmpeg.c:4177:9: 4175. 4176. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4177. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4178. ffmpeg_exit(1); 4179. } ffmpeg.c:4178:9: Skipping ffmpeg_exit(): empty list of specs 4176. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4177. fprintf(stderr, "File for preset '%s' not found\n", arg); 4178. ffmpeg_exit(1); ^ 4179. } 4180. ffmpeg.c:4181:12: 4179. } 4180. 4181. while(!feof(f)){ ^ 4182. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4183. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L4181
d2a_code_trace_data_45449
static inline void idctSparseColAdd (uint8_t *dest, int line_size, DCTELEM * col) { int a0, a1, a2, a3, b0, b1, b2, b3; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); a1 = a0; a2 = a0; a3 = a0; a0 += + W2*col[8*2]; a1 += + W6*col[8*2]; a2 += - W6*col[8*2]; a3 += - W2*col[8*2]; MUL16(b0, W1, col[8*1]); MUL16(b1, W3, col[8*1]); MUL16(b2, W5, col[8*1]); MUL16(b3, W7, col[8*1]); MAC16(b0, + W3, col[8*3]); MAC16(b1, - W7, col[8*3]); MAC16(b2, - W1, col[8*3]); MAC16(b3, - W5, col[8*3]); if(col[8*4]){ a0 += + W4*col[8*4]; a1 += - W4*col[8*4]; a2 += - W4*col[8*4]; a3 += + W4*col[8*4]; } if (col[8*5]) { MAC16(b0, + W5, col[8*5]); MAC16(b1, - W1, col[8*5]); MAC16(b2, + W7, col[8*5]); MAC16(b3, + W3, col[8*5]); } if(col[8*6]){ a0 += + W6*col[8*6]; a1 += - W2*col[8*6]; a2 += + W2*col[8*6]; a3 += - W6*col[8*6]; } if (col[8*7]) { MAC16(b0, + W7, col[8*7]); MAC16(b1, - W5, col[8*7]); MAC16(b2, + W3, col[8*7]); MAC16(b3, - W1, col[8*7]); } dest[0] = cm[dest[0] + ((a0 + b0) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a1 + b1) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a2 + b2) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a3 + b3) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a3 - b3) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a2 - b2) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a1 - b1) >> COL_SHIFT)]; dest += line_size; dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)]; } libavcodec/wmv2.c:70: error: Buffer Overrun L1 Offset: [61, 64] (⇐ [5, 8] + 56) Size: 6 by call to `wmv2_add_block`. libavcodec/wmv2.c:70:5: Call 68. 69. wmv2_add_block(w, block1[4], dest_cb , s->uvlinesize, 4); 70. wmv2_add_block(w, block1[5], dest_cr , s->uvlinesize, 5); ^ 71. } 72. libavcodec/wmv2.c:35:1: Parameter `n` 33. } 34. 35. static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){ ^ 36. MpegEncContext * const s= &w->s; 37. libavcodec/wmv2.c:50:9: Call 48. case 2: 49. ff_simple_idct48_add(dst , stride, block1); 50. ff_simple_idct48_add(dst + 4 , stride, w->abt_block2[n]); ^ 51. memset(w->abt_block2[n], 0, 64*sizeof(DCTELEM)); 52. break; libavcodec/simple_idct.c:573:1: Parameter `*block` 571. } 572. 573. void ff_simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block) ^ 574. { 575. int i; libavcodec/simple_idct.c:584:9: Call 582. /* IDCT8 and store */ 583. for(i=0; i<4; i++){ 584. idctSparseColAdd(dest + i, line_size, block + i); ^ 585. } 586. } libavcodec/simple_idct.c:255:1: <Length trace> 253. } 254. 255. static inline void idctSparseColAdd (uint8_t *dest, int line_size, ^ 256. DCTELEM * col) 257. { libavcodec/simple_idct.c:255:1: Parameter `*col` 253. } 254. 255. static inline void idctSparseColAdd (uint8_t *dest, int line_size, ^ 256. DCTELEM * col) 257. { libavcodec/simple_idct.c:303:13: Array access: Offset: [61, 64] (⇐ [5, 8] + 56) Size: 6 by call to `wmv2_add_block` 301. } 302. 303. if (col[8*7]) { ^ 304. MAC16(b0, + W7, col[8*7]); 305. MAC16(b1, - W5, col[8*7]);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/simple_idct.c/#L303
d2a_code_trace_data_45450
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); if (ref->extended_data != ref->data) av_freep(&ref->extended_data); av_free(ref->video); av_free(ref->audio); av_free(ref); } libavfilter/vf_pad.c:351: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/vf_pad.c:351:5: Call 349. ff_end_frame(link->dst->outputs[0]); 350. avfilter_unref_buffer(link->dst->outputs[0]->out_buf); 351. avfilter_unref_buffer(link->cur_buf); ^ 352. } 353. libavfilter/buffer.c:74:1: <LHS trace> 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:74:1: Parameter `ref->buf->refcount` 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:78:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 76. if (!ref) 77. return; 78. if (!(--ref->buf->refcount)) ^ 79. ref->buf->free(ref->buf); 80. if (ref->extended_data != ref->data)
https://github.com/libav/libav/blob/533fd5b5b468131cfe164455783c351eb69af657/libavfilter/buffer.c/#L78
d2a_code_trace_data_45451
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) { const char *s = *t; int64_t v = 0; if (*s == '9' || *s == '8' || !ossl_isdigit(*s)) return 0; do { v = (v << 3) + (*s - '0'); } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT); return 0; } *t = skip_space(s); res->type = PROPERTY_TYPE_NUMBER; res->v.int_val = v; return 1; } test/property_test.c:232: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add`. Showing all 23 steps of the trace test/property_test.c:218:9: Array declaration 216. char *impl; 217. } impls[] = { 218. { 6, "position=1", "a" }, ^ 219. { 6, "position=2", "b" }, 220. { 6, "position=3", "c" }, test/property_test.c:232:14: Call 230. 231. for (i = 0; i < OSSL_NELEM(impls); i++) 232. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop, ^ 233. impls[i].impl, NULL))) { 234. TEST_note("iteration %zd", i + 1); crypto/property/property.c:176:1: Parameter `*properties` 174. } 175. 176. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 177. int nid, const char *properties, 178. void *method, void (*method_destruct)(void *)) crypto/property/property.c:205:28: Call 203. ossl_method_cache_flush(store, nid); 204. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) { 205. impl->properties = ossl_parse_property(store->ctx, properties); ^ 206. if (impl->properties == NULL) 207. goto err; crypto/property/property_parse.c:317:1: Parameter `*defn` 315. } 316. 317. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn) 318. { 319. PROPERTY_DEFINITION *prop = NULL; crypto/property/property_parse.c:322:5: Assignment 320. OSSL_PROPERTY_LIST *res = NULL; 321. STACK_OF(PROPERTY_DEFINITION) *sk; 322. const char *s = defn; ^ 323. int done; 324. crypto/property/property_parse.c:328:9: Call 326. return NULL; 327. 328. s = skip_space(s); ^ 329. done = *s == '\0'; 330. while (!done) { crypto/property/property_parse.c:50:1: Parameter `*s` 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:54:5: Assignment 52. while (ossl_isspace(*s)) 53. s++; 54. return s; ^ 55. } 56. crypto/property/property_parse.c:328:5: Assignment 326. return NULL; 327. 328. s = skip_space(s); ^ 329. done = *s == '\0'; 330. while (!done) { crypto/property/property_parse.c:335:14: Call 333. goto err; 334. memset(&prop->v, 0, sizeof(prop->v)); 335. if (!parse_name(ctx, &s, 1, &prop->name_idx)) ^ 336. goto err; 337. prop->oper = PROPERTY_OPER_EQ; crypto/property/property_parse.c:81:1: Parameter `**t` 79. } 80. 81. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, 82. OSSL_PROPERTY_IDX *idx) 83. { crypto/property/property_parse.c:342:13: Call 340. goto err; 341. } 342. if (match_ch(&s, '=')) { ^ 343. if (!parse_value(ctx, &s, prop, 1)) { 344. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); crypto/property/property_parse.c:57:1: Parameter `**t` 55. } 56. 57. > static int match_ch(const char *t[], char m) 58. { 59. const char *s = *t; crypto/property/property_parse.c:343:18: Call 341. } 342. if (match_ch(&s, '=')) { 343. if (!parse_value(ctx, &s, prop, 1)) { ^ 344. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); 345. goto err; crypto/property/property_parse.c:245:1: Parameter `**t` 243. } 244. 245. > static int parse_value(OPENSSL_CTX *ctx, const char *t[], 246. PROPERTY_DEFINITION *res, int create) 247. { crypto/property/property_parse.c:248:5: Assignment 246. PROPERTY_DEFINITION *res, int create) 247. { 248. const char *s = *t; ^ 249. int r = 0; 250. crypto/property/property_parse.c:265:9: Assignment 263. r = parse_hex(&s, res); 264. } else if (*s == '0' && ossl_isdigit(s[1])) { 265. s++; ^ 266. r = parse_oct(&s, res); 267. } else if (ossl_isdigit(*s)) { crypto/property/property_parse.c:266:13: Call 264. } else if (*s == '0' && ossl_isdigit(s[1])) { 265. s++; 266. r = parse_oct(&s, res); ^ 267. } else if (ossl_isdigit(*s)) { 268. return parse_number(t, res); crypto/property/property_parse.c:164:1: <Length trace> 162. } 163. 164. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 165. { 166. const char *s = *t; crypto/property/property_parse.c:164:1: Parameter `**t` 162. } 163. 164. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 165. { 166. const char *s = *t; crypto/property/property_parse.c:166:5: Assignment 164. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 165. { 166. const char *s = *t; ^ 167. int64_t v = 0; 168. crypto/property/property_parse.c:173:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add` 171. do { 172. v = (v << 3) + (*s - '0'); 173. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); ^ 174. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { 175. PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/property/property_parse.c/#L173
d2a_code_trace_data_45452
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) { GetBitContext gb; int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, buf, buf_size * 8); if (sl->use_au_start) au_start_flag = get_bits1(&gb); if (sl->use_au_end) au_end_flag = get_bits1(&gb); if (!sl->use_au_start && !sl->use_au_end) au_start_flag = au_end_flag = 1; if (sl->ocr_len > 0) ocr_flag = get_bits1(&gb); if (sl->use_idle) idle_flag = get_bits1(&gb); if (sl->use_padding) padding_flag = get_bits1(&gb); if (padding_flag) padding_bits = get_bits(&gb, 3); if (!idle_flag && (!padding_flag || padding_bits != 0)) { if (sl->packet_seq_num_len) skip_bits_long(&gb, sl->packet_seq_num_len); if (sl->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, sl->degr_prior_len); if (ocr_flag) skip_bits_long(&gb, sl->ocr_len); if (au_start_flag) { if (sl->use_rand_acc_pt) get_bits1(&gb); if (sl->au_seq_num_len > 0) skip_bits_long(&gb, sl->au_seq_num_len); if (sl->use_timestamps) { dts_flag = get_bits1(&gb); cts_flag = get_bits1(&gb); } } if (sl->inst_bitrate_len) inst_bitrate_flag = get_bits1(&gb); if (dts_flag == 1) dts = get_bits64(&gb, sl->timestamp_len); if (cts_flag == 1) cts = get_bits64(&gb, sl->timestamp_len); if (sl->au_len > 0) skip_bits_long(&gb, sl->au_len); if (inst_bitrate_flag) skip_bits_long(&gb, sl->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) pes->dts = dts; if (cts != AV_NOPTS_VALUE) pes->pts = cts; if (sl->timestamp_len && sl->timestamp_res) avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; } libavformat/mpegts.c:747: error: Null Dereference pointer `&gb->buffer` last assigned on line 736 could be null and is dereferenced by call to `get_bits1()` at line 747, column 21. libavformat/mpegts.c:728:1: start of procedure read_sl_header() 726. } 727. 728. static int read_sl_header(PESContext *pes, SLConfigDescr *sl, ^ 729. const uint8_t *buf, int buf_size) 730. { libavformat/mpegts.c:732:5: 730. { 731. GetBitContext gb; 732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; ^ 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 734. int dts_flag = -1, cts_flag = -1; libavformat/mpegts.c:733:5: 731. GetBitContext gb; 732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; ^ 734. int dts_flag = -1, cts_flag = -1; 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; libavformat/mpegts.c:734:5: 732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 734. int dts_flag = -1, cts_flag = -1; ^ 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; 736. init_get_bits(&gb, buf, buf_size * 8); libavformat/mpegts.c:735:5: 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 734. int dts_flag = -1, cts_flag = -1; 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; ^ 736. init_get_bits(&gb, buf, buf_size * 8); 737. libavformat/mpegts.c:736:5: 734. int dts_flag = -1, cts_flag = -1; 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; 736. init_get_bits(&gb, buf, buf_size * 8); ^ 737. 738. if (sl->use_au_start) libavcodec/get_bits.h:376:1: start of procedure init_get_bits() 374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 375. */ 376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 377. int bit_size) 378. { libavcodec/get_bits.h:380:5: 378. { 379. int buffer_size; 380. int ret = 0; ^ 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:382:9: Taking true branch 380. int ret = 0; 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 383. bit_size = 0; 384. buffer = NULL; libavcodec/get_bits.h:383:9: 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; ^ 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:384:9: 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; 384. buffer = NULL; ^ 385. ret = AVERROR_INVALIDDATA; 386. } libavcodec/get_bits.h:385:9: 383. bit_size = 0; 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; ^ 386. } 387. libavcodec/get_bits.h:388:5: 386. } 387. 388. buffer_size = (bit_size + 7) >> 3; ^ 389. 390. s->buffer = buffer; libavcodec/get_bits.h:390:5: 388. buffer_size = (bit_size + 7) >> 3; 389. 390. s->buffer = buffer; ^ 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:391:5: 389. 390. s->buffer = buffer; 391. s->size_in_bits = bit_size; ^ 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:393:5: 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; ^ 394. #endif 395. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:395:5: 393. s->size_in_bits_plus8 = bit_size + 8; 394. #endif 395. s->buffer_end = buffer + buffer_size; ^ 396. s->index = 0; 397. libavcodec/get_bits.h:396:5: 394. #endif 395. s->buffer_end = buffer + buffer_size; 396. s->index = 0; ^ 397. 398. return ret; libavcodec/get_bits.h:398:5: 396. s->index = 0; 397. 398. return ret; ^ 399. } 400. libavcodec/get_bits.h:399:1: return from a call to init_get_bits 397. 398. return ret; 399. } ^ 400. 401. /** libavformat/mpegts.c:738:9: Taking false branch 736. init_get_bits(&gb, buf, buf_size * 8); 737. 738. if (sl->use_au_start) ^ 739. au_start_flag = get_bits1(&gb); 740. if (sl->use_au_end) libavformat/mpegts.c:740:9: Taking false branch 738. if (sl->use_au_start) 739. au_start_flag = get_bits1(&gb); 740. if (sl->use_au_end) ^ 741. au_end_flag = get_bits1(&gb); 742. if (!sl->use_au_start && !sl->use_au_end) libavformat/mpegts.c:742:10: Taking true branch 740. if (sl->use_au_end) 741. au_end_flag = get_bits1(&gb); 742. if (!sl->use_au_start && !sl->use_au_end) ^ 743. au_start_flag = au_end_flag = 1; 744. if (sl->ocr_len > 0) libavformat/mpegts.c:742:31: Taking true branch 740. if (sl->use_au_end) 741. au_end_flag = get_bits1(&gb); 742. if (!sl->use_au_start && !sl->use_au_end) ^ 743. au_start_flag = au_end_flag = 1; 744. if (sl->ocr_len > 0) libavformat/mpegts.c:743:9: 741. au_end_flag = get_bits1(&gb); 742. if (!sl->use_au_start && !sl->use_au_end) 743. au_start_flag = au_end_flag = 1; ^ 744. if (sl->ocr_len > 0) 745. ocr_flag = get_bits1(&gb); libavformat/mpegts.c:744:9: Taking false branch 742. if (!sl->use_au_start && !sl->use_au_end) 743. au_start_flag = au_end_flag = 1; 744. if (sl->ocr_len > 0) ^ 745. ocr_flag = get_bits1(&gb); 746. if (sl->use_idle) libavformat/mpegts.c:746:9: Taking true branch 744. if (sl->ocr_len > 0) 745. ocr_flag = get_bits1(&gb); 746. if (sl->use_idle) ^ 747. idle_flag = get_bits1(&gb); 748. if (sl->use_padding) libavformat/mpegts.c:747:9: 745. ocr_flag = get_bits1(&gb); 746. if (sl->use_idle) 747. idle_flag = get_bits1(&gb); ^ 748. if (sl->use_padding) 749. padding_flag = get_bits1(&gb); libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7;
https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavformat/mpegts.c/#L747
d2a_code_trace_data_45453
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:586: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_inv`. Showing all 19 steps of the trace test/bntest.c:586:13: Call 584. BN_bntest_rand(a, 512, 0, 0); 585. for (j = 0; j < 2; j++) { 586. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 587. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 588. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:560:1: Parameter `ctx->stack.depth` 558. * Curve Cryptography Over Binary Fields". 559. */ 560. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 561. { 562. BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp; crypto/bn/bn_gf2m.c:568:5: Call 566. bn_check_top(p); 567. 568. BN_CTX_start(ctx); ^ 569. 570. if ((b = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:724:5: Call 722. bn_correct_top(v); 723. # endif 724. BN_CTX_end(ctx); ^ 725. return ret; 726. } 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:587:13: Call 585. for (j = 0; j < 2; j++) { 586. BN_GF2m_mod_inv(c, a, b[j], ctx); 587. BN_GF2m_mod_mul(d, a, c, b[j], ctx); ^ 588. /* Test that ((1/a)*a) = 1. */ 589. if (!BN_is_one(d)) { crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:586:13: Call 584. BN_bntest_rand(a, 512, 0, 0); 585. for (j = 0; j < 2; j++) { 586. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 587. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 588. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:568:5: Call 566. bn_check_top(p); 567. 568. BN_CTX_start(ctx); ^ 569. 570. if ((b = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:724:5: Call 722. bn_correct_top(v); 723. # endif 724. BN_CTX_end(ctx); ^ 725. return ret; 726. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_inv` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273