id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_45454
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/ca.c:2110: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/ca.c:2110:20: Call 2108. for (i = 0; i < DB_NUMBER; i++) 2109. row[i] = NULL; 2110. row[DB_name] = X509_NAME_oneline(X509_get_subject_name(x509), NULL, 0); ^ 2111. bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509), NULL); 2112. if (!bn) 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: [0, 200] 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_45455
char *BN_bn2dec(const BIGNUM *a) { int i = 0, num, ok = 0, n, tbytes; char *buf = NULL; char *p; BIGNUM *t = NULL; BN_ULONG *bn_data = NULL, *lp; int bn_data_num; i = BN_num_bits(a) * 3; num = (i / 10 + i / 1000 + 1) + 1; tbytes = num + 3; bn_data_num = num / BN_DEC_NUM + 1; bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); buf = OPENSSL_malloc(tbytes); if ((buf == NULL) || (bn_data == NULL)) { BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE); goto err; } if ((t = BN_dup(a)) == NULL) goto err; p = buf; lp = bn_data; if (BN_is_zero(t)) { *(p++) = '0'; *(p++) = '\0'; } else { if (BN_is_negative(t)) *p++ = '-'; while (!BN_is_zero(t)) { if (lp - bn_data >= bn_data_num) goto err; *lp = BN_div_word(t, BN_DEC_CONV); if (*lp == (BN_ULONG)-1) goto err; lp++; } lp--; n = BIO_snprintf(p, tbytes - (size_t)(p - buf), BN_DEC_FMT1, *lp); if (n < 0) goto err; p += n; while (lp != bn_data) { lp--; n = BIO_snprintf(p, tbytes - (size_t)(p - buf), BN_DEC_FMT2, *lp); if (n < 0) goto err; p += n; } } ok = 1; err: OPENSSL_free(bn_data); BN_free(t); if (ok) return buf; OPENSSL_free(buf); return NULL; } crypto/bn/bn_print.c:104: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [0, +oo]. Showing all 12 steps of the trace crypto/bn/bn_print.c:68:9: <Length trace> 66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1 67. */ 68. i = BN_num_bits(a) * 3; ^ 69. num = (i / 10 + i / 1000 + 1) + 1; 70. tbytes = num + 3; /* negative and terminator and one spare? */ crypto/bn/bn_print.c:68:9: Call 66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1 67. */ 68. i = BN_num_bits(a) * 3; ^ 69. num = (i / 10 + i / 1000 + 1) + 1; 70. tbytes = num + 3; /* negative and terminator and one spare? */ crypto/bn/bn_lib.c:167:9: Assignment 165. 166. if (BN_is_zero(a)) 167. return 0; ^ 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 169. } crypto/bn/bn_print.c:68:5: Assignment 66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1 67. */ 68. i = BN_num_bits(a) * 3; ^ 69. num = (i / 10 + i / 1000 + 1) + 1; 70. tbytes = num + 3; /* negative and terminator and one spare? */ crypto/bn/bn_print.c:69:5: Assignment 67. */ 68. i = BN_num_bits(a) * 3; 69. num = (i / 10 + i / 1000 + 1) + 1; ^ 70. tbytes = num + 3; /* negative and terminator and one spare? */ 71. bn_data_num = num / BN_DEC_NUM + 1; crypto/bn/bn_print.c:71:5: Assignment 69. num = (i / 10 + i / 1000 + 1) + 1; 70. tbytes = num + 3; /* negative and terminator and one spare? */ 71. bn_data_num = num / BN_DEC_NUM + 1; ^ 72. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); 73. buf = OPENSSL_malloc(tbytes); crypto/bn/bn_print.c:72:15: Call 70. tbytes = num + 3; /* negative and terminator and one spare? */ 71. bn_data_num = num / BN_DEC_NUM + 1; 72. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); ^ 73. buf = OPENSSL_malloc(tbytes); 74. if ((buf == NULL) || (bn_data == NULL)) { crypto/mem.c:177:9: Assignment 175. 176. if (num == 0) 177. return NULL; ^ 178. 179. FAILTEST(); crypto/bn/bn_print.c:72:5: Assignment 70. tbytes = num + 3; /* negative and terminator and one spare? */ 71. bn_data_num = num / BN_DEC_NUM + 1; 72. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); ^ 73. buf = OPENSSL_malloc(tbytes); 74. if ((buf == NULL) || (bn_data == NULL)) { crypto/bn/bn_print.c:82:5: Assignment 80. 81. p = buf; 82. lp = bn_data; ^ 83. if (BN_is_zero(t)) { 84. *(p++) = '0'; crypto/bn/bn_print.c:98:9: Assignment 96. lp++; 97. } 98. lp--; ^ 99. /* 100. * We now have a series of blocks, BN_DEC_NUM chars in length, where crypto/bn/bn_print.c:104:70: Array access: Offset: [-1, +oo] Size: [0, +oo] 102. * order. 103. */ 104. n = BIO_snprintf(p, tbytes - (size_t)(p - buf), BN_DEC_FMT1, *lp); ^ 105. if (n < 0) 106. goto err;
https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/crypto/bn/bn_print.c/#L104
d2a_code_trace_data_45456
static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; strncpy(idx_str, arg, sizeof(idx_str)); idx_str[sizeof(idx_str)-1] = '\0'; p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); ffmpeg_exit(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } ffmpeg.c:3659: error: Null Dereference pointer `streamid_map` last assigned on line 3658 could be null and is dereferenced at line 3659, column 5. ffmpeg.c:3641:1: start of procedure opt_streamid() 3639. 3640. /* arg format is "output-stream-index:streamid-value". */ 3641. static int opt_streamid(const char *opt, const char *arg) ^ 3642. { 3643. int idx; ffmpeg.c:3647:5: 3645. char idx_str[16]; 3646. 3647. strncpy(idx_str, arg, sizeof(idx_str)); ^ 3648. idx_str[sizeof(idx_str)-1] = '\0'; 3649. p = strchr(idx_str, ':'); ffmpeg.c:3648:5: 3646. 3647. strncpy(idx_str, arg, sizeof(idx_str)); 3648. idx_str[sizeof(idx_str)-1] = '\0'; ^ 3649. p = strchr(idx_str, ':'); 3650. if (!p) { ffmpeg.c:3649:5: 3647. strncpy(idx_str, arg, sizeof(idx_str)); 3648. idx_str[sizeof(idx_str)-1] = '\0'; 3649. p = strchr(idx_str, ':'); ^ 3650. if (!p) { 3651. fprintf(stderr, ffmpeg.c:3650:10: Taking false branch 3648. idx_str[sizeof(idx_str)-1] = '\0'; 3649. p = strchr(idx_str, ':'); 3650. if (!p) { ^ 3651. fprintf(stderr, 3652. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", ffmpeg.c:3656:5: 3654. ffmpeg_exit(1); 3655. } 3656. *p++ = '\0'; ^ 3657. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3658. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); ffmpeg.c:3657:5: Skipping parse_number_or_die(): empty list of specs 3655. } 3656. *p++ = '\0'; 3657. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); ^ 3658. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); 3659. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); ffmpeg.c:3658:5: 3656. *p++ = '\0'; 3657. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3658. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); ^ 3659. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); 3660. return 0; ffmpeg.c:572:1: start of procedure grow_array() 570. 571. /* similar to ff_dynarray_add() and av_fast_realloc() */ 572. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 573. { 574. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:574:9: Taking false branch 572. static void *grow_array(void *array, int elem_size, int *size, int new_size) 573. { 574. if (new_size >= INT_MAX / elem_size) { ^ 575. fprintf(stderr, "Array too big.\n"); 576. ffmpeg_exit(1); ffmpeg.c:578:9: Taking true branch 576. ffmpeg_exit(1); 577. } 578. if (*size < new_size) { ^ 579. uint8_t *tmp = av_realloc(array, new_size*elem_size); 580. if (!tmp) { ffmpeg.c:579:9: 577. } 578. if (*size < new_size) { 579. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 580. if (!tmp) { 581. fprintf(stderr, "Could not alloc buffer.\n"); 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) ffmpeg.c:580:14: Taking true branch 578. if (*size < new_size) { 579. uint8_t *tmp = av_realloc(array, new_size*elem_size); 580. if (!tmp) { ^ 581. fprintf(stderr, "Could not alloc buffer.\n"); 582. ffmpeg_exit(1); ffmpeg.c:581:13: 579. uint8_t *tmp = av_realloc(array, new_size*elem_size); 580. if (!tmp) { 581. fprintf(stderr, "Could not alloc buffer.\n"); ^ 582. ffmpeg_exit(1); 583. } ffmpeg.c:582:13: Skipping ffmpeg_exit(): empty list of specs 580. if (!tmp) { 581. fprintf(stderr, "Could not alloc buffer.\n"); 582. ffmpeg_exit(1); ^ 583. } 584. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:584:9: 582. ffmpeg_exit(1); 583. } 584. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 585. *size = new_size; 586. return tmp; ffmpeg.c:585:9: 583. } 584. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 585. *size = new_size; ^ 586. return tmp; 587. } ffmpeg.c:586:9: 584. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 585. *size = new_size; 586. return tmp; ^ 587. } 588. return array; ffmpeg.c:589:1: return from a call to grow_array 587. } 588. return array; 589. } ^ 590. 591. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3659:5: Skipping parse_number_or_die(): empty list of specs 3657. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3658. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); 3659. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); ^ 3660. return 0; 3661. }
https://github.com/libav/libav/blob/129983408d0d064db656742a3d3d4c038420f48c/ffmpeg.c/#L3659
d2a_code_trace_data_45457
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/s3_lib.c:3728: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 8]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 12 steps of the trace ssl/s3_lib.c:3727:24: Call 3725. if (s->version >= TLS1_VERSION && (alg_k & SSL_kGOST)) 3726. return WPACKET_put_bytes_u8(pkt, TLS_CT_GOST01_SIGN) 3727. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_SIGN) ^ 3728. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_512_SIGN); 3729. #endif 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/s3_lib.c:3728:24: Call 3726. return WPACKET_put_bytes_u8(pkt, TLS_CT_GOST01_SIGN) 3727. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_SIGN) 3728. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_512_SIGN); ^ 3729. #endif 3730. 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] - [pkt->written, pkt->written + 8]):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_45458
static int client_master_key(SSL *s) { unsigned char *buf; unsigned char *p,*d; int clear,enc,karg,i; SSL_SESSION *sess; const EVP_CIPHER *c; const EVP_MD *md; buf=(unsigned char *)s->init_buf->data; if (s->state == SSL2_ST_SEND_CLIENT_MASTER_KEY_A) { if (!ssl_cipher_get_evp(s->session,&c,&md,NULL,NULL,NULL)) { ssl2_return_error(s,SSL2_PE_NO_CIPHER); SSLerr(SSL_F_CLIENT_MASTER_KEY,SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS); return(-1); } sess=s->session; p=buf; d=p+10; *(p++)=SSL2_MT_CLIENT_MASTER_KEY; i=ssl_put_cipher_by_char(s,sess->cipher,p); p+=i; i=EVP_CIPHER_iv_length(c); sess->key_arg_length=i; if (i > SSL_MAX_KEY_ARG_LENGTH) { ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR); SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR); return -1; } if (i > 0) if (RAND_pseudo_bytes(sess->key_arg,i) <= 0) return -1; i=EVP_CIPHER_key_length(c); sess->master_key_length=i; if (i > 0) { if (i > (int)sizeof(sess->master_key)) { ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR); SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR); return -1; } if (RAND_bytes(sess->master_key,i) <= 0) { ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); return(-1); } } if (sess->cipher->algorithm2 & SSL2_CF_8_BYTE_ENC) enc=8; else if (SSL_C_IS_EXPORT(sess->cipher)) enc=5; else enc=i; if ((int)i < enc) { ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); SSLerr(SSL_F_CLIENT_MASTER_KEY,SSL_R_CIPHER_TABLE_SRC_ERROR); return(-1); } clear=i-enc; s2n(clear,p); memcpy(d,sess->master_key,(unsigned int)clear); d+=clear; enc=ssl_rsa_public_encrypt(sess->sess_cert,enc, &(sess->master_key[clear]),d, (s->s2->ssl2_rollback)?RSA_SSLV23_PADDING:RSA_PKCS1_PADDING); if (enc <= 0) { ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); SSLerr(SSL_F_CLIENT_MASTER_KEY,SSL_R_PUBLIC_KEY_ENCRYPT_ERROR); return(-1); } #ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) d[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) sess->master_key[clear]++; #endif s2n(enc,p); d+=enc; karg=sess->key_arg_length; s2n(karg,p); if (karg > (int)sizeof(sess->key_arg)) { ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR); return -1; } memcpy(d,sess->key_arg,(unsigned int)karg); d+=karg; s->state=SSL2_ST_SEND_CLIENT_MASTER_KEY_B; s->init_num=d-buf; s->init_off=0; } return(ssl2_do_write(s)); } ssl/s2_clnt.c:684: error: BUFFER_OVERRUN_L3 Offset added: [-48, 48] Size: 48. Showing all 6 steps of the trace ssl/s2_clnt.c:670:4: <Offset trace> 668. 669. if (sess->cipher->algorithm2 & SSL2_CF_8_BYTE_ENC) 670. enc=8; ^ 671. else if (SSL_C_IS_EXPORT(sess->cipher)) 672. enc=5; ssl/s2_clnt.c:670:4: Assignment 668. 669. if (sess->cipher->algorithm2 & SSL2_CF_8_BYTE_ENC) 670. enc=8; ^ 671. else if (SSL_C_IS_EXPORT(sess->cipher)) 672. enc=5; ssl/s2_clnt.c:682:3: Assignment 680. return(-1); 681. } 682. clear=i-enc; ^ 683. s2n(clear,p); 684. memcpy(d,sess->master_key,(unsigned int)clear); ssl/s2_clnt.c:611:1: <Length trace> 609. } 610. 611. > static int client_master_key(SSL *s) 612. { 613. unsigned char *buf; ssl/s2_clnt.c:611:1: Parameter `s->session->master_key[*]` 609. } 610. 611. > static int client_master_key(SSL *s) 612. { 613. unsigned char *buf; ssl/s2_clnt.c:684:3: Array access: Offset added: [-48, 48] Size: 48 682. clear=i-enc; 683. s2n(clear,p); 684. memcpy(d,sess->master_key,(unsigned int)clear); ^ 685. d+=clear; 686.
https://github.com/openssl/openssl/blob/d40a1b865fddc3d67f8c06ff1f1466fad331c8f7/ssl/s2_clnt.c/#L684
d2a_code_trace_data_45459
void RAND_add(const void *buf, int num, double randomness) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->add != NULL) meth->add(buf, num, randomness); } crypto/rand/rand_lib.c:743: error: NULL_DEREFERENCE pointer `meth` last assigned on line 741 could be null and is dereferenced at line 743, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:739:1: start of procedure RAND_add() 737. } 738. 739. > void RAND_add(const void *buf, int num, double randomness) 740. { 741. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:741:5: 739. void RAND_add(const void *buf, int num, double randomness) 740. { 741. > const RAND_METHOD *meth = RAND_get_rand_method(); 742. 743. if (meth->add != NULL) crypto/rand/rand_lib.c:671:1: start of procedure RAND_get_rand_method() 669. #endif 670. 671. > const RAND_METHOD *RAND_get_rand_method(void) 672. { 673. #ifdef FIPS_MODE crypto/rand/rand_lib.c:676:5: 674. return NULL; 675. #else 676. > const RAND_METHOD *tmp_meth = NULL; 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:678:10: 676. const RAND_METHOD *tmp_meth = NULL; 677. 678. > if (!RUN_ONCE(&rand_init, do_rand_init)) 679. return NULL; 680. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking true branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:678:10: Condition is false 676. const RAND_METHOD *tmp_meth = NULL; 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 679. return NULL; 680. crypto/rand/rand_lib.c:678:10: Taking true branch 676. const RAND_METHOD *tmp_meth = NULL; 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 679. return NULL; 680. crypto/rand/rand_lib.c:679:9: 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) 679. > return NULL; 680. 681. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:703:1: return from a call to RAND_get_rand_method 701. return tmp_meth; 702. #endif 703. > } 704. 705. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:743:9: 741. const RAND_METHOD *meth = RAND_get_rand_method(); 742. 743. > if (meth->add != NULL) 744. meth->add(buf, num, randomness); 745. }
https://github.com/openssl/openssl/blob/37ca204b96b036f949b8bc8389c1f8e806e1cbec/crypto/rand/rand_lib.c/#L743
d2a_code_trace_data_45460
DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], long length, int out_count, DES_cblock *seed) { DES_LONG z0,z1,t0,t1; int i; long l; const unsigned char *cp; DES_LONG *lp; if (out_count < 1) out_count=1; lp = (DES_LONG *) &(output[0])[0]; z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); for (i=0; ((i<4)&&(i<out_count)); i++) { cp=input; l=length; while (l > 0) { if (l > 1) { t0= (DES_LONG)(*(cp++)); t0|=(DES_LONG)Q_B1(*(cp++)); l--; } else t0= (DES_LONG)(*(cp++)); l--; t0+=z0; t0&=0xffffffffL; t1=z1; z0=((((t0*t0)&0xffffffffL)+((t1*t1)&0xffffffffL)) &0xffffffffL)%0x7fffffffL; z1=((t0*((t1+NOISE)&0xffffffffL))&0xffffffffL)%0x7fffffffL; } if (lp != NULL) { *lp++ = z0; *lp++ = z1; } } return(z0); } crypto/des/qud_cksm.c:120: error: BUFFER_OVERRUN_L1 Offset: [1, +oo] Size: 1. Showing all 5 steps of the trace crypto/des/qud_cksm.c:76:1: <Length trace> 74. #define NOISE ((DES_LONG)83653421L) 75. 76. > DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], 77. long length, int out_count, DES_cblock *seed) 78. { crypto/des/qud_cksm.c:76:1: Parameter `(*output)[*]` 74. #define NOISE ((DES_LONG)83653421L) 75. 76. > DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], 77. long length, int out_count, DES_cblock *seed) 78. { crypto/des/qud_cksm.c:86:2: Assignment 84. 85. if (out_count < 1) out_count=1; 86. lp = (DES_LONG *) &(output[0])[0]; ^ 87. 88. z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); crypto/des/qud_cksm.c:119:5: Assignment 117. /* The MIT library assumes that the checksum is 118. * composed of 2*out_count 32 bit ints */ 119. *lp++ = z0; ^ 120. *lp++ = z1; 121. } crypto/des/qud_cksm.c:120:4: Array access: Offset: [1, +oo] Size: 1 118. * composed of 2*out_count 32 bit ints */ 119. *lp++ = z0; 120. *lp++ = z1; ^ 121. } 122. }
https://github.com/openssl/openssl/blob/fcf64ba0ace1bb76c6e00ca7d0c7cf7f9bebe628/crypto/des/qud_cksm.c/#L120
d2a_code_trace_data_45461
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslcorrupttest.c:244: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslcorrupttest.c:223:10: Call 221. 222. /* BIO is freed by create_ssl_connection on error */ 223. if (!TEST_true(create_ssl_objects(sctx, cctx, &server, &client, NULL, ^ 224. c_to_s_fbio))) 225. goto end; test/ssltestlib.c:580:21: Call 578. 579. if (*sssl == NULL) 580. serverssl = SSL_new(serverctx); ^ 581. else 582. serverssl = *sssl; ssl/ssl_lib.c:521:1: Parameter `ctx->sessions->num_nodes` 519. } 520. 521. > SSL *SSL_new(SSL_CTX *ctx) 522. { 523. SSL *s; test/sslcorrupttest.c:244:5: Call 242. testresult = 1; 243. end: 244. SSL_free(server); ^ 245. SSL_free(client); 246. SSL_CTX_free(sctx); ssl/ssl_lib.c:963:1: Parameter `s->ctx->sessions->num_nodes` 961. } 962. 963. > void SSL_free(SSL *s) 964. { 965. int i; ssl/ssl_lib.c:1030:5: Call 1028. RECORD_LAYER_release(&s->rlayer); 1029. 1030. SSL_CTX_free(s->ctx); ^ 1031. 1032. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2780:1: Parameter `a->sessions->num_nodes` 2778. } 2779. 2780. > void SSL_CTX_free(SSL_CTX *a) 2781. { 2782. int i; ssl/ssl_lib.c:2806:9: Call 2804. */ 2805. if (a->sessions != NULL) 2806. SSL_CTX_flush_sessions(a, 0); ^ 2807. 2808. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1021:1: Parameter `s->sessions->num_nodes` 1019. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1022. { 1023. unsigned long i; ssl/ssl_sess.c:1034:5: Call 1032. i = lh_SSL_SESSION_get_down_load(s->sessions); 1033. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1034. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1035. lh_SSL_SESSION_set_down_load(s->sessions, i); 1036. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1019:1: Parameter `lh->num_nodes` 1017. } 1018. 1019. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1019:1: Call 1017. } 1018. 1019. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/f3ab6c16c424054c8d6d2c152744dcbaf41c3232/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_45462
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:2302: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 2302, column 10. Showing all 11 steps of the trace ssl/t1_lib.c:2293:1: start of procedure ssl_security_cert_chain() 2291. */ 2292. 2293. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 2294. { 2295. int rv, start_idx, i; ssl/t1_lib.c:2296:9: Taking true branch 2294. { 2295. int rv, start_idx, i; 2296. if (x == NULL) { ^ 2297. x = sk_X509_value(sk, 0); 2298. start_idx = 1; ssl/t1_lib.c:2297:9: 2295. int rv, start_idx, i; 2296. if (x == NULL) { 2297. > x = sk_X509_value(sk, 0); 2298. start_idx = 1; 2299. } else include/openssl/x509.h:99:1: start of procedure sk_X509_value() 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:380:1: start of procedure OPENSSL_sk_value() 378. } 379. 380. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 381. { 382. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:382:9: Taking true branch 380. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 381. { 382. if (st == NULL || i < 0 || i >= st->num) ^ 383. return NULL; 384. return (void *)st->data[i]; crypto/stack/stack.c:383:9: 381. { 382. if (st == NULL || i < 0 || i >= st->num) 383. > return NULL; 384. return (void *)st->data[i]; 385. } crypto/stack/stack.c:385:1: return from a call to OPENSSL_sk_value 383. return NULL; 384. return (void *)st->data[i]; 385. > } 386. 387. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) include/openssl/x509.h:99:1: return from a call to sk_X509_value 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ ssl/t1_lib.c:2298:9: 2296. if (x == NULL) { 2297. x = sk_X509_value(sk, 0); 2298. > start_idx = 1; 2299. } else 2300. start_idx = 0; ssl/t1_lib.c:2302:5: 2300. start_idx = 0; 2301. 2302. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 2303. if (rv != 1) 2304. return rv;
https://github.com/openssl/openssl/blob/405988f2cca816fdfdf8ad62b1285dcf06822e85/ssl/t1_lib.c/#L2302
d2a_code_trace_data_45463
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/statem/statem_srvr.c:853: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 14 steps of the trace ssl/statem/statem_srvr.c:852:10: Call 850. { 851. /* Always use DTLS 1.0 version: see RFC 6347 */ 852. if (!WPACKET_put_bytes_u16(pkt, DTLS1_VERSION) ^ 853. || !WPACKET_sub_memcpy_u8(pkt, cookie, cookie_len)) 854. return 0; 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/statem/statem_srvr.c:853:17: Call 851. /* Always use DTLS 1.0 version: see RFC 6347 */ 852. if (!WPACKET_put_bytes_u16(pkt, DTLS1_VERSION) 853. || !WPACKET_sub_memcpy_u8(pkt, cookie, cookie_len)) ^ 854. return 0; 855. ssl/packet.c:317:1: Parameter `pkt->written` 315. } 316. 317. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 318. size_t lenbytes) 319. { ssl/packet.c:320:10: Call 318. size_t lenbytes) 319. { 320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 321. || !WPACKET_memcpy(pkt, src, len) 322. || !WPACKET_close(pkt)) 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 + 4]):unsigned64 by call to `WPACKET_sub_memcpy__` 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_45464
static int encode_test_init(struct evp_test *t, const char *encoding) { struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; t->expected_err = OPENSSL_strdup("DECODE_ERROR"); if (t->expected_err == NULL) return 0; } else { fprintf(stderr, "Bad encoding: %s. Should be one of " "{canonical, valid, invalid}\n", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1556: error: NULL_DEREFERENCE pointer `edata` last assigned on line 1551 could be null and is dereferenced at line 1556, column 9. Showing all 19 steps of the trace test/evp_test.c:1549:1: start of procedure encode_test_init() 1547. }; 1548. 1549. > static int encode_test_init(struct evp_test *t, const char *encoding) 1550. { 1551. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); test/evp_test.c:1551:5: 1549. static int encode_test_init(struct evp_test *t, const char *encoding) 1550. { 1551. > struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); 1552. 1553. if (strcmp(encoding, "canonical") == 0) { 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 false 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: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) test/evp_test.c:1553:9: Taking false branch 1551. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); 1552. 1553. if (strcmp(encoding, "canonical") == 0) { ^ 1554. edata->encoding = BASE64_CANONICAL_ENCODING; 1555. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1555:16: Taking true branch 1553. if (strcmp(encoding, "canonical") == 0) { 1554. edata->encoding = BASE64_CANONICAL_ENCODING; 1555. } else if (strcmp(encoding, "valid") == 0) { ^ 1556. edata->encoding = BASE64_VALID_ENCODING; 1557. } else if (strcmp(encoding, "invalid") == 0) { test/evp_test.c:1556:9: 1554. edata->encoding = BASE64_CANONICAL_ENCODING; 1555. } else if (strcmp(encoding, "valid") == 0) { 1556. > edata->encoding = BASE64_VALID_ENCODING; 1557. } else if (strcmp(encoding, "invalid") == 0) { 1558. edata->encoding = BASE64_INVALID_ENCODING;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/evp_test.c/#L1556
d2a_code_trace_data_45465
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))); assert(!overlapped); return overlapped; } crypto/pkcs12/p12_decr.c:51: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/pkcs12/p12_decr.c:51:10: Call 49. } 50. 51. if (!EVP_CipherUpdate(ctx, out, &i, in, inlen)) { ^ 52. OPENSSL_free(out); 53. out = NULL; crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_45466
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:276: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 27 steps of the trace crypto/dsa/dsa_ossl.c:230:1: Parameter `ctx_in->stack.depth` 228. } 229. 230. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 231. BIGNUM **kinvp, BIGNUM **rp, 232. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:276:14: Call 274. 275. if (dsa->flags & DSA_FLAG_CACHE_MONT_P) { 276. if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p, ^ 277. CRYPTO_LOCK_DSA, dsa->p, ctx)) 278. goto err; crypto/bn/bn_mont.c:500:1: Parameter `ctx->stack.depth` 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/bn/bn_mont.c:522:10: Call 520. if (ret == NULL) 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 523. BN_MONT_CTX_free(ret); 524. return NULL; crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:428:14: Call 426. tmod.top = buf[0] != 0 ? 1 : 0; 427. /* Ri = R^-1 mod N */ 428. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 429. goto err; 430. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_45467
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/wavpack.c:460: error: Integer Overflow L2 ([1, +oo] - 23):unsigned32 by call to `bitstream_read`. libavcodec/wavpack.c:460:21: Call 458. if (S >= 0x1000000) { 459. if (s->got_extra_bits && bitstream_read_bit(&s->bc_extra_bits)) 460. S = bitstream_read(&s->bc_extra_bits, 23); ^ 461. else 462. S = 0; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 23):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45468
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:1495: error: BUFFER_OVERRUN_S2 Offset added: [`pkt->curr` + 32, `pkt->curr` + 36] (⇐ [`pkt->curr`, `pkt->curr` + 4] + 32) Size: [1, 2147483644] by call to `WPACKET_memcpy`. Showing all 13 steps of the trace ssl/statem/statem_srvr.c:1485:1: Parameter `pkt->curr` 1483. } 1484. 1485. > int tls_construct_server_hello(SSL *s, WPACKET *pkt) 1486. { 1487. int sl, compm, al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_srvr.c:1490:10: Call 1488. size_t len; 1489. 1490. if (!WPACKET_put_bytes_u16(pkt, s->version) ^ 1491. /* 1492. * Random stuff. Filling of the server_random takes place in 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:1495:17: Call 1493. * tls_process_client_hello() 1494. */ 1495. || !WPACKET_memcpy(pkt, s->s3->server_random, SSL3_RANDOM_SIZE)) { ^ 1496. SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_HELLO, ERR_R_INTERNAL_ERROR); 1497. goto err; 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 + 32, pkt->curr + 36] (⇐ [pkt->curr, pkt->curr + 4] + 32) 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_45469
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_nist.c:115: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ecp_nist.c:95:5: Call 93. return 0; 94. 95. BN_CTX_start(ctx); ^ 96. 97. if (BN_ucmp(BN_get0_nist_prime_192(), p) == 0) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ecp_nist.c:115:5: Call 113. 114. err: 115. BN_CTX_end(ctx); ^ 116. BN_CTX_free(new_ctx); 117. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45470
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, 17728] - [256, 320]):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:1348:5: Assignment 1346. /* decrypt in place in 'rr->input' */ 1347. rr->data = rr->input; 1348. rr->orig_len = rr->length; ^ 1349. 1350. if (SSL_USE_ETM(s) && s->read_hash) { 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 `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: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:1264:9: Binary operation: ([0, 17728] - [256, 320]):unsigned64 by call to `dtls1_process_record` 1262. /* This information is public so it's safe to branch based on it. */ 1263. if (rec->orig_len > md_size + 255 + 1) 1264. scan_start = rec->orig_len - (md_size + 255 + 1); ^ 1265. /* 1266. * div_spoiler contains a multiple of md_size that is used to cause the
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1264
d2a_code_trace_data_45471
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1061: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1061:9: 1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) 1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) 1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, ^ 1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1061
d2a_code_trace_data_45472
int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) { PROPERTY_DEFN_ELEM elem, *old, *p = NULL; size_t len; if (prop == NULL) return 1; if (pl == NULL) { elem.prop = prop; lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem); return 1; } len = strlen(prop); p = OPENSSL_malloc(sizeof(*p) + len); if (p != NULL) { p->prop = p->body; p->defn = pl; memcpy(p->body, prop, len + 1); old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); if (old != NULL) { property_defn_free(old); return 1; } if (!lh_PROPERTY_DEFN_ELEM_error(property_defns)) return 1; } OPENSSL_free(p); return 0; } test/property_test.c:341: error: BUFFER_OVERRUN_L3 Offset added: [1, +oo] Size: [0, +oo] by call to `ossl_method_store_add`. Showing all 10 steps of the trace test/property_test.c:324:1: Array declaration 322. } 323. 324. > static int test_query_cache_stochastic(void) 325. { 326. const int max = 10000, tail = 10; test/property_test.c:341:14: Call 339. v[i] = 2 * i; 340. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 341. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 342. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 343. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:186:1: Parameter `*properties` 184. } 185. 186. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 187. int nid, const char *properties, 188. void *method, void (*method_destruct)(void *)) crypto/property/property.c:217:9: Call 215. if ((impl->properties = ossl_parse_property(properties)) == NULL) 216. goto err; 217. ossl_prop_defn_set(properties, impl->properties); ^ 218. } 219. crypto/property/defn_cache.c:76:1: <Offset trace> 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:76:1: Parameter `prop->strlen` 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:89:5: Assignment 87. return 1; 88. } 89. len = strlen(prop); ^ 90. p = OPENSSL_malloc(sizeof(*p) + len); 91. if (p != NULL) { crypto/property/defn_cache.c:76:1: <Length trace> 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:76:1: Parameter `*prop` 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:94:9: Array access: Offset added: [1, +oo] Size: [0, +oo] by call to `ossl_method_store_add` 92. p->prop = p->body; 93. p->defn = pl; 94. memcpy(p->body, prop, len + 1); ^ 95. old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); 96. if (old != NULL) {
https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/property/defn_cache.c/#L94
d2a_code_trace_data_45473
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:1168: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1168:9: 1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) 1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) ^ 1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) 1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1168
d2a_code_trace_data_45474
SwsVector *sws_getGaussianVec(double variance, double quality){ const int length= (int)(variance*quality + 0.5) | 1; int i; double *coeff= av_malloc(length*sizeof(double)); double middle= (length-1)*0.5; SwsVector *vec= av_malloc(sizeof(SwsVector)); vec->coeff= coeff; vec->length= length; for (i=0; i<length; i++) { double dist= i-middle; coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*PI); } sws_normalizeVec(vec, 1.0); return vec; } libswscale/swscale.c:2895: error: Null Dereference pointer `vec` last assigned on line 2893 could be null and is dereferenced at line 2895, column 5. libswscale/swscale.c:2888:1: start of procedure sws_getGaussianVec() 2886. } 2887. 2888. SwsVector *sws_getGaussianVec(double variance, double quality){ ^ 2889. const int length= (int)(variance*quality + 0.5) | 1; 2890. int i; libswscale/swscale.c:2889:5: 2887. 2888. SwsVector *sws_getGaussianVec(double variance, double quality){ 2889. const int length= (int)(variance*quality + 0.5) | 1; ^ 2890. int i; 2891. double *coeff= av_malloc(length*sizeof(double)); libswscale/swscale.c:2891:5: 2889. const int length= (int)(variance*quality + 0.5) | 1; 2890. int i; 2891. double *coeff= av_malloc(length*sizeof(double)); ^ 2892. double middle= (length-1)*0.5; 2893. SwsVector *vec= av_malloc(sizeof(SwsVector)); libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking false branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libswscale/swscale.c:2892:5: 2890. int i; 2891. double *coeff= av_malloc(length*sizeof(double)); 2892. double middle= (length-1)*0.5; ^ 2893. SwsVector *vec= av_malloc(sizeof(SwsVector)); 2894. libswscale/swscale.c:2893:5: 2891. double *coeff= av_malloc(length*sizeof(double)); 2892. double middle= (length-1)*0.5; 2893. SwsVector *vec= av_malloc(sizeof(SwsVector)); ^ 2894. 2895. vec->coeff= coeff; libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking true branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:67:9: 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) 67. ptr = NULL; ^ 68. #elif HAVE_MEMALIGN 69. ptr = memalign(16,size); libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libswscale/swscale.c:2895:5: 2893. SwsVector *vec= av_malloc(sizeof(SwsVector)); 2894. 2895. vec->coeff= coeff; ^ 2896. vec->length= length; 2897.
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libswscale/swscale.c/#L2895
d2a_code_trace_data_45475
static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale){ int16_t rem[64]; DECLARE_ALIGNED_16(DCTELEM, d1[64]); const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int run_tab[65]; int prev_run=0; int prev_level=0; int qmul, qadd, start_i, last_non_zero, i, dc; uint8_t * length; uint8_t * last_length; int lambda; int rle_index, run, q = 1, sum; #ifdef REFINE_STATS static int count=0; static int after_last=0; static int to_zero=0; static int from_zero=0; static int raise=0; static int lower=0; static int messed_sign=0; #endif if(basis[0][0] == 0) build_basis(s->dsp.idct_permutation); qmul= qscale*2; qadd= (qscale-1)|1; if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; } else{ q = 1; qadd=0; } q <<= RECON_SHIFT-3; dc= block[0]*q; start_i = 1; qmat = s->q_intra_matrix[qscale]; length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { dc= 0; start_i = 0; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_non_zero = s->block_last_index[n]; #ifdef REFINE_STATS {START_TIMER #endif dc += (1<<(RECON_SHIFT-1)); for(i=0; i<64; i++){ rem[i]= dc - (orig[i]<<RECON_SHIFT); } #ifdef REFINE_STATS STOP_TIMER("memset rem[]")} #endif sum=0; for(i=0; i<64; i++){ int one= 36; int qns=4; int w; w= FFABS(weight[i]) + qns*one; w= 15 + (48*qns*one + w/2)/w; weight[i] = w; assert(w>0); assert(w<(1<<6)); sum += w*w; } lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6); #ifdef REFINE_STATS {START_TIMER #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; int coeff; if(level){ if(level<0) coeff= qmul*level - qadd; else coeff= qmul*level + qadd; run_tab[rle_index++]=run; run=0; s->dsp.add_8x8basis(rem, basis[j], coeff); }else{ run++; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("init rem[]") } } {START_TIMER #endif for(;;){ int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0); int best_coeff=0; int best_change=0; int run2, best_unquant_change=0, analyze_gradient; #ifdef REFINE_STATS {START_TIMER #endif analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3; if(analyze_gradient){ #ifdef REFINE_STATS {START_TIMER #endif for(i=0; i<64; i++){ int w= weight[i]; d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12); } #ifdef REFINE_STATS STOP_TIMER("rem*w*w")} {START_TIMER #endif s->dsp.fdct(d1); #ifdef REFINE_STATS STOP_TIMER("dct")} #endif } if(start_i){ const int level= block[0]; int change, old_coeff; assert(s->mb_intra); old_coeff= q*level; for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff; new_coeff= q*new_level; if(new_coeff >= 2048 || new_coeff < 0) continue; score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff); if(score<best_score){ best_score= score; best_coeff= 0; best_change= change; best_unquant_change= new_coeff - old_coeff; } } } run=0; rle_index=0; run2= run_tab[rle_index++]; prev_level=0; prev_run=0; for(i=start_i; i<64; i++){ int j= perm_scantable[i]; const int level= block[j]; int change, old_coeff; if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1) break; if(level){ if(level<0) old_coeff= qmul*level - qadd; else old_coeff= qmul*level + qadd; run2= run_tab[rle_index++]; }else{ old_coeff=0; run2--; assert(run2>=0 || i >= last_non_zero ); } for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff, unquant_change; score=0; if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level)) continue; if(new_level){ if(new_level<0) new_coeff= qmul*new_level - qadd; else new_coeff= qmul*new_level + qadd; if(new_coeff >= 2048 || new_coeff <= -2048) continue; if(level){ if(level < 63 && level > -63){ if(i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, new_level+64)] - length[UNI_AC_ENC_INDEX(run, level+64)]; else score += last_length[UNI_AC_ENC_INDEX(run, new_level+64)] - last_length[UNI_AC_ENC_INDEX(run, level+64)]; } }else{ assert(FFABS(new_level)==1); if(analyze_gradient){ int g= d1[ scantable[i] ]; if(g && (g^new_level) >= 0) continue; } if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, 65)] + length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; else score += length[UNI_AC_ENC_INDEX(run, 65)] + last_length[UNI_AC_ENC_INDEX(run2, next_level)] - last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; }else{ score += last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } }else{ new_coeff=0; assert(FFABS(level)==1); if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; else score += last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - last_length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; }else{ score += -last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } score *= lambda; unquant_change= new_coeff - old_coeff; assert((score < 100*lambda && score > -100*lambda) || lambda==0); score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change); if(score<best_score){ best_score= score; best_coeff= i; best_change= change; best_unquant_change= unquant_change; } } if(level){ prev_level= level + 64; if(prev_level&(~127)) prev_level= 0; prev_run= run; run=0; }else{ run++; } } #ifdef REFINE_STATS STOP_TIMER("iterative step")} #endif if(best_change){ int j= perm_scantable[ best_coeff ]; block[j] += best_change; if(best_coeff > last_non_zero){ last_non_zero= best_coeff; assert(block[j]); #ifdef REFINE_STATS after_last++; #endif }else{ #ifdef REFINE_STATS if(block[j]){ if(block[j] - best_change){ if(FFABS(block[j]) > FFABS(block[j] - best_change)){ raise++; }else{ lower++; } }else{ from_zero++; } }else{ to_zero++; } #endif for(; last_non_zero>=start_i; last_non_zero--){ if(block[perm_scantable[last_non_zero]]) break; } } #ifdef REFINE_STATS count++; if(256*256*256*64 % count == 0){ printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number); } #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; if(level){ run_tab[rle_index++]=run; run=0; }else{ run++; } } s->dsp.add_8x8basis(rem, basis[j], best_unquant_change); }else{ break; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("iterative search") } } #endif return last_non_zero; } libavcodec/mpegvideo_enc.c:3473: error: Uninitialized Value The value read from run_tab[_] was never initialized. libavcodec/mpegvideo_enc.c:3473:17: 3471. if(level<0) old_coeff= qmul*level - qadd; 3472. else old_coeff= qmul*level + qadd; 3473. run2= run_tab[rle_index++]; //FIXME ! maybe after last ^ 3474. }else{ 3475. old_coeff=0;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3473
d2a_code_trace_data_45476
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:1442: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 23]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 12 steps of the trace ssl/t1_lib.c:1441:21: Call 1439. 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1441. || !WPACKET_start_sub_packet_u16(pkt) ^ 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) 1443. || !WPACKET_close(pkt)) { ssl/packet.c:205:1: Parameter `pkt->buf->length` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1442:21: Call 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1441. || !WPACKET_start_sub_packet_u16(pkt) 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ^ 1443. || !WPACKET_close(pkt)) { 1444. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:298:1: Parameter `pkt->written` 296. } 297. 298. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 299. size_t lenbytes) 300. { ssl/packet.c:301:10: Call 299. size_t lenbytes) 300. { 301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 302. || !WPACKET_memcpy(pkt, src, len) 303. || !WPACKET_close(pkt)) ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:229:10: Call 227. } 228. 229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 230. return 0; 231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 23]):unsigned64 by call to `WPACKET_sub_memcpy__` 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_45477
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bntest.c:747: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`. Showing all 23 steps of the trace crypto/bn/bntest.c:719:1: Parameter `ctx->stack.depth` 717. } 718. 719. > int test_mont(BIO *bp, BN_CTX *ctx) 720. { 721. BIGNUM a,b,c,d,A,B; crypto/bn/bntest.c:747:3: Call 745. continue; 746. BN_bntest_rand(&n,bits,0,1); 747. BN_MONT_CTX_set(mont,&n,ctx); ^ 748. 749. BN_nnmod(&a,&a,&n,ctx); crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth` 353. } 354. 355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 356. { 357. int ret = 0; crypto/bn/bn_mont.c:360:2: Call 358. BIGNUM *Ri,*R; 359. 360. BN_CTX_start(ctx); ^ 361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err; 362. R= &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_45478
int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, OSSL_PROPERTY_LIST *pl) { PROPERTY_DEFN_ELEM elem, *old, *p = NULL; size_t len; LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns; property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX, &property_defns_method); if (property_defns == NULL) return 0; if (prop == NULL) return 1; if (pl == NULL) { elem.prop = prop; lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem); return 1; } len = strlen(prop); p = OPENSSL_malloc(sizeof(*p) + len); if (p != NULL) { p->prop = p->body; p->defn = pl; memcpy(p->body, prop, len + 1); old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); if (old != NULL) { property_defn_free(old); return 1; } if (!lh_PROPERTY_DEFN_ELEM_error(property_defns)) return 1; } OPENSSL_free(p); return 0; } test/property_test.c:311: error: BUFFER_OVERRUN_L3 Offset added: [1, 37] Size: [0, +oo] by call to `ossl_method_store_add`. Showing all 10 steps of the trace test/property_test.c:277:9: Array declaration 275. char *impl; 276. } impls[] = { 277. { 1, "fast=no, colour=green", "a" }, ^ 278. { 1, "fast, colour=blue", "b" }, 279. { 1, "", "-" }, test/property_test.c:311:14: Call 309. 310. for (i = 0; i < OSSL_NELEM(impls); i++) 311. if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid, ^ 312. impls[i].prop, impls[i].impl, 313. NULL, NULL))) { crypto/property/property.c:177:1: Parameter `*properties` 175. } 176. 177. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, 178. int nid, const char *properties, void *method, 179. int (*method_up_ref)(void *), crypto/property/property.c:216:9: Call 214. if (impl->properties == NULL) 215. goto err; 216. ossl_prop_defn_set(store->ctx, properties, impl->properties); ^ 217. } 218. crypto/property/defn_cache.c:84:1: <Offset trace> 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:84:1: Parameter `prop->strlen` 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:104:5: Assignment 102. return 1; 103. } 104. len = strlen(prop); ^ 105. p = OPENSSL_malloc(sizeof(*p) + len); 106. if (p != NULL) { crypto/property/defn_cache.c:84:1: <Length trace> 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:84:1: Parameter `*prop` 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:109:9: Array access: Offset added: [1, 37] Size: [0, +oo] by call to `ossl_method_store_add` 107. p->prop = p->body; 108. p->defn = pl; 109. memcpy(p->body, prop, len + 1); ^ 110. old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); 111. if (old != NULL) {
https://github.com/openssl/openssl/blob/c1d56231ef6385b557ec72eec508e55ea26ca8b0/crypto/property/defn_cache.c/#L109
d2a_code_trace_data_45479
static int uint32_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it) { uint64_t utmp = 0; uint32_t utmp2 = 0; char *cp; int neg = 0; if (*pval == NULL && !uint64_new(pval, it)) return 0; cp = (char *)*pval; if (!c2i_uint64_int(&utmp, &neg, &cont, len)) return 0; if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) { ASN1err(ASN1_F_UINT32_C2I, ASN1_R_ILLEGAL_NEGATIVE_VALUE); return 0; } if (neg) { if (utmp > ABS_INT32_MIN) { ASN1err(ASN1_F_UINT32_C2I, ASN1_R_TOO_SMALL); return 0; } utmp = 0 - utmp; } else { if (((it->size & INTxx_FLAG_SIGNED) != 0 && utmp > INT32_MAX) || ((it->size & INTxx_FLAG_SIGNED) == 0 && utmp > UINT32_MAX)) { ASN1err(ASN1_F_UINT32_C2I, ASN1_R_TOO_LARGE); return 0; } } utmp2 = (uint32_t)utmp; memcpy(cp, &utmp2, sizeof(utmp2)); return 1; } crypto/asn1/x_int64.c:184: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 2147483648]):unsigned64. Showing all 4 steps of the trace crypto/asn1/x_int64.c:173:10: <RHS trace> 171. 172. cp = (char *)*pval; 173. if (!c2i_uint64_int(&utmp, &neg, &cont, len)) ^ 174. return 0; 175. if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) { crypto/asn1/x_int64.c:173:10: Call 171. 172. cp = (char *)*pval; 173. if (!c2i_uint64_int(&utmp, &neg, &cont, len)) ^ 174. return 0; 175. if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) { crypto/asn1/a_int.c:627:1: Parameter `*ret` 625. 626. /* Internal functions used by x_int64.c */ 627. > int c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, long len) 628. { 629. unsigned char buf[sizeof(uint64_t)]; crypto/asn1/x_int64.c:184:9: Binary operation: (0 - [-oo, 2147483648]):unsigned64 182. return 0; 183. } 184. utmp = 0 - utmp; ^ 185. } else { 186. if (((it->size & INTxx_FLAG_SIGNED) != 0 && utmp > INT32_MAX)
https://github.com/openssl/openssl/blob/d063add7cbdaf82e6208ef01414432320260e974/crypto/asn1/x_int64.c/#L184
d2a_code_trace_data_45480
static void old_print_object_footer(const char *name) { char *str, *p; if (!strcmp(name, "tags")) return; str = p = av_strdup(name); if (!str) return; while (*p) { *p = av_toupper(*p); p++; } avio_printf(probe_out, "[/%s]\n", str); av_freep(&str); } avprobe.c:379: error: Memory Leak memory dynamically allocated by call to `av_strdup()` at line 370, column 15 is not reachable after line 379, column 5. avprobe.c:363:1: start of procedure old_print_object_footer() 361. } 362. 363. static void old_print_object_footer(const char *name) ^ 364. { 365. char *str, *p; avprobe.c:367:10: Taking false branch 365. char *str, *p; 366. 367. if (!strcmp(name, "tags")) ^ 368. return; 369. avprobe.c:370:5: 368. return; 369. 370. str = p = av_strdup(name); ^ 371. if (!str) 372. return; libavutil/mem.c:196:1: start of procedure av_strdup() 194. } 195. 196. char *av_strdup(const char *s) ^ 197. { 198. char *ptr = NULL; libavutil/mem.c:198:5: 196. char *av_strdup(const char *s) 197. { 198. char *ptr = NULL; ^ 199. if (s) { 200. int len = strlen(s) + 1; libavutil/mem.c:199:9: Taking true branch 197. { 198. char *ptr = NULL; 199. if (s) { ^ 200. int len = strlen(s) + 1; 201. ptr = av_realloc(NULL, len); libavutil/mem.c:200:9: 198. char *ptr = NULL; 199. if (s) { 200. int len = strlen(s) + 1; ^ 201. ptr = av_realloc(NULL, len); 202. if (ptr) libavutil/mem.c:201:9: 199. if (s) { 200. int len = strlen(s) + 1; 201. ptr = av_realloc(NULL, len); ^ 202. if (ptr) 203. memcpy(ptr, s, len); libavutil/mem.c:107:1: start of procedure av_realloc() 105. } 106. 107. void *av_realloc(void *ptr, size_t size) ^ 108. { 109. /* let's disallow possibly ambiguous cases */ libavutil/mem.c:110:9: Taking false branch 108. { 109. /* let's disallow possibly ambiguous cases */ 110. if (size > (INT_MAX - 16)) ^ 111. return NULL; 112. libavutil/mem.c:116:5: 114. return _aligned_realloc(ptr, size, 32); 115. #else 116. return realloc(ptr, size); ^ 117. #endif 118. } libavutil/mem.c:118:1: return from a call to av_realloc 116. return realloc(ptr, size); 117. #endif 118. } ^ 119. 120. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:202:13: Taking true branch 200. int len = strlen(s) + 1; 201. ptr = av_realloc(NULL, len); 202. if (ptr) ^ 203. memcpy(ptr, s, len); 204. } libavutil/mem.c:203:13: 201. ptr = av_realloc(NULL, len); 202. if (ptr) 203. memcpy(ptr, s, len); ^ 204. } 205. return ptr; libavutil/mem.c:205:5: 203. memcpy(ptr, s, len); 204. } 205. return ptr; ^ 206. } 207. libavutil/mem.c:206:1: return from a call to av_strdup 204. } 205. return ptr; 206. } ^ 207. 208. char *av_strndup(const char *s, size_t len) avprobe.c:371:10: Taking false branch 369. 370. str = p = av_strdup(name); 371. if (!str) ^ 372. return; 373. while (*p) { avprobe.c:373:12: Loop condition is true. Entering loop body 371. if (!str) 372. return; 373. while (*p) { ^ 374. *p = av_toupper(*p); 375. p++; avprobe.c:374:9: 372. return; 373. while (*p) { 374. *p = av_toupper(*p); ^ 375. p++; 376. } libavutil/avstring.h:182:1: start of procedure av_toupper() 180. * Locale-independent conversion of ASCII characters to uppercase. 181. */ 182. static inline av_const int av_toupper(int c) ^ 183. { 184. if (c >= 'a' && c <= 'z') libavutil/avstring.h:184:9: Taking false branch 182. static inline av_const int av_toupper(int c) 183. { 184. if (c >= 'a' && c <= 'z') ^ 185. c ^= 0x20; 186. return c; libavutil/avstring.h:186:5: 184. if (c >= 'a' && c <= 'z') 185. c ^= 0x20; 186. return c; ^ 187. } 188. libavutil/avstring.h:187:1: return from a call to av_toupper 185. c ^= 0x20; 186. return c; 187. } ^ 188. 189. /** avprobe.c:375:9: 373. while (*p) { 374. *p = av_toupper(*p); 375. p++; ^ 376. } 377. avprobe.c:373:12: Loop condition is false. Leaving loop 371. if (!str) 372. return; 373. while (*p) { ^ 374. *p = av_toupper(*p); 375. p++; avprobe.c:378:5: 376. } 377. 378. avio_printf(probe_out, "[/%s]\n", str); ^ 379. av_freep(&str); 380. } libavformat/aviobuf.c:1014:1: start of procedure avio_printf() 1012. } 1013. 1014. int avio_printf(AVIOContext *s, const char *fmt, ...) ^ 1015. { 1016. va_list ap; libavformat/aviobuf.c:1020:5: 1018. int ret; 1019. 1020. va_start(ap, fmt); ^ 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 1022. va_end(ap); libavformat/aviobuf.c:1021:5: 1019. 1020. va_start(ap, fmt); 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); ^ 1022. va_end(ap); 1023. avio_write(s, buf, strlen(buf)); libavformat/aviobuf.c:1022:5: 1020. va_start(ap, fmt); 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 1022. va_end(ap); ^ 1023. avio_write(s, buf, strlen(buf)); 1024. return ret; libavformat/aviobuf.c:1023:5: Skipping avio_write(): empty list of specs 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 1022. va_end(ap); 1023. avio_write(s, buf, strlen(buf)); ^ 1024. return ret; 1025. } libavformat/aviobuf.c:1024:5: 1022. va_end(ap); 1023. avio_write(s, buf, strlen(buf)); 1024. return ret; ^ 1025. } 1026. libavformat/aviobuf.c:1025:1: return from a call to avio_printf 1023. avio_write(s, buf, strlen(buf)); 1024. return ret; 1025. } ^ 1026. 1027. int avio_pause(AVIOContext *s, int pause) avprobe.c:379:5: Skipping av_freep(): empty list of specs 377. 378. avio_printf(probe_out, "[/%s]\n", str); 379. av_freep(&str); ^ 380. } 381.
https://github.com/libav/libav/blob/d0a603a534a0ee4b255e5e72742428a7f7f42b83/avprobe.c/#L379
d2a_code_trace_data_45481
void TIFFReverseBits(uint8* cp, tmsize_t n) { for (; n > 8; n -= 8) { cp[0] = TIFFBitRevTable[cp[0]]; cp[1] = TIFFBitRevTable[cp[1]]; cp[2] = TIFFBitRevTable[cp[2]]; cp[3] = TIFFBitRevTable[cp[3]]; cp[4] = TIFFBitRevTable[cp[4]]; cp[5] = TIFFBitRevTable[cp[5]]; cp[6] = TIFFBitRevTable[cp[6]]; cp[7] = TIFFBitRevTable[cp[7]]; cp += 8; } while (n-- > 0) *cp = TIFFBitRevTable[*cp], cp++; } tools/tiffmedian.c:769: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteScanline`. tools/tiffmedian.c:748:1: Parameter `out->tif_rawdata` 746. * table entry. 747. */ 748. static void ^ 749. quant(TIFF* in, TIFF* out) 750. { tools/tiffmedian.c:769:7: Call 767. *outptr++ = (unsigned char)histogram[red][green][blue]; 768. } 769. if (TIFFWriteScanline(out, outline, i, 0) < 0) ^ 770. break; 771. } libtiff/tif_write.c:48:1: Parameter `*tif->tif_rawdata` 46. static int TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc); 47. 48. int ^ 49. TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample) 50. { libtiff/tif_write.c:107:8: Call 105. * Changing strips -- flush any data present. 106. */ 107. if (!TIFFFlushData(tif)) ^ 108. return (-1); 109. tif->tif_curstrip = strip; libtiff/tif_flush.c:98:1: Parameter `*tif->tif_rawdata` 96. * problems for other people. 97. */ 98. int ^ 99. TIFFFlushData(TIFF* tif) 100. { libtiff/tif_flush.c:108:10: Call 106. return (0); 107. } 108. return (TIFFFlushData1(tif)); ^ 109. } 110. libtiff/tif_write.c:709:1: Parameter `*tif->tif_rawdata` 707. * for infinite recursion. 708. */ 709. int ^ 710. TIFFFlushData1(TIFF* tif) 711. { libtiff/tif_write.c:715:4: Call 713. if (!isFillOrder(tif, tif->tif_dir.td_fillorder) && 714. (tif->tif_flags & TIFF_NOBITREV) == 0) 715. TIFFReverseBits((uint8*)tif->tif_rawdata, ^ 716. tif->tif_rawcc); 717. if (!TIFFAppendToStrip(tif, libtiff/tif_swab.c:285:1: <Length trace> 283. } 284. 285. void ^ 286. TIFFReverseBits(uint8* cp, tmsize_t n) 287. { libtiff/tif_swab.c:285:1: Parameter `*cp` 283. } 284. 285. void ^ 286. TIFFReverseBits(uint8* cp, tmsize_t n) 287. { libtiff/tif_swab.c:296:3: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteScanline` 294. cp[5] = TIFFBitRevTable[cp[5]]; 295. cp[6] = TIFFBitRevTable[cp[6]]; 296. cp[7] = TIFFBitRevTable[cp[7]]; ^ 297. cp += 8; 298. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L296
d2a_code_trace_data_45482
static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[]=":"; fds=malloc(multi*sizeof *fds); for(n=0 ; n < multi ; ++n) { pipe(fd); if(fork()) { close(fd[1]); fds[n]=fd[0]; } else { close(fd[0]); close(1); dup(fd[1]); close(fd[1]); mr=1; usertime=0; return 0; } printf("Forked child %d\n",n); } for(n=0 ; n < multi ; ++n) { FILE *f; char buf[1024]; char *p; f=fdopen(fds[n],"r"); while(fgets(buf,sizeof buf,f)) { p=strchr(buf,'\n'); if(p) *p='\0'; if(buf[0] != '+') { fprintf(stderr,"Don't understand line '%s' from child %d\n", buf,n); continue; } printf("Got: %s from %d\n",buf,n); if(!strncmp(buf,"+F:",3)) { int alg; int j; p=buf+3; alg=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); for(j=0 ; j < SIZE_NUM ; ++j) results[alg][j]+=atof(sstrsep(&p,sep)); } else if(!strncmp(buf,"+F2:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); else rsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); else rsa_results[k][1]=d; } else if(!strncmp(buf,"+F2:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); else rsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); else rsa_results[k][1]=d; } else if(!strncmp(buf,"+F3:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d); else dsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d); else dsa_results[k][1]=d; } #ifndef OPENSSL_NO_ECDSA else if(!strncmp(buf,"+F4:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d); else ecdsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d); else ecdsa_results[k][1]=d; } #endif #ifndef OPENSSL_NO_ECDH else if(!strncmp(buf,"+F5:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d); else ecdh_results[k][0]=d; } #endif else if(!strncmp(buf,"+H:",3)) { } else fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n); } } return 1; } apps/speed.c:2410: error: NULL_DEREFERENCE pointer `fds` last assigned on line 2403 could be null and is dereferenced at line 2410, column 4. Showing all 9 steps of the trace apps/speed.c:2396:1: start of procedure do_multi() 2394. 2395. #ifdef HAVE_FORK 2396. > static int do_multi(int multi) 2397. { 2398. int n; apps/speed.c:2401:2: 2399. int fd[2]; 2400. int *fds; 2401. > static char sep[]=":"; 2402. 2403. fds=malloc(multi*sizeof *fds); apps/speed.c:2403:2: 2401. static char sep[]=":"; 2402. 2403. > fds=malloc(multi*sizeof *fds); 2404. for(n=0 ; n < multi ; ++n) 2405. { apps/speed.c:2404:6: 2402. 2403. fds=malloc(multi*sizeof *fds); 2404. > for(n=0 ; n < multi ; ++n) 2405. { 2406. pipe(fd); apps/speed.c:2404:12: Loop condition is true. Entering loop body 2402. 2403. fds=malloc(multi*sizeof *fds); 2404. for(n=0 ; n < multi ; ++n) ^ 2405. { 2406. pipe(fd); apps/speed.c:2406:3: 2404. for(n=0 ; n < multi ; ++n) 2405. { 2406. > pipe(fd); 2407. if(fork()) 2408. { apps/speed.c:2407:6: Taking true branch 2405. { 2406. pipe(fd); 2407. if(fork()) ^ 2408. { 2409. close(fd[1]); apps/speed.c:2409:4: 2407. if(fork()) 2408. { 2409. > close(fd[1]); 2410. fds[n]=fd[0]; 2411. } apps/speed.c:2410:4: 2408. { 2409. close(fd[1]); 2410. > fds[n]=fd[0]; 2411. } 2412. else
https://github.com/openssl/openssl/blob/a1d85309ee183c97a5ee4f8277f17d87d7786e25/apps/speed.c/#L2410
d2a_code_trace_data_45483
static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_TOPRIGHT; SRC(0,0)= (t0 + t1 + 1) >> 1; SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2; SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1; SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2; SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1; SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2; SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1; SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2; SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1; SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2; SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1; SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2; SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1; SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2; SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1; SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2; SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1; SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2; SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1; SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2; SRC(7,6)= (t10 + t11 + 1) >> 1; SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2; } libavcodec/h264pred.c:945: error: Uninitialized Value The value read from t7 was never initialized. libavcodec/h264pred.c:945:32: 943. SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2; 944. SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1; 945. SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2; ^ 946. SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1; 947. SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L945
d2a_code_trace_data_45484
int ssl3_new(SSL *s) { SSL3_STATE *s3; if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL) goto err; s->s3 = s3; #ifndef OPENSSL_NO_SRP if (!SSL_SRP_CTX_init(s)) goto err; #endif s->method->ssl_clear(s); return (1); err: return (0); } ssl/s3_lib.c:2905: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 2900, column 15 is not reachable after line 2905, column 10. Showing all 21 steps of the trace ssl/s3_lib.c:2896:1: start of procedure ssl3_new() 2894. } 2895. 2896. > int ssl3_new(SSL *s) 2897. { 2898. SSL3_STATE *s3; ssl/s3_lib.c:2900:9: 2898. SSL3_STATE *s3; 2899. 2900. > if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL) 2901. goto err; 2902. s->s3 = s3; crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking true branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:192:9: 190. FAILTEST(); 191. if (ret != NULL) 192. > memset(ret, 0, num); 193. return ret; 194. } crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) ssl/s3_lib.c:2900:9: Taking false branch 2898. SSL3_STATE *s3; 2899. 2900. if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL) ^ 2901. goto err; 2902. s->s3 = s3; ssl/s3_lib.c:2902:5: 2900. if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL) 2901. goto err; 2902. > s->s3 = s3; 2903. 2904. #ifndef OPENSSL_NO_SRP ssl/s3_lib.c:2905:10: Skipping SSL_SRP_CTX_init(): empty list of specs 2903. 2904. #ifndef OPENSSL_NO_SRP 2905. if (!SSL_SRP_CTX_init(s)) ^ 2906. goto err; 2907. #endif
https://github.com/openssl/openssl/blob/60d685d196e8d594d754751e4852f01d80d8c0cc/ssl/s3_lib.c/#L2905
d2a_code_trace_data_45485
SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section) { STACK_OF(CONF_VALUE) *sk_conf = NULL; SSL_TEST_CTX *ctx = NULL; int i; size_t j; if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section)) || !TEST_ptr(ctx = SSL_TEST_CTX_new())) goto err; for (i = 0; i < sk_CONF_VALUE_num(sk_conf); i++) { int found = 0; const CONF_VALUE *option = sk_CONF_VALUE_value(sk_conf, i); if (strcmp(option->name, "client") == 0) { if (!parse_client_options(&ctx->extra.client, conf, option->value)) goto err; } else if (strcmp(option->name, "server") == 0) { if (!parse_server_options(&ctx->extra.server, conf, option->value)) goto err; } else if (strcmp(option->name, "server2") == 0) { if (!parse_server_options(&ctx->extra.server2, conf, option->value)) goto err; } else if (strcmp(option->name, "resume-client") == 0) { if (!parse_client_options(&ctx->resume_extra.client, conf, option->value)) goto err; } else if (strcmp(option->name, "resume-server") == 0) { if (!parse_server_options(&ctx->resume_extra.server, conf, option->value)) goto err; } else if (strcmp(option->name, "resume-server2") == 0) { if (!parse_server_options(&ctx->resume_extra.server2, conf, option->value)) goto err; } else { for (j = 0; j < OSSL_NELEM(ssl_test_ctx_options); j++) { if (strcmp(option->name, ssl_test_ctx_options[j].name) == 0) { if (!ssl_test_ctx_options[j].parse(ctx, option->value)) { TEST_info("Bad value %s for option %s", option->value, option->name); goto err; } found = 1; break; } } if (!found) { TEST_info("Unknown test option: %s", option->name); goto err; } } } goto done; err: SSL_TEST_CTX_free(ctx); ctx = NULL; done: return ctx; } test/ssl_test_ctx.c:803: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 747 could be null and is dereferenced by call to `SSL_TEST_CTX_free()` at line 803, column 5. Showing all 50 steps of the trace test/ssl_test_ctx.c:744:1: start of procedure SSL_TEST_CTX_create() 742. } 743. 744. > SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section) 745. { 746. STACK_OF(CONF_VALUE) *sk_conf = NULL; test/ssl_test_ctx.c:746:5: 744. SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section) 745. { 746. > STACK_OF(CONF_VALUE) *sk_conf = NULL; 747. SSL_TEST_CTX *ctx = NULL; 748. int i; test/ssl_test_ctx.c:747:5: 745. { 746. STACK_OF(CONF_VALUE) *sk_conf = NULL; 747. > SSL_TEST_CTX *ctx = NULL; 748. int i; 749. size_t j; test/ssl_test_ctx.c:751:10: 749. size_t j; 750. 751. > if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section)) 752. || !TEST_ptr(ctx = SSL_TEST_CTX_new())) 753. goto err; crypto/conf/conf_lib.c:244:1: start of procedure NCONF_get_section() 242. } 243. 244. > STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) 245. { 246. if (conf == NULL) { crypto/conf/conf_lib.c:246:9: Taking false branch 244. STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) 245. { 246. if (conf == NULL) { ^ 247. CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_CONF); 248. return NULL; crypto/conf/conf_lib.c:251:9: Taking false branch 249. } 250. 251. if (section == NULL) { ^ 252. CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_SECTION); 253. return NULL; crypto/conf/conf_lib.c:256:5: 254. } 255. 256. > return _CONF_get_section_values(conf, section); 257. } 258. crypto/conf/conf_api.c:35:1: start of procedure _CONF_get_section_values() 33. 34. /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 35. > STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 36. const char *section) 37. { crypto/conf/conf_api.c:40:5: 38. CONF_VALUE *v; 39. 40. > v = _CONF_get_section(conf, section); 41. if (v != NULL) 42. return ((STACK_OF(CONF_VALUE) *)v->value); crypto/conf/conf_api.c:22:1: start of procedure _CONF_get_section() 20. 21. /* Up until OpenSSL 0.9.5a, this was get_section */ 22. > CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) 23. { 24. CONF_VALUE *v, vv; crypto/conf/conf_api.c:26:10: Taking false branch 24. CONF_VALUE *v, vv; 25. 26. if ((conf == NULL) || (section == NULL)) ^ 27. return (NULL); 28. vv.name = NULL; crypto/conf/conf_api.c:26:28: Taking false branch 24. CONF_VALUE *v, vv; 25. 26. if ((conf == NULL) || (section == NULL)) ^ 27. return (NULL); 28. vv.name = NULL; crypto/conf/conf_api.c:28:5: 26. if ((conf == NULL) || (section == NULL)) 27. return (NULL); 28. > vv.name = NULL; 29. vv.section = (char *)section; 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); crypto/conf/conf_api.c:29:5: 27. return (NULL); 28. vv.name = NULL; 29. > vv.section = (char *)section; 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. return (v); crypto/conf/conf_api.c:30:5: 28. vv.name = NULL; 29. vv.section = (char *)section; 30. > v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. return (v); 32. } include/openssl/conf.h:32:1: start of procedure lh_CONF_VALUE_retrieve() 30. 31. DEFINE_STACK_OF(CONF_VALUE) 32. > DEFINE_LHASH_OF(CONF_VALUE); 33. 34. struct conf_st; crypto/lhash/lhash.c:134:1: start of procedure OPENSSL_LH_retrieve() 132. } 133. 134. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data) 135. { 136. unsigned long hash; crypto/lhash/lhash.c:141:5: 139. int scratch; 140. 141. > lh->error = 0; 142. rn = getrn(lh, data, &hash); 143. crypto/lhash/lhash.c:142:5: Skipping getrn(): empty list of specs 140. 141. lh->error = 0; 142. rn = getrn(lh, data, &hash); ^ 143. 144. if (*rn == NULL) { crypto/lhash/lhash.c:144:9: Taking false branch 142. rn = getrn(lh, data, &hash); 143. 144. if (*rn == NULL) { ^ 145. CRYPTO_atomic_add(&lh->num_retrieve_miss, 1, &scratch, lh->retrieve_stats_lock); 146. return NULL; crypto/lhash/lhash.c:148:9: 146. return NULL; 147. } else { 148. > ret = (*rn)->data; 149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } crypto/lhash/lhash.c:149:9: 147. } else { 148. ret = (*rn)->data; 149. > CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } 151. return ret; crypto/threads_pthread.c:152:1: start of procedure CRYPTO_atomic_add() 150. } 151. 152. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) 153. { 154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) crypto/threads_pthread.c:155:9: Taking false branch 153. { 154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) 155. if (__atomic_is_lock_free(sizeof(*val), val)) { ^ 156. *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL); 157. return 1; crypto/threads_pthread.c:160:10: 158. } 159. # endif 160. > if (!CRYPTO_THREAD_write_lock(lock)) 161. return 0; 162. crypto/threads_pthread.c:64:1: start of procedure CRYPTO_THREAD_write_lock() 62. } 63. 64. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock) 65. { 66. # ifdef USE_RWLOCK crypto/threads_pthread.c:67:9: Taking true branch 65. { 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) ^ 68. return 0; 69. # else crypto/threads_pthread.c:68:9: 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) 68. > return 0; 69. # else 70. if (pthread_mutex_lock(lock) != 0) crypto/threads_pthread.c:75:1: return from a call to CRYPTO_THREAD_write_lock 73. 74. return 1; 75. > } 76. 77. int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock) crypto/threads_pthread.c:160:10: Taking true branch 158. } 159. # endif 160. if (!CRYPTO_THREAD_write_lock(lock)) ^ 161. return 0; 162. crypto/threads_pthread.c:161:9: 159. # endif 160. if (!CRYPTO_THREAD_write_lock(lock)) 161. > return 0; 162. 163. *val += amount; crypto/threads_pthread.c:170:1: return from a call to CRYPTO_atomic_add 168. 169. return 1; 170. > } 171. 172. # ifdef OPENSSL_SYS_UNIX crypto/lhash/lhash.c:151:5: 149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } 151. > return ret; 152. } 153. crypto/lhash/lhash.c:152:1: return from a call to OPENSSL_LH_retrieve 150. } 151. return ret; 152. > } 153. 154. static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, include/openssl/conf.h:32:1: return from a call to lh_CONF_VALUE_retrieve 30. 31. DEFINE_STACK_OF(CONF_VALUE) 32. > DEFINE_LHASH_OF(CONF_VALUE); 33. 34. struct conf_st; crypto/conf/conf_api.c:31:5: 29. vv.section = (char *)section; 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. > return (v); 32. } 33. crypto/conf/conf_api.c:32:1: return from a call to _CONF_get_section 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. return (v); 32. > } 33. 34. /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ crypto/conf/conf_api.c:41:9: Taking true branch 39. 40. v = _CONF_get_section(conf, section); 41. if (v != NULL) ^ 42. return ((STACK_OF(CONF_VALUE) *)v->value); 43. else crypto/conf/conf_api.c:42:9: 40. v = _CONF_get_section(conf, section); 41. if (v != NULL) 42. > return ((STACK_OF(CONF_VALUE) *)v->value); 43. else 44. return (NULL); crypto/conf/conf_api.c:45:1: return from a call to _CONF_get_section_values 43. else 44. return (NULL); 45. > } 46. 47. int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) crypto/conf/conf_lib.c:257:1: return from a call to NCONF_get_section 255. 256. return _CONF_get_section_values(conf, section); 257. > } 258. 259. char *NCONF_get_string(const CONF *conf, const char *group, const char *name) test/testutil/tests.c:227:1: start of procedure test_ptr() 225. } 226. 227. > int test_ptr(const char *file, int line, const char *s, const void *p) 228. { 229. if (p != NULL) test/testutil/tests.c:229:9: Taking false branch 227. int test_ptr(const char *file, int line, const char *s, const void *p) 228. { 229. if (p != NULL) ^ 230. return 1; 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); test/testutil/tests.c:231:5: Skipping test_fail_message(): empty list of specs 229. if (p != NULL) 230. return 1; 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); ^ 232. return 0; 233. } test/testutil/tests.c:232:5: 230. return 1; 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 232. > return 0; 233. } 234. test/testutil/tests.c:233:1: return from a call to test_ptr 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 232. return 0; 233. > } 234. 235. int test_true(const char *file, int line, const char *s, int b) test/ssl_test_ctx.c:751:10: Taking true branch 749. size_t j; 750. 751. if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section)) ^ 752. || !TEST_ptr(ctx = SSL_TEST_CTX_new())) 753. goto err; test/ssl_test_ctx.c:802:2: 800. goto done; 801. 802. > err: 803. SSL_TEST_CTX_free(ctx); 804. ctx = NULL; test/ssl_test_ctx.c:803:5: 801. 802. err: 803. > SSL_TEST_CTX_free(ctx); 804. ctx = NULL; 805. done:
https://github.com/openssl/openssl/blob/f1b97da1fd90cf3935eafedc8df0d0165cb75f2f/test/ssl_test_ctx.c/#L803
d2a_code_trace_data_45486
void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; const 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((void *)ret); } ssl/s3_pkt.c:792: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_get_record`. Showing all 13 steps of the trace ssl/s3_pkt.c:728:1: Parameter `s->ctx->sessions->num_items` 726. * none of our business 727. */ 728. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) 729. { 730. int al,i,j,ret; ssl/s3_pkt.c:792:7: Call 790. if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) 791. { 792. ret=ssl3_get_record(s); ^ 793. if (ret <= 0) return(ret); 794. } ssl/s3_pkt.c:231:1: Parameter `s->ctx->sessions->num_items` 229. */ 230. /* used only by ssl3_read_bytes */ 231. > static int ssl3_get_record(SSL *s) 232. { 233. int ssl_major,ssl_minor,al; ssl/s3_pkt.c:452:2: Call 450. SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); 451. f_err: 452. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 453. err: 454. return(ret); ssl/s3_pkt.c:1176:1: Parameter `s->ctx->sessions->num_items` 1174. } 1175. 1176. > void ssl3_send_alert(SSL *s, int level, int desc) 1177. { 1178. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1183:3: Call 1181. /* If a fatal one, remove from cache */ 1182. if ((level == 2) && (s->session != NULL)) 1183. SSL_CTX_remove_session(s->ctx,s->session); ^ 1184. 1185. s->s3->alert_dispatch=1; ssl/ssl_sess.c:464:1: Parameter `ctx->sessions->num_items` 462. } 463. 464. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 465. { 466. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:466:9: Call 464. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 465. { 466. return remove_session_lock(ctx, c, 1); ^ 467. } 468. ssl/ssl_sess.c:469:1: Parameter `ctx->sessions->num_items` 467. } 468. 469. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 470. { 471. SSL_SESSION *r; ssl/ssl_sess.c:477:20: Call 475. { 476. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 477. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 478. if (r != NULL) 479. { crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_get_record` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/ee60d9fb282030be3f25e951b86d74d8f2dd1bdd/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_45487
static int utf8len(const uint8_t *b) { int len = 0; int val; while (*b) { GET_UTF8(val, *b++, return -1;) len++; } return len; } libavformat/movenc.c:1841: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32. libavformat/movenc.c:1836:1: <LHS trace> 1834. } 1835. 1836. static int utf8len(const uint8_t *b) ^ 1837. { 1838. int len = 0; libavformat/movenc.c:1836:1: Parameter `*b` 1834. } 1835. 1836. static int utf8len(const uint8_t *b) ^ 1837. { 1838. int len = 0; libavformat/movenc.c:1841:9: Assignment 1839. int val; 1840. while (*b) { 1841. GET_UTF8(val, *b++, return -1;) ^ 1842. len++; 1843. } libavformat/movenc.c:1841:9: Assignment 1839. int val; 1840. while (*b) { 1841. GET_UTF8(val, *b++, return -1;) ^ 1842. len++; 1843. } libavformat/movenc.c:1841:9: Binary operation: ([0, +oo] - 1):unsigned32 1839. int val; 1840. while (*b) { 1841. GET_UTF8(val, *b++, return -1;) ^ 1842. len++; 1843. }
https://github.com/libav/libav/blob/636ced8e1dc8248a1353b416240b93d70ad03edb/libavformat/movenc.c/#L1841
d2a_code_trace_data_45488
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, AVMEDIA_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 = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (subtitle_stream_copy) { st->stream_copy = 1; } else { set_context_opts(avcodec_opts[AVMEDIA_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, AVMEDIA_TYPE_SUBTITLE, 1, subtitle_enc->strict_std_compliance); output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name); } nb_ocodecs++; if (subtitle_language) { av_metadata_set2(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3564: error: Null Dereference pointer `st` last assigned on line 3559 could be null and is dereferenced at line 3564, column 35. ffmpeg.c:3554:1: start of procedure new_subtitle_stream() 3552. } 3553. 3554. static void new_subtitle_stream(AVFormatContext *oc) ^ 3555. { 3556. AVStream *st; ffmpeg.c:3559:5: 3557. AVCodecContext *subtitle_enc; 3558. 3559. st = av_new_stream(oc, oc->nb_streams); ^ 3560. if (!st) { 3561. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2465:1: start of procedure av_new_stream() 2463. } 2464. 2465. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2466. { 2467. AVStream *st; libavformat/utils.c:2470:9: Taking true branch 2468. int i; 2469. 2470. if (s->nb_streams >= MAX_STREAMS) ^ 2471. return NULL; 2472. libavformat/utils.c:2471:9: 2469. 2470. if (s->nb_streams >= MAX_STREAMS) 2471. return NULL; ^ 2472. 2473. st = av_mallocz(sizeof(AVStream)); libavformat/utils.c:2505:1: return from a call to av_new_stream 2503. s->streams[s->nb_streams++] = st; 2504. return st; 2505. } ^ 2506. 2507. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3560:10: Taking true branch 3558. 3559. st = av_new_stream(oc, oc->nb_streams); 3560. if (!st) { ^ 3561. fprintf(stderr, "Could not alloc stream\n"); 3562. av_exit(1); ffmpeg.c:3561:9: 3559. st = av_new_stream(oc, oc->nb_streams); 3560. if (!st) { 3561. fprintf(stderr, "Could not alloc stream\n"); ^ 3562. av_exit(1); 3563. } ffmpeg.c:3562:9: Skipping av_exit(): empty list of specs 3560. if (!st) { 3561. fprintf(stderr, "Could not alloc stream\n"); 3562. av_exit(1); ^ 3563. } 3564. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); ffmpeg.c:3564:5: 3562. av_exit(1); 3563. } 3564. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); ^ 3565. 3566. bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
https://github.com/libav/libav/blob/27241cbffe180fc92f9f519c6ea7957fc4b3b0c9/ffmpeg.c/#L3564
d2a_code_trace_data_45489
int X509_check_trust(X509 *x, int id, int flags) { X509_TRUST *pt; int idx; if (id == 0) { int rv; rv = obj_trust(NID_anyExtendedKeyUsage, x, 0); if (rv != X509_TRUST_UNTRUSTED) return rv; return trust_compat(NULL, x, 0); } idx = X509_TRUST_get_by_id(id); if (idx == -1) return default_trust(id, x, flags); pt = X509_TRUST_get0(idx); return pt->check_trust(pt, x, flags); } crypto/x509/x509_trs.c:132: error: NULL_DEREFERENCE pointer `pt` last assigned on line 131 could be null and is dereferenced at line 132, column 12. Showing all 40 steps of the trace crypto/x509/x509_trs.c:115:1: start of procedure X509_check_trust() 113. } 114. 115. > int X509_check_trust(X509 *x, int id, int flags) 116. { 117. X509_TRUST *pt; crypto/x509/x509_trs.c:121:9: Taking false branch 119. 120. /* We get this as a default value */ 121. if (id == 0) { ^ 122. int rv; 123. rv = obj_trust(NID_anyExtendedKeyUsage, x, 0); crypto/x509/x509_trs.c:128:5: 126. return trust_compat(NULL, x, 0); 127. } 128. > idx = X509_TRUST_get_by_id(id); 129. if (idx == -1) 130. return default_trust(id, x, flags); crypto/x509/x509_trs.c:151:1: start of procedure X509_TRUST_get_by_id() 149. } 150. 151. > int X509_TRUST_get_by_id(int id) 152. { 153. X509_TRUST tmp; crypto/x509/x509_trs.c:155:10: Taking true branch 153. X509_TRUST tmp; 154. int idx; 155. if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX)) ^ 156. return id - X509_TRUST_MIN; 157. tmp.trust = id; crypto/x509/x509_trs.c:155:36: Taking false branch 153. X509_TRUST tmp; 154. int idx; 155. if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX)) ^ 156. return id - X509_TRUST_MIN; 157. tmp.trust = id; crypto/x509/x509_trs.c:157:5: 155. if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX)) 156. return id - X509_TRUST_MIN; 157. > tmp.trust = id; 158. if (!trtable) 159. return -1; crypto/x509/x509_trs.c:158:10: Taking false branch 156. return id - X509_TRUST_MIN; 157. tmp.trust = id; 158. if (!trtable) ^ 159. return -1; 160. idx = sk_X509_TRUST_find(trtable, &tmp); crypto/x509/x509_trs.c:160:11: Condition is true 158. if (!trtable) 159. return -1; 160. idx = sk_X509_TRUST_find(trtable, &tmp); ^ 161. if (idx == -1) 162. return -1; crypto/x509/x509_trs.c:160:11: Condition is true 158. if (!trtable) 159. return -1; 160. idx = sk_X509_TRUST_find(trtable, &tmp); ^ 161. if (idx == -1) 162. return -1; crypto/x509/x509_trs.c:160:5: 158. if (!trtable) 159. return -1; 160. > idx = sk_X509_TRUST_find(trtable, &tmp); 161. if (idx == -1) 162. return -1; crypto/stack/stack.c:249:1: start of procedure sk_find() 247. } 248. 249. > int sk_find(_STACK *st, void *data) 250. { 251. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); crypto/stack/stack.c:251:5: 249. int sk_find(_STACK *st, void *data) 250. { 251. > return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 252. } 253. crypto/stack/stack.c:225:1: start of procedure internal_find() 223. } 224. 225. > static int internal_find(_STACK *st, void *data, int ret_val_options) 226. { 227. const void *const *r; crypto/stack/stack.c:230:9: Taking false branch 228. int i; 229. 230. if (st == NULL) ^ 231. return -1; 232. crypto/stack/stack.c:233:9: Taking true branch 231. return -1; 232. 233. if (st->comp == NULL) { ^ 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) crypto/stack/stack.c:234:14: 232. 233. if (st->comp == NULL) { 234. > for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) 236. return (i); crypto/stack/stack.c:234:21: Loop condition is true. Entering loop body 232. 233. if (st->comp == NULL) { 234. for (i = 0; i < st->num; i++) ^ 235. if (st->data[i] == data) 236. return (i); crypto/stack/stack.c:235:17: Taking true branch 233. if (st->comp == NULL) { 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) ^ 236. return (i); 237. return (-1); crypto/stack/stack.c:236:17: 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) 236. > return (i); 237. return (-1); 238. } crypto/stack/stack.c:247:1: return from a call to internal_find 245. return (-1); 246. return (int)((char **)r - st->data); 247. > } 248. 249. int sk_find(_STACK *st, void *data) crypto/stack/stack.c:252:1: return from a call to sk_find 250. { 251. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 252. > } 253. 254. int sk_find_ex(_STACK *st, void *data) crypto/x509/x509_trs.c:161:9: Taking false branch 159. return -1; 160. idx = sk_X509_TRUST_find(trtable, &tmp); 161. if (idx == -1) ^ 162. return -1; 163. return idx + X509_TRUST_COUNT; crypto/x509/x509_trs.c:163:5: 161. if (idx == -1) 162. return -1; 163. > return idx + X509_TRUST_COUNT; 164. } 165. crypto/x509/x509_trs.c:164:1: return from a call to X509_TRUST_get_by_id 162. return -1; 163. return idx + X509_TRUST_COUNT; 164. > } 165. 166. int X509_TRUST_set(int *t, int trust) crypto/x509/x509_trs.c:129:9: Taking false branch 127. } 128. idx = X509_TRUST_get_by_id(id); 129. if (idx == -1) ^ 130. return default_trust(id, x, flags); 131. pt = X509_TRUST_get0(idx); crypto/x509/x509_trs.c:131:5: 129. if (idx == -1) 130. return default_trust(id, x, flags); 131. > pt = X509_TRUST_get0(idx); 132. return pt->check_trust(pt, x, flags); 133. } crypto/x509/x509_trs.c:142:1: start of procedure X509_TRUST_get0() 140. } 141. 142. > X509_TRUST *X509_TRUST_get0(int idx) 143. { 144. if (idx < 0) crypto/x509/x509_trs.c:144:9: Taking false branch 142. X509_TRUST *X509_TRUST_get0(int idx) 143. { 144. if (idx < 0) ^ 145. return NULL; 146. if (idx < (int)X509_TRUST_COUNT) crypto/x509/x509_trs.c:146:9: Taking false branch 144. if (idx < 0) 145. return NULL; 146. if (idx < (int)X509_TRUST_COUNT) ^ 147. return trstandard + idx; 148. return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT); crypto/x509/x509_trs.c:148:12: Condition is true 146. if (idx < (int)X509_TRUST_COUNT) 147. return trstandard + idx; 148. return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT); ^ 149. } 150. crypto/x509/x509_trs.c:148:5: 146. if (idx < (int)X509_TRUST_COUNT) 147. return trstandard + idx; 148. > return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT); 149. } 150. crypto/stack/stack.c:324:1: start of procedure sk_value() 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:326:10: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:17: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:28: Taking true branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:327:9: 325. { 326. if (!st || (i < 0) || (i >= st->num)) 327. > return NULL; 328. return st->data[i]; 329. } crypto/stack/stack.c:329:1: return from a call to sk_value 327. return NULL; 328. return st->data[i]; 329. > } 330. 331. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_trs.c:149:1: return from a call to X509_TRUST_get0 147. return trstandard + idx; 148. return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT); 149. > } 150. 151. int X509_TRUST_get_by_id(int id) crypto/x509/x509_trs.c:132:5: 130. return default_trust(id, x, flags); 131. pt = X509_TRUST_get0(idx); 132. > return pt->check_trust(pt, x, flags); 133. } 134.
https://github.com/openssl/openssl/blob/e29c73c93b88a4b7f492c7c8c7343223e7548612/crypto/x509/x509_trs.c/#L132
d2a_code_trace_data_45490
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) { int j, len; const char *s, *ss, *p; if (dir == NULL || !*dir) { X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); return 0; } s = dir; p = s; do { if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { BY_DIR_ENTRY *ent; ss = s; s = p + 1; len = (int)(p - ss); if (len == 0) continue; for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); if (strlen(ent->dir) == (size_t)len && strncmp(ent->dir, ss, (unsigned int)len) == 0) break; } if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) continue; if (ctx->dirs == NULL) { ctx->dirs = sk_BY_DIR_ENTRY_new_null(); if (!ctx->dirs) { X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); return 0; } } ent = OPENSSL_malloc(sizeof(*ent)); if (ent == NULL) return 0; ent->dir_type = type; ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); ent->dir = OPENSSL_malloc((unsigned int)len + 1); if (ent->dir == NULL || ent->hashes == NULL) { by_dir_entry_free(ent); return 0; } strncpy(ent->dir, ss, (unsigned int)len); ent->dir[len] = '\0'; if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { by_dir_entry_free(ent); return 0; } } } while (*p++ != '\0'); return 1; } crypto/x509/by_dir.c:236: error: MEMORY_LEAK memory dynamically allocated by call to `sk_BY_DIR_HASH_new()` at line 233, column 27 is not reachable after line 236, column 17. Showing all 149 steps of the trace crypto/x509/by_dir.c:194:1: start of procedure add_cert_dir() 192. } 193. 194. > static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) 195. { 196. int j, len; crypto/x509/by_dir.c:199:9: Taking false branch 197. const char *s, *ss, *p; 198. 199. if (dir == NULL || !*dir) { ^ 200. X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); 201. return 0; crypto/x509/by_dir.c:199:25: Taking false branch 197. const char *s, *ss, *p; 198. 199. if (dir == NULL || !*dir) { ^ 200. X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); 201. return 0; crypto/x509/by_dir.c:204:5: 202. } 203. 204. > s = dir; 205. p = s; 206. do { crypto/x509/by_dir.c:205:5: 203. 204. s = dir; 205. > p = s; 206. do { 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { crypto/x509/by_dir.c:207:14: Taking true branch 205. p = s; 206. do { 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { ^ 208. BY_DIR_ENTRY *ent; 209. ss = s; crypto/x509/by_dir.c:209:13: 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { 208. BY_DIR_ENTRY *ent; 209. > ss = s; 210. s = p + 1; 211. len = (int)(p - ss); crypto/x509/by_dir.c:210:13: 208. BY_DIR_ENTRY *ent; 209. ss = s; 210. > s = p + 1; 211. len = (int)(p - ss); 212. if (len == 0) crypto/x509/by_dir.c:211:13: 209. ss = s; 210. s = p + 1; 211. > len = (int)(p - ss); 212. if (len == 0) 213. continue; crypto/x509/by_dir.c:212:17: Taking false branch 210. s = p + 1; 211. len = (int)(p - ss); 212. if (len == 0) ^ 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { crypto/x509/by_dir.c:214:18: 212. if (len == 0) 213. continue; 214. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/by_dir.c:214:25: 212. if (len == 0) 213. continue; 214. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_num() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking true branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:320:9: 318. { 319. if (st == NULL) 320. > return -1; 321. return st->num; 322. } crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_num 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:214:25: Loop condition is false. Leaving loop 212. if (len == 0) 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ^ 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/by_dir.c:220:17: 218. break; 219. } 220. > if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) 221. continue; 222. if (ctx->dirs == NULL) { crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_num() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking true branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:320:9: 318. { 319. if (st == NULL) 320. > return -1; 321. return st->num; 322. } crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_num 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:220:17: Taking false branch 218. break; 219. } 220. if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) ^ 221. continue; 222. if (ctx->dirs == NULL) { crypto/x509/by_dir.c:222:17: Taking true branch 220. if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) 221. continue; 222. if (ctx->dirs == NULL) { ^ 223. ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 224. if (!ctx->dirs) { crypto/x509/by_dir.c:223:17: 221. continue; 222. if (ctx->dirs == NULL) { 223. > ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 224. if (!ctx->dirs) { 225. X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_new_null() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_new_null 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:224:22: Taking false branch 222. if (ctx->dirs == NULL) { 223. ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 224. if (!ctx->dirs) { ^ 225. X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); 226. return 0; crypto/x509/by_dir.c:229:13: 227. } 228. } 229. > ent = OPENSSL_malloc(sizeof(*ent)); 230. if (ent == NULL) 231. return 0; 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/x509/by_dir.c:230:17: Taking false branch 228. } 229. ent = OPENSSL_malloc(sizeof(*ent)); 230. if (ent == NULL) ^ 231. return 0; 232. ent->dir_type = type; crypto/x509/by_dir.c:232:13: 230. if (ent == NULL) 231. return 0; 232. > ent->dir_type = type; 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); crypto/x509/by_dir.c:233:13: 231. return 0; 232. ent->dir_type = type; 233. > ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_HASH_new() 117. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. > DEFINE_STACK_OF(BY_DIR_HASH) 120. DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_HASH_new 117. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. > DEFINE_STACK_OF(BY_DIR_HASH) 120. DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/by_dir.c:234:13: 232. ent->dir_type = type; 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. > ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { 236. by_dir_entry_free(ent); 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 true branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:125:9: 123. 124. if (num <= 0) 125. > return NULL; 126. 127. allow_customize = 0; 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/x509/by_dir.c:235:17: Taking true branch 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { ^ 236. by_dir_entry_free(ent); 237. return 0; crypto/x509/by_dir.c:236:17: 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { 236. > by_dir_entry_free(ent); 237. return 0; 238. } crypto/x509/by_dir.c:177:1: start of procedure by_dir_entry_free() 175. } 176. 177. > static void by_dir_entry_free(BY_DIR_ENTRY *ent) 178. { 179. OPENSSL_free(ent->dir); crypto/x509/by_dir.c:179:5: 177. static void by_dir_entry_free(BY_DIR_ENTRY *ent) 178. { 179. > OPENSSL_free(ent->dir); 180. sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 181. OPENSSL_free(ent); crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/x509/by_dir.c:180:5: 178. { 179. OPENSSL_free(ent->dir); 180. > sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 181. OPENSSL_free(ent); 182. } crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_HASH_pop_free() 117. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. > DEFINE_STACK_OF(BY_DIR_HASH) 120. DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_HASH_pop_free 117. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. > DEFINE_STACK_OF(BY_DIR_HASH) 120. DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/by_dir.c:181:5: 179. OPENSSL_free(ent->dir); 180. sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 181. > OPENSSL_free(ent); 182. } 183. crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/x509/by_dir.c:182:1: return from a call to by_dir_entry_free 180. sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 181. OPENSSL_free(ent); 182. > } 183. 184. static void free_dir(X509_LOOKUP *lu)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509/by_dir.c/#L236
d2a_code_trace_data_45491
int ctr_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, const unsigned char *adin, size_t adinlen) { RAND_DRBG_CTR *ctr = &drbg->ctr; if (adin != NULL && adinlen != 0) { ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0); if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) { adin = NULL; adinlen = 1; } } else { adinlen = 0; } for ( ; ; ) { inc_128(ctr); if (outlen < 16) { AES_encrypt(ctr->V, ctr->K, &ctr->ks); memcpy(out, ctr->K, outlen); break; } AES_encrypt(ctr->V, out, &ctr->ks); out += 16; outlen -= 16; if (outlen == 0) break; } ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0); return 1; } ssl/statem/statem_clnt.c:3052: error: BUFFER_OVERRUN_L3 Offset added: [1, 15] Size: [0, +oo] by call to `ssl_randbytes`. Showing all 11 steps of the trace ssl/statem/statem_clnt.c:3040:5: Assignment 3038. 3039. /* Otherwise, generate ephemeral key pair */ 3040. pmslen = 32; ^ 3041. pms = OPENSSL_malloc(pmslen); 3042. if (pms == NULL) { ssl/statem/statem_clnt.c:3052:12: Call 3050. * TODO(size_t): Convert this function 3051. */ 3052. || ssl_randbytes(s, pms, (int)pmslen) <= 0) { ^ 3053. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_GOST, 3054. ERR_R_INTERNAL_ERROR); ssl/ssl_lib.c:5172:1: Parameter `size` 5170. } 5171. 5172. > int ssl_randbytes(SSL *s, unsigned char *rnd, size_t size) 5173. { 5174. if (s->drbg != NULL) { ssl/ssl_lib.c:5187:17: Call 5185. * here. 5186. */ 5187. return RAND_DRBG_generate(s->drbg, rnd, size, 0, NULL, 0); ^ 5188. } 5189. return RAND_bytes(rnd, (int)size); crypto/rand/drbg_lib.c:363:1: Parameter `outlen` 361. * 362. */ 363. > int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, 364. int prediction_resistance, 365. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_lib.c:409:10: Call 407. } 408. 409. if (!ctr_generate(drbg, out, outlen, adin, adinlen)) { ^ 410. drbg->state = DRBG_ERROR; 411. RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_GENERATE_ERROR); crypto/rand/drbg_rand.c:266:1: <Offset trace> 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:266:1: Parameter `outlen` 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:266:1: <Length trace> 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:266:1: Parameter `drbg->ctr.K[*]` 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:288:13: Array access: Offset added: [1, 15] Size: [0, +oo] by call to `ssl_randbytes` 286. /* Use K as temp space as it will be updated */ 287. AES_encrypt(ctr->V, ctr->K, &ctr->ks); 288. memcpy(out, ctr->K, outlen); ^ 289. break; 290. }
https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/crypto/rand/drbg_rand.c/#L288
d2a_code_trace_data_45492
static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_LEFT; PREDICT_8x8_LOAD_TOPLEFT; SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2; SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2; SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2; SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2; SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2; SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2; SRC(0,1)=SRC(1,2)=SRC(2,3)=SRC(3,4)=SRC(4,5)=SRC(5,6)=SRC(6,7)= (l1 + 2*l0 + lt + 2) >> 2; SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)=SRC(4,4)=SRC(5,5)=SRC(6,6)=SRC(7,7)= (l0 + 2*lt + t0 + 2) >> 2; SRC(1,0)=SRC(2,1)=SRC(3,2)=SRC(4,3)=SRC(5,4)=SRC(6,5)=SRC(7,6)= (lt + 2*t0 + t1 + 2) >> 2; SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2; SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2; SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2; SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2; SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2; SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2; } libavcodec/h264pred.c:871: error: Uninitialized Value The value read from t7 was never initialized. libavcodec/h264pred.c:871:5: 869. SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2; 870. SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2; 871. SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2; ^ 872. 873. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L871
d2a_code_trace_data_45493
ngx_int_t ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, ngx_uint_t flags) { size_t len; u_char *p; ngx_str_t *name; ngx_uint_t i, k, n, skip, last; ngx_array_t *keys, *hwc; ngx_hash_key_t *hk; last = key->len; if (flags & NGX_HASH_WILDCARD_KEY) { n = 0; for (i = 0; i < key->len; i++) { if (key->data[i] == '*') { if (++n > 1) { return NGX_DECLINED; } } if (key->data[i] == '.' && key->data[i + 1] == '.') { return NGX_DECLINED; } } if (key->len > 1 && key->data[0] == '.') { skip = 1; goto wildcard; } if (key->len > 2) { if (key->data[0] == '*' && key->data[1] == '.') { skip = 2; goto wildcard; } if (key->data[i - 2] == '.' && key->data[i - 1] == '*') { skip = 0; last -= 2; goto wildcard; } } if (n) { return NGX_DECLINED; } } k = 0; for (i = 0; i < last; i++) { if (!(flags & NGX_HASH_READONLY_KEY)) { key->data[i] = ngx_tolower(key->data[i]); } k = ngx_hash(k, key->data[i]); } k %= ha->hsize; name = ha->keys_hash[k].elts; if (name) { for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (last != name[i].len) { continue; } if (ngx_strncmp(key->data, name[i].data, last) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } *name = *key; hk = ngx_array_push(&ha->keys); if (hk == NULL) { return NGX_ERROR; } hk->key = *key; hk->key_hash = ngx_hash_key(key->data, last); hk->value = value; return NGX_OK; wildcard: k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip); k %= ha->hsize; if (skip == 1) { name = ha->keys_hash[k].elts; if (name) { len = last - skip; for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } name->len = last - 1; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, &key->data[1], name->len); } if (skip) { p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } len = 0; n = 0; for (i = last - 1; i; i--) { if (key->data[i] == '.') { ngx_memcpy(&p[n], &key->data[i + 1], len); n += len; p[n++] = '.'; len = 0; continue; } len++; } if (len) { ngx_memcpy(&p[n], &key->data[1], len); n += len; } p[n] = '\0'; hwc = &ha->dns_wc_head; keys = &ha->dns_wc_head_hash[k]; } else { last++; p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } ngx_cpystrn(p, key->data, last); hwc = &ha->dns_wc_tail; keys = &ha->dns_wc_tail_hash[k]; } name = keys->elts; if (name) { len = last - skip; for (i = 0; i < keys->nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(keys); if (name == NULL) { return NGX_ERROR; } name->len = last - skip; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, key->data + skip, name->len); hk = ngx_array_push(hwc); if (hk == NULL) { return NGX_ERROR; } hk->key.len = last - 1; hk->key.data = p; hk->key_hash = 0; hk->value = value; return NGX_OK; } src/http/modules/ngx_http_referer_module.c:399: error: Buffer Overrun L3 Offset added: [11, 18] (⇐ [0, 2] + [11, 16]) Size: [8, 120] by call to `ngx_http_add_variable`. src/http/modules/ngx_http_referer_module.c:397:5: Assignment 395. ngx_http_core_srv_conf_t *cscf; 396. 397. ngx_str_set(&name, "invalid_referer"); ^ 398. 399. var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); src/http/modules/ngx_http_referer_module.c:399:11: Call 397. ngx_str_set(&name, "invalid_referer"); 398. 399. var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); ^ 400. if (var == NULL) { 401. return NGX_CONF_ERROR; src/http/ngx_http_variables.c:349:1: Parameter `name->len` 347. 348. 349. ngx_http_variable_t * ^ 350. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags) 351. { src/http/ngx_http_variables.c:390:5: Assignment 388. } 389. 390. v->name.len = name->len; ^ 391. v->name.data = ngx_pnalloc(cf->pool, name->len); 392. if (v->name.data == NULL) { src/http/ngx_http_variables.c:404:10: Call 402. v->index = 0; 403. 404. rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0); ^ 405. 406. if (rc == NGX_ERROR) { src/core/ngx_hash.c:742:13: <Offset trace> 740. 741. if (key->len > 1 && key->data[0] == '.') { 742. skip = 1; ^ 743. goto wildcard; 744. } src/core/ngx_hash.c:742:13: Assignment 740. 741. if (key->len > 1 && key->data[0] == '.') { 742. skip = 1; ^ 743. goto wildcard; 744. } src/core/ngx_hash.c:956:5: Assignment 954. } 955. 956. name->len = last - skip; ^ 957. name->data = ngx_pnalloc(ha->temp_pool, name->len); 958. if (name->data == NULL) { src/core/ngx_hash.c:706:1: <Length trace> 704. 705. 706. ngx_int_t ^ 707. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 708. ngx_uint_t flags) src/core/ngx_hash.c:706:1: Parameter `*key->data` 704. 705. 706. ngx_int_t ^ 707. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 708. ngx_uint_t flags) src/core/ngx_hash.c:962:5: Array access: Offset added: [11, 18] (⇐ [0, 2] + [11, 16]) Size: [8, 120] by call to `ngx_http_add_variable` 960. } 961. 962. ngx_memcpy(name->data, key->data + skip, name->len); ^ 963. 964.
https://github.com/nginx/nginx/blob/2c0ea0fcc854a1ba0c717fa78b03ac7faee12829/src/core/ngx_hash.c/#L962
d2a_code_trace_data_45494
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1213: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_div`. Showing all 10 steps of the trace test/bntest.c:1213:10: Call 1211. goto err; 1212. 1213. if (!BN_div(ret, ret2, a, b, ctx) ^ 1214. || !equalBN("A / B", quotient, ret) 1215. || !equalBN("A % B", remainder, ret2) crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <LHS trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_div` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45495
void bn_correct_top(BIGNUM *a) { BN_ULONG *ftl; int tmp_top = a->top; if (tmp_top > 0) { for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ftl--; if (*ftl != 0) break; } a->top = tmp_top; } if (a->top == 0) a->neg = 0; bn_pollute(a); } crypto/bn/bn_mod.c:90: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`. Showing all 14 steps of the trace crypto/bn/bn_mod.c:84:14: Call 82. 83. BN_CTX_start(ctx); 84. if ((t = BN_CTX_get(ctx)) == NULL) ^ 85. goto err; 86. if (a == b) { 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/bn/bn_mod.c:90:14: Call 88. goto err; 89. } else { 90. if (!BN_mul(t, a, b, ctx)) ^ 91. goto err; 92. } crypto/bn/bn_mul.c:879:13: Assignment 877. if (bn_wexpand(rr, 16) == NULL) 878. goto err; 879. rr->top = 16; ^ 880. bn_mul_comba8(rr->d, a->d, b->d); 881. goto end; crypto/bn/bn_mul.c:972:5: Call 970. end: 971. #endif 972. bn_correct_top(rr); ^ 973. if (r != rr && BN_copy(r, rr) == NULL) 974. goto err; crypto/bn/bn_lib.c:1021:1: <Offset trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `a->top` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1024:5: Assignment 1022. { 1023. BN_ULONG *ftl; 1024. int tmp_top = a->top; ^ 1025. 1026. if (tmp_top > 0) { crypto/bn/bn_lib.c:1021:1: <Length trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `*a->d` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul` 1025. 1026. if (tmp_top > 0) { 1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ^ 1028. ftl--; 1029. if (*ftl != 0)
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L1027
d2a_code_trace_data_45496
static int parse_icy(HTTPContext *s, const char *tag, const char *p) { int len = 4 + strlen(p) + strlen(tag); int is_first = !s->icy_metadata_headers; int ret; if (s->icy_metadata_headers) len += strlen(s->icy_metadata_headers); if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) return ret; if (is_first) *s->icy_metadata_headers = '\0'; av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p); return 0; } libavformat/http.c:431: error: Null Dereference pointer `s->icy_metadata_headers` last assigned on line 427 could be null and is dereferenced at line 431, column 9. libavformat/http.c:418:1: start of procedure parse_icy() 416. 417. // Concat all Icy- header lines 418. static int parse_icy(HTTPContext *s, const char *tag, const char *p) ^ 419. { 420. int len = 4 + strlen(p) + strlen(tag); libavformat/http.c:420:5: 418. static int parse_icy(HTTPContext *s, const char *tag, const char *p) 419. { 420. int len = 4 + strlen(p) + strlen(tag); ^ 421. int is_first = !s->icy_metadata_headers; 422. int ret; libavformat/http.c:421:21: Condition is false 419. { 420. int len = 4 + strlen(p) + strlen(tag); 421. int is_first = !s->icy_metadata_headers; ^ 422. int ret; 423. libavformat/http.c:421:20: 419. { 420. int len = 4 + strlen(p) + strlen(tag); 421. int is_first = !s->icy_metadata_headers; ^ 422. int ret; 423. libavformat/http.c:421:5: 419. { 420. int len = 4 + strlen(p) + strlen(tag); 421. int is_first = !s->icy_metadata_headers; ^ 422. int ret; 423. libavformat/http.c:424:9: Taking false branch 422. int ret; 423. 424. if (s->icy_metadata_headers) ^ 425. len += strlen(s->icy_metadata_headers); 426. libavformat/http.c:427:9: 425. len += strlen(s->icy_metadata_headers); 426. 427. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) ^ 428. return ret; 429. libavutil/mem.c:140:1: start of procedure av_reallocp() 138. } 139. 140. int av_reallocp(void *ptr, size_t size) ^ 141. { 142. void **ptrptr = ptr; libavutil/mem.c:142:5: 140. int av_reallocp(void *ptr, size_t size) 141. { 142. void **ptrptr = ptr; ^ 143. void *ret; 144. libavutil/mem.c:145:10: Taking true branch 143. void *ret; 144. 145. if (!size) { ^ 146. av_freep(ptr); 147. return 0; libavutil/mem.c:146:9: 144. 145. if (!size) { 146. av_freep(ptr); ^ 147. return 0; 148. } libavutil/mem.c:198:1: start of procedure av_freep() 196. } 197. 198. void av_freep(void *arg) ^ 199. { 200. void **ptr = (void **)arg; libavutil/mem.c:200:5: 198. void av_freep(void *arg) 199. { 200. void **ptr = (void **)arg; ^ 201. av_free(*ptr); 202. *ptr = NULL; libavutil/mem.c:201:5: 199. { 200. void **ptr = (void **)arg; 201. av_free(*ptr); ^ 202. *ptr = NULL; 203. } libavutil/mem.c:186:1: start of procedure av_free() 184. } 185. 186. void av_free(void *ptr) ^ 187. { 188. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:194:5: 192. _aligned_free(ptr); 193. #else 194. free(ptr); ^ 195. #endif 196. } libavutil/mem.c:196:1: return from a call to av_free 194. free(ptr); 195. #endif 196. } ^ 197. 198. void av_freep(void *arg) libavutil/mem.c:202:5: 200. void **ptr = (void **)arg; 201. av_free(*ptr); 202. *ptr = NULL; ^ 203. } 204. libavutil/mem.c:203:1: return from a call to av_freep 201. av_free(*ptr); 202. *ptr = NULL; 203. } ^ 204. 205. void *av_mallocz(size_t size) libavutil/mem.c:147:9: 145. if (!size) { 146. av_freep(ptr); 147. return 0; ^ 148. } 149. ret = av_realloc(*ptrptr, size); libavutil/mem.c:158:1: return from a call to av_reallocp 156. *ptrptr = ret; 157. return 0; 158. } ^ 159. 160. void *av_realloc_array(void *ptr, size_t nmemb, size_t size) libavformat/http.c:427:9: Taking false branch 425. len += strlen(s->icy_metadata_headers); 426. 427. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) ^ 428. return ret; 429. libavformat/http.c:430:9: Taking true branch 428. return ret; 429. 430. if (is_first) ^ 431. *s->icy_metadata_headers = '\0'; 432. libavformat/http.c:431:9: 429. 430. if (is_first) 431. *s->icy_metadata_headers = '\0'; ^ 432. 433. av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
https://github.com/libav/libav/blob/6a463e7fb4f028c52d2e2d054f9483f4fff492bc/libavformat/http.c/#L431
d2a_code_trace_data_45497
void TIFFSwabLong8(uint64* lp) { register unsigned char* cp = (unsigned char*) lp; unsigned char t; assert(sizeof(uint64)==8); t = cp[7]; cp[7] = cp[0]; cp[0] = t; t = cp[6]; cp[6] = cp[1]; cp[1] = t; t = cp[5]; cp[5] = cp[2]; cp[2] = t; t = cp[4]; cp[4] = cp[3]; cp[3] = t; } libtiff/tif_dirwrite.c:855: error: Buffer Overrun L3 Offset: [71, +oo] (⇐ [64, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8`. libtiff/tif_dirwrite.c:345:1: Parameter `tif->tif_diroff` 343. } 344. 345. static int ^ 346. TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) 347. { libtiff/tif_dirwrite.c:792:9: Call 790. } 791. } 792. dirmem=_TIFFmalloc(dirsize); ^ 793. if (dirmem==NULL) 794. { libtiff/tif_unix.c:253:1: Parameter `s` 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:10: Array declaration 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:256:2: Assignment 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_dirwrite.c:792:2: Assignment 790. } 791. } 792. dirmem=_TIFFmalloc(dirsize); ^ 793. if (dirmem==NULL) 794. { libtiff/tif_dirwrite.c:837:3: Assignment 835. uint8* n; 836. TIFFDirEntry* o; 837. n=dirmem; ^ 838. *(uint64*)n=ndir; 839. if (tif->tif_flags&TIFF_SWAB) libtiff/tif_dirwrite.c:841:3: Assignment 839. if (tif->tif_flags&TIFF_SWAB) 840. TIFFSwabLong8((uint64*)n); 841. n+=8; ^ 842. o=dir; 843. for (m=0; m<ndir; m++) libtiff/tif_dirwrite.c:848:4: Assignment 846. if (tif->tif_flags&TIFF_SWAB) 847. TIFFSwabShort((uint16*)n); 848. n+=2; ^ 849. *(uint16*)n=o->tdir_type; 850. if (tif->tif_flags&TIFF_SWAB) libtiff/tif_dirwrite.c:852:4: Assignment 850. if (tif->tif_flags&TIFF_SWAB) 851. TIFFSwabShort((uint16*)n); 852. n+=2; ^ 853. _TIFFmemcpy(n,&o->tdir_count,8); 854. if (tif->tif_flags&TIFF_SWAB) libtiff/tif_dirwrite.c:855:5: Call 853. _TIFFmemcpy(n,&o->tdir_count,8); 854. if (tif->tif_flags&TIFF_SWAB) 855. TIFFSwabLong8((uint64*)n); ^ 856. n+=8; 857. _TIFFmemcpy(n,&o->tdir_offset,8); libtiff/tif_swab.c:58:1: <Length trace> 56. 57. #ifndef TIFFSwabLong8 58. void ^ 59. TIFFSwabLong8(uint64* lp) 60. { libtiff/tif_swab.c:58:1: Parameter `*lp` 56. 57. #ifndef TIFFSwabLong8 58. void ^ 59. TIFFSwabLong8(uint64* lp) 60. { libtiff/tif_swab.c:61:2: Assignment 59. TIFFSwabLong8(uint64* lp) 60. { 61. register unsigned char* cp = (unsigned char*) lp; ^ 62. unsigned char t; 63. assert(sizeof(uint64)==8); libtiff/tif_swab.c:64:6: Array access: Offset: [71, +oo] (⇐ [64, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8` 62. unsigned char t; 63. assert(sizeof(uint64)==8); 64. t = cp[7]; cp[7] = cp[0]; cp[0] = t; ^ 65. t = cp[6]; cp[6] = cp[1]; cp[1] = t; 66. t = cp[5]; cp[5] = cp[2]; cp[2] = t;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L64
d2a_code_trace_data_45498
static int nss_keylog_int(const char *prefix, SSL *ssl, const uint8_t *parameter_1, size_t parameter_1_len, const uint8_t *parameter_2, size_t parameter_2_len) { char *out = NULL; char *cursor = NULL; size_t out_len = 0; size_t i; size_t prefix_len; if (ssl->ctx->keylog_callback == NULL) return 1; prefix_len = strlen(prefix); out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE); return 0; } strcpy(cursor, prefix); cursor += prefix_len; *cursor++ = ' '; for (i = 0; i < parameter_1_len; i++) { sprintf(cursor, "%02x", parameter_1[i]); cursor += 2; } *cursor++ = ' '; for (i = 0; i < parameter_2_len; i++) { sprintf(cursor, "%02x", parameter_2[i]); cursor += 2; } *cursor = '\0'; ssl->ctx->keylog_callback(ssl, (const char *)out); OPENSSL_free(out); return 1; } ssl/statem/statem_clnt.c:2867: error: BUFFER_OVERRUN_L3 Offset: 3 Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange`. Showing all 13 steps of the trace ssl/statem/statem_clnt.c:2820:5: Assignment 2818. } 2819. 2820. pmslen = SSL_MAX_MASTER_KEY_LENGTH; ^ 2821. pms = OPENSSL_malloc(pmslen); 2822. if (pms == NULL) { ssl/statem/statem_clnt.c:2867:10: Call 2865. 2866. /* Log the premaster secret, if logging is enabled. */ 2867. if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) { ^ 2868. /* SSLfatal() already called */ 2869. goto err; ssl/ssl_lib.c:4940:1: Parameter `premaster_len` 4938. } 4939. 4940. > int ssl_log_rsa_client_key_exchange(SSL *ssl, 4941. const uint8_t *encrypted_premaster, 4942. size_t encrypted_premaster_len, ssl/ssl_lib.c:4953:12: Call 4951. 4952. /* We only want the first 8 bytes of the encrypted premaster as a tag. */ 4953. return nss_keylog_int("RSA", ^ 4954. ssl, 4955. encrypted_premaster, ssl/ssl_lib.c:4887:1: <Offset trace> 4885. } 4886. 4887. > static int nss_keylog_int(const char *prefix, 4888. SSL *ssl, 4889. const uint8_t *parameter_1, ssl/ssl_lib.c:4887:1: Parameter `prefix->strlen` 4885. } 4886. 4887. > static int nss_keylog_int(const char *prefix, 4888. SSL *ssl, 4889. const uint8_t *parameter_1, ssl/ssl_lib.c:4887:1: <Length trace> 4885. } 4886. 4887. > static int nss_keylog_int(const char *prefix, 4888. SSL *ssl, 4889. const uint8_t *parameter_1, ssl/ssl_lib.c:4887:1: Parameter `parameter_2_len` 4885. } 4886. 4887. > static int nss_keylog_int(const char *prefix, 4888. SSL *ssl, 4889. const uint8_t *parameter_1, ssl/ssl_lib.c:4911:5: Assignment 4909. */ 4910. prefix_len = strlen(prefix); 4911. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; ^ 4912. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { 4913. SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, ssl/ssl_lib.c:4912:25: Call 4910. prefix_len = strlen(prefix); 4911. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; 4912. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { ^ 4913. SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, 4914. ERR_R_MALLOC_FAILURE); crypto/mem.c:198:9: Assignment 196. 197. if (num == 0) 198. return NULL; ^ 199. 200. FAILTEST(); ssl/ssl_lib.c:4912:16: Assignment 4910. prefix_len = strlen(prefix); 4911. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; 4912. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { ^ 4913. SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, 4914. ERR_R_MALLOC_FAILURE); ssl/ssl_lib.c:4918:5: Array access: Offset: 3 Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange` 4916. } 4917. 4918. strcpy(cursor, prefix); ^ 4919. cursor += prefix_len; 4920. *cursor++ = ' ';
https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/ssl/ssl_lib.c/#L4918
d2a_code_trace_data_45499
static dav_error * dav_validate_resource_state(apr_pool_t *p, const dav_resource *resource, dav_lockdb *lockdb, const dav_if_header *if_header, int flags, dav_buffer *pbuf, request_rec *r) { dav_error *err; const char *uri; const char *etag; const dav_hooks_locks *locks_hooks = (lockdb ? lockdb->hooks : NULL); const dav_if_header *ifhdr_scan; dav_if_state_list *state_list; dav_lock *lock_list; dav_lock *lock; int num_matched; int num_that_apply; int seen_locktoken; apr_size_t uri_len; const char *reason = NULL; if (lockdb == NULL) { lock_list = NULL; } else { if ((err = dav_lock_query(lockdb, resource, &lock_list)) != NULL) { return dav_push_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, "The locks could not be queried for " "verification against a possible \"If:\" " "header.", err); } } if (flags & DAV_LOCKSCOPE_EXCLUSIVE) { if (lock_list != NULL) { return dav_new_error(p, HTTP_LOCKED, 0, 0, "Existing lock(s) on the requested resource " "prevent an exclusive lock."); } seen_locktoken = 1; } else if (flags & DAV_LOCKSCOPE_SHARED) { for (lock = lock_list; lock != NULL; lock = lock->next) { if (lock->scope == DAV_LOCKSCOPE_EXCLUSIVE) { return dav_new_error(p, HTTP_LOCKED, 0, 0, "The requested resource is already " "locked exclusively."); } } seen_locktoken = 1; } else { seen_locktoken = (lock_list == NULL); } if (if_header == NULL) { if (seen_locktoken) return NULL; return dav_new_error(p, HTTP_LOCKED, 0, 0, "This resource is locked and an \"If:\" header " "was not supplied to allow access to the " "resource."); } if (lock_list == NULL && if_header->dummy_header) { if (flags & DAV_VALIDATE_IS_PARENT) return NULL; return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the \"Lock-Token:\" " "header is invalid because this resource has no " "outstanding locks."); } uri = resource->uri; uri_len = strlen(uri); if (uri[uri_len - 1] == '/') { dav_set_bufsize(p, pbuf, uri_len); memcpy(pbuf->buf, uri, uri_len); pbuf->buf[--uri_len] = '\0'; uri = pbuf->buf; } etag = (*resource->hooks->getetag)(resource); num_that_apply = 0; for (ifhdr_scan = if_header; ifhdr_scan != NULL; ifhdr_scan = ifhdr_scan->next) { if (ifhdr_scan->uri != NULL && (uri_len != ifhdr_scan->uri_len || memcmp(uri, ifhdr_scan->uri, uri_len) != 0)) { continue; } ++num_that_apply; for (state_list = ifhdr_scan->state; state_list != NULL; state_list = state_list->next) { switch(state_list->type) { case dav_if_etag: { const char *given_etag, *current_etag; int mismatch; if (state_list->etag[0] == 'W' && state_list->etag[1] == '/') { given_etag = state_list->etag + 2; } else { given_etag = state_list->etag; } if (etag[0] == 'W' && etag[1] == '/') { current_etag = etag + 2; } else { current_etag = etag; } mismatch = strcmp(given_etag, current_etag); if (state_list->condition == DAV_IF_COND_NORMAL && mismatch) { reason = "an entity-tag was specified, but the resource's " "actual ETag does not match."; goto state_list_failed; } else if (state_list->condition == DAV_IF_COND_NOT && !mismatch) { reason = "an entity-tag was specified using the \"Not\" form, " "but the resource's actual ETag matches the provided " "entity-tag."; goto state_list_failed; } break; } case dav_if_opaquelock: if (lockdb == NULL) { if (state_list->condition == DAV_IF_COND_NOT) { continue; } reason = "a State-token was supplied, but a lock database " "is not available for to provide the required lock."; goto state_list_failed; } num_matched = 0; for (lock = lock_list; lock != NULL; lock = lock->next) { if ((*locks_hooks->compare_locktoken)(state_list->locktoken, lock->locktoken)) { continue; } seen_locktoken = 1; if (state_list->condition == DAV_IF_COND_NOT) { reason = "a State-token was supplied, which used a " "\"Not\" condition. The State-token was found " "in the locks on this resource"; goto state_list_failed; } if (lock->auth_user && (!r->user || strcmp(lock->auth_user, r->user))) { const char *errmsg; errmsg = apr_pstrcat(p, "User \"", r->user, "\" submitted a locktoken created " "by user \"", lock->auth_user, "\".", NULL); return dav_new_error(p, HTTP_FORBIDDEN, 0, 0, errmsg); } num_matched = 1; break; } if (num_matched == 0 && state_list->condition == DAV_IF_COND_NORMAL) { reason = "a State-token was supplied, but it was not found " "in the locks on this resource."; goto state_list_failed; } break; case dav_if_unknown: if (state_list->condition == DAV_IF_COND_NORMAL) { reason = "an unknown state token was supplied"; goto state_list_failed; } break; } } if (seen_locktoken) { return NULL; } break; state_list_failed: ; } if (ifhdr_scan == NULL) { if (num_that_apply == 0) { if (seen_locktoken) return NULL; if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { return NULL; } return dav_new_error(p, HTTP_LOCKED, 0 , 0, "This resource is locked and the \"If:\" " "header did not specify one of the " "locktokens for this resource's lock(s)."); } if (if_header->dummy_header) { return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the " "\"Lock-Token:\" header did not specify one " "of this resource's locktoken(s)."); } if (reason == NULL) { return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0, "The preconditions specified by the \"If:\" " "header did not match this resource."); } return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0, apr_psprintf(p, "The precondition(s) specified by " "the \"If:\" header did not match " "this resource. At least one " "failure is because: %s", reason)); } if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { return NULL; } if (if_header->dummy_header) { return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the " "\"Lock-Token:\" header did not specify one " "of this resource's locktoken(s)."); } return dav_new_error(p, HTTP_LOCKED, 1 , 0, "This resource is locked and the \"If:\" header " "did not specify one of the " "locktokens for this resource's lock(s)."); } modules/dav/main/mod_dav.c:2765: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `dav_validate_request`. modules/dav/main/mod_dav.c:2733:18: Call 2731. 2732. /* get and parse the Depth header value. "0" and "infinity" are legal. */ 2733. if ((depth = dav_get_depth(r, DAV_INFINITY)) < 0) { ^ 2734. /* dav_get_depth() supplies additional information for the 2735. * default message. */ modules/dav/main/mod_dav.c:641:25: Unknown value from: apr_table_get 639. DAV_DECLARE(int) dav_get_depth(request_rec *r, int def_depth) 640. { 641. const char *depth = apr_table_get(r->headers_in, "Depth"); ^ 642. 643. if (depth == NULL) { modules/dav/main/mod_dav.c:2765:19: Call 2763. */ 2764. if (is_move 2765. && (err = dav_validate_request(r, resource, depth, NULL, ^ 2766. &multi_response, 2767. DAV_VALIDATE_PARENT modules/dav/main/util.c:1455:1: Parameter `resource->uri->strlen` 1453. ** error is necessary, response will point to it, else NULL. 1454. */ 1455. DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r, ^ 1456. dav_resource *resource, 1457. int depth, modules/dav/main/util.c:1586:15: Call 1584. } 1585. else { 1586. err = dav_validate_resource_state(r->pool, resource, lockdb, ^ 1587. if_header, flags, &work_buf, r); 1588. } modules/dav/main/util.c:802:1: <LHS trace> 800. * Returns NULL if path/uri meets if-header and lock requirements 801. */ 802. static dav_error * dav_validate_resource_state(apr_pool_t *p, ^ 803. const dav_resource *resource, 804. dav_lockdb *lockdb, modules/dav/main/util.c:802:1: Parameter `resource->uri->strlen` 800. * Returns NULL if path/uri meets if-header and lock requirements 801. */ 802. static dav_error * dav_validate_resource_state(apr_pool_t *p, ^ 803. const dav_resource *resource, 804. dav_lockdb *lockdb, modules/dav/main/util.c:988:5: Assignment 986. */ 987. uri = resource->uri; 988. uri_len = strlen(uri); ^ 989. if (uri[uri_len - 1] == '/') { 990. dav_set_bufsize(p, pbuf, uri_len); modules/dav/main/util.c:989:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `dav_validate_request` 987. uri = resource->uri; 988. uri_len = strlen(uri); 989. if (uri[uri_len - 1] == '/') { ^ 990. dav_set_bufsize(p, pbuf, uri_len); 991. memcpy(pbuf->buf, uri, uri_len);
https://github.com/apache/httpd/blob/8b2ec33ac5d314be345814db08e194ffeda6beb0/modules/dav/main/util.c/#L989
d2a_code_trace_data_45500
static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) { return constant_time_msb_32(~a & (a - 1)); } crypto/ec/curve448/scalar.c:165: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned32 by call to `constant_time_is_zero_32`. Showing all 5 steps of the trace crypto/ec/curve448/scalar.c:156:5: Assignment 154. { 155. unsigned int i; 156. c448_dsword_t accum = 0; ^ 157. 158. scalar_decode_short(s, ser, C448_SCALAR_BYTES); crypto/ec/curve448/scalar.c:165:29: Call 163. curve448_scalar_mul(s, s, curve448_scalar_one); /* ham-handed reduce */ 164. 165. return c448_succeed_if(~word_is_zero((uint32_t)accum)); ^ 166. } 167. include/internal/constant_time_locl.h:183:1: <LHS trace> 181. } 182. 183. > static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) 184. { 185. return constant_time_msb_32(~a & (a - 1)); include/internal/constant_time_locl.h:183:1: Parameter `a` 181. } 182. 183. > static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) 184. { 185. return constant_time_msb_32(~a & (a - 1)); include/internal/constant_time_locl.h:185:12: Binary operation: (0 - 1):unsigned32 by call to `constant_time_is_zero_32` 183. static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) 184. { 185. return constant_time_msb_32(~a & (a - 1)); ^ 186. } 187.
https://github.com/openssl/openssl/blob/a7232276fef30a63070fd9dbb53d3820d3761d5b/include/internal/constant_time_locl.h/#L185
d2a_code_trace_data_45501
DEFINE_RUN_ONCE_STATIC(do_err_strings_init) { if (!OPENSSL_init_crypto(0, NULL)) return 0; err_string_lock = CRYPTO_THREAD_lock_new(); if (err_string_lock == NULL) return 0; int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash, err_string_data_cmp); if (int_error_hash == NULL) { CRYPTO_THREAD_lock_free(err_string_lock); err_string_lock = NULL; return 0; } return 1; } crypto/err/err.c:307: error: MEMORY_LEAK memory dynamically allocated to `err_string_lock` by call to `CRYPTO_THREAD_lock_new()` at line 300, column 23 is not reachable after line 307, column 9. Showing all 45 steps of the trace crypto/err/err.c:296:1: start of procedure do_err_strings_init() 294. } 295. 296. > DEFINE_RUN_ONCE_STATIC(do_err_strings_init) 297. { 298. if (!OPENSSL_init_crypto(0, NULL)) crypto/err/err.c:298:10: Taking false branch 296. DEFINE_RUN_ONCE_STATIC(do_err_strings_init) 297. { 298. if (!OPENSSL_init_crypto(0, NULL)) ^ 299. return 0; 300. err_string_lock = CRYPTO_THREAD_lock_new(); crypto/err/err.c:300:5: 298. if (!OPENSSL_init_crypto(0, NULL)) 299. return 0; 300. > err_string_lock = CRYPTO_THREAD_lock_new(); 301. if (err_string_lock == NULL) 302. return 0; crypto/threads_pthread.c:19:1: start of procedure CRYPTO_THREAD_lock_new() 17. # endif 18. 19. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void) 20. { 21. # ifdef USE_RWLOCK crypto/threads_pthread.c:24:9: 22. CRYPTO_RWLOCK *lock; 23. 24. > if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL) { 25. /* Don't set error, to avoid recursion blowup. */ 26. return NULL; crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE) 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/threads_pthread.c:24:9: Taking false branch 22. CRYPTO_RWLOCK *lock; 23. 24. if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL) { ^ 25. /* Don't set error, to avoid recursion blowup. */ 26. return NULL; crypto/threads_pthread.c:29:9: Taking false branch 27. } 28. 29. if (pthread_rwlock_init(lock, NULL) != 0) { ^ 30. OPENSSL_free(lock); 31. return NULL; crypto/threads_pthread.c:54:5: 52. # endif 53. 54. > return lock; 55. } 56. crypto/threads_pthread.c:55:1: return from a call to CRYPTO_THREAD_lock_new 53. 54. return lock; 55. > } 56. 57. int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock) crypto/err/err.c:301:9: Taking false branch 299. return 0; 300. err_string_lock = CRYPTO_THREAD_lock_new(); 301. if (err_string_lock == NULL) ^ 302. return 0; 303. int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash, crypto/err/err.c:303:5: 301. if (err_string_lock == NULL) 302. return 0; 303. > int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash, 304. err_string_data_cmp); 305. if (int_error_hash == NULL) { include/openssl/err.h:229:1: start of procedure lh_ERR_STRING_DATA_new() 227. } ERR_STRING_DATA; 228. 229. > DEFINE_LHASH_OF(ERR_STRING_DATA); 230. 231. void ERR_put_error(int lib, int func, int reason, const char *file, int line); include/openssl/err.h:229:1: return from a call to lh_ERR_STRING_DATA_new 227. } ERR_STRING_DATA; 228. 229. > DEFINE_LHASH_OF(ERR_STRING_DATA); 230. 231. void ERR_put_error(int lib, int func, int reason, const char *file, int line); crypto/err/err.c:305:9: Taking true branch 303. int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash, 304. err_string_data_cmp); 305. if (int_error_hash == NULL) { ^ 306. CRYPTO_THREAD_lock_free(err_string_lock); 307. err_string_lock = NULL; crypto/err/err.c:306:9: 304. err_string_data_cmp); 305. if (int_error_hash == NULL) { 306. > CRYPTO_THREAD_lock_free(err_string_lock); 307. err_string_lock = NULL; 308. return 0; crypto/threads_pthread.c:96:1: start of procedure CRYPTO_THREAD_lock_free() 94. } 95. 96. > void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock) 97. { 98. if (lock == NULL) crypto/threads_pthread.c:98:9: Taking false branch 96. void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock) 97. { 98. if (lock == NULL) ^ 99. return; 100. crypto/threads_pthread.c:102:5: Skipping pthread_rwlock_destroy(): method has no implementation 100. 101. # ifdef USE_RWLOCK 102. pthread_rwlock_destroy(lock); ^ 103. # else 104. pthread_mutex_destroy(lock); crypto/threads_pthread.c:106:5: 104. pthread_mutex_destroy(lock); 105. # endif 106. > OPENSSL_free(lock); 107. 108. return; crypto/mem.c:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/threads_pthread.c:108:5: 106. OPENSSL_free(lock); 107. 108. > return; 109. } 110. crypto/threads_pthread.c:109:1: return from a call to CRYPTO_THREAD_lock_free 107. 108. return; 109. > } 110. 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) crypto/err/err.c:307:9: 305. if (int_error_hash == NULL) { 306. CRYPTO_THREAD_lock_free(err_string_lock); 307. > err_string_lock = NULL; 308. return 0; 309. }
https://github.com/openssl/openssl/blob/915bf45ee32826ed9eb612e4f82034a138dfeb41/crypto/err/err.c/#L307
d2a_code_trace_data_45502
static int encode_test_init(EVP_TEST *t, const char *encoding) { ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; t->expected_err = OPENSSL_strdup("DECODE_ERROR"); if (t->expected_err == NULL) return 0; } else { TEST_info("Bad encoding: %s. Should be one of " "{canonical, valid, invalid}", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1763: error: NULL_DEREFERENCE pointer `edata` last assigned on line 1760 could be null and is dereferenced at line 1763, column 9. Showing all 15 steps of the trace test/evp_test.c:1758:1: start of procedure encode_test_init() 1756. } ENCODE_DATA; 1757. 1758. > static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); test/evp_test.c:1760:5: 1758. static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. > ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:162:32: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:163:9: Skipping __function_pointer__(): unresolved function pointer 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 163. return malloc_impl(num, file, line); ^ 164. 165. if (num == 0) crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking false branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) test/evp_test.c:1762:9: Taking true branch 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { ^ 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1763:9: 1761. 1762. if (strcmp(encoding, "canonical") == 0) { 1763. > edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { 1765. edata->encoding = BASE64_VALID_ENCODING;
https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L1763
d2a_code_trace_data_45503
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [272+min(0, `c->synth_buf_offset[*]`), 273+max(511, `c->synth_buf_offset[*]`)] (⇐ [16+min(0, `c->synth_buf_offset[*]`), 17+max(511, `c->synth_buf_offset[*]`)] + 256) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:896:5: Assignment 894. 895. sum = *dither_state; 896. p = synth_buf + 16; ^ 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; libavcodec/mpegaudiodec.c:897:5: Array access: Offset: [272+min(0, c->synth_buf_offset[*]), 273+max(511, c->synth_buf_offset[*])] (⇐ [16+min(0, c->synth_buf_offset[*]), 17+max(511, c->synth_buf_offset[*])] + 256) Size: 2 by call to `ff_mpa_synth_filter` 895. sum = *dither_state; 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); ^ 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L897
d2a_code_trace_data_45504
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; Minima minima[MAX_SAB_SIZE]; const int minima_count= FFABS(c->dia_size); int i, j; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){ uint32_t key= map[i]; key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1)); if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1); minima[j].x-= (1<<(ME_MAP_MV_BITS-1)); minima[j].y-= (1<<(ME_MAP_MV_BITS-1)); if( minima[j].x > xmax || minima[j].x < xmin || minima[j].y > ymax || minima[j].y < ymin) continue; minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor; j++; } qsort(minima, j, sizeof(Minima), minima_cmp); for(; j<minima_count; j++){ minima[j].height=256*256*256*64; minima[j].checked=0; minima[j].x= minima[j].y=0; } for(i=0; i<minima_count; i++){ const int x= minima[i].x; const int y= minima[i].y; int d; if(minima[i].checked) continue; if( x >= xmax || x <= xmin || y >= ymax || y <= ymin) continue; SAB_CHECK_MV(x-1, y) SAB_CHECK_MV(x+1, y) SAB_CHECK_MV(x , y-1) SAB_CHECK_MV(x , y+1) minima[i].checked= 1; } best[0]= minima[0].x; best[1]= minima[0].y; dmin= minima[0].height; if( best[0] < xmax && best[0] > xmin && best[1] < ymax && best[1] > ymin){ int d; CHECK_MV(best[0]-1, best[1]) CHECK_MV(best[0]+1, best[1]) CHECK_MV(best[0], best[1]-1) CHECK_MV(best[0], best[1]+1) } return dmin; } libavcodec/motion_est_template.c:889: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:889:9: 887. //ensure that the refernece samples for hpel refinement are in the map 888. CHECK_MV(best[0]-1, best[1]) 889. CHECK_MV(best[0]+1, best[1]) ^ 890. CHECK_MV(best[0], best[1]-1) 891. CHECK_MV(best[0], best[1]+1)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L889
d2a_code_trace_data_45505
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/takdec.c:550: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `decode_subframe`. libavcodec/takdec.c:526:25: Call 524. s->sample_shift[chan]); 525. s->lpc_mode[chan] = bitstream_read(bc, 2); 526. nb_subframes = bitstream_read(bc, 3) + 1; ^ 527. 528. i = 0; libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/takdec.c:550:20: Call 548. prev = 0; 549. for (i = 0; i < nb_subframes; i++) { 550. if ((ret = decode_subframe(s, decoded, subframe_len[i], prev)) < 0) ^ 551. return ret; 552. decoded += subframe_len[i]; libavcodec/takdec.c:422:1: Parameter `s->bc.bits_left` 420. } 421. 422. static int decode_subframe(TAKDecContext *s, int32_t *decoded, ^ 423. int subframe_size, int prev_subframe_size) 424. { libavcodec/takdec.c:432:10: Call 430. memset(filter, 0, MAX_PREDICTORS * sizeof(*filter)); 431. 432. if (!bitstream_read_bit(bc)) ^ 433. return decode_residues(s, decoded, subframe_size); 434. libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `decode_subframe` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45506
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:586: error: INTEGER_OVERFLOW_L2 ([0, 1+max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_CTX_remove_session`. Showing all 11 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:586:13: Call 584. if (try_session_cache) { 585. /* session was from the cache, so remove it */ 586. SSL_CTX_remove_session(s->session_ctx, ret); ^ 587. } 588. goto err; 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 `SSL_CTX_remove_session` 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_45507
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.c:1478: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/ngx_http.c:1463:14: Call 1461. #endif 1462. 1463. rc = ngx_hash_add_key(&ha, &name[s].name, name[s].core_srv_conf, ^ 1464. NGX_HASH_WILDCARD_KEY); 1465. src/core/ngx_hash.c:713:1: Parameter `*key->data` 711. 712. 713. ngx_int_t ^ 714. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 715. ngx_uint_t flags) src/http/ngx_http.c:1478:13: Call 1476. 1477. if (rc == NGX_BUSY) { 1478. ngx_log_error(NGX_LOG_WARN, cf->log, 0, ^ 1479. "conflicting server name \"%V\" on %s, ignored", 1480. &name[s].name, addr->listen_conf->addr); 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_45508
static void h261_loop_filter_c(uint8_t *src, int stride){ int x,y,xy,yz; int temp[64]; for(x=0; x<8; x++){ temp[x ] = 4*src[x ]; temp[x + 7*8] = 4*src[x + 7*stride]; } for(y=1; y<7; y++){ for(x=0; x<8; x++){ xy = y * stride + x; yz = y * 8 + x; temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride]; } } for(y=0; y<8; y++){ src[ y*stride] = (temp[ y*8] + 2)>>2; src[7+y*stride] = (temp[7+y*8] + 2)>>2; for(x=1; x<7; x++){ xy = y * stride + x; yz = y * 8 + x; src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4; } } } libavcodec/dsputil.c:2906: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/dsputil.c:2906:9: 2904. 2905. for(y=0; y<8; y++){ 2906. src[ y*stride] = (temp[ y*8] + 2)>>2; ^ 2907. src[7+y*stride] = (temp[7+y*8] + 2)>>2; 2908. for(x=1; x<7; x++){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L2906
d2a_code_trace_data_45509
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) { int i, j, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l, tmp; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_RSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; rb = n % BN_BITS2; lb = BN_BITS2 - rb; if (nw >= a->top || a->top == 0) { BN_zero(r); return (1); } i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2; if (r != a) { r->neg = a->neg; if (bn_wexpand(r, i) == NULL) return (0); } else { if (n == 0) return 1; } f = &(a->d[nw]); t = r->d; j = a->top - nw; r->top = i; if (rb == 0) { for (i = j; i != 0; i--) *(t++) = *(f++); } else { l = *(f++); for (i = j - 1; i != 0; i--) { tmp = (l >> rb) & BN_MASK2; l = *(f++); *(t++) = (tmp | (l << lb)) & BN_MASK2; } if ((l = (l >> rb) & BN_MASK2)) *(t) = l; } bn_check_top(r); return (1); } crypto/bn/bn_prime.c:269: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_rshift`. Showing all 11 steps of the trace crypto/bn/bn_prime.c:241:18: Call 239. if (a->neg) { 240. BIGNUM *t; 241. if ((t = BN_CTX_get(ctx)) == NULL) ^ 242. goto err; 243. if (BN_copy(t, a) == 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/bn/bn_prime.c:269:10: Call 267. while (!BN_is_bit_set(A1, k)) 268. k++; 269. if (!BN_rshift(A1_odd, A1, k)) ^ 270. goto err; 271. crypto/bn/bn_shift.c:120:1: <Length trace> 118. } 119. 120. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 121. { 122. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:120:1: Parameter `*a->d` 118. } 119. 120. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 121. { 122. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:151:5: Assignment 149. } 150. 151. f = &(a->d[nw]); ^ 152. t = r->d; 153. j = a->top - nw; crypto/bn/bn_shift.c:160:15: Assignment 158. *(t++) = *(f++); 159. } else { 160. l = *(f++); ^ 161. for (i = j - 1; i != 0; i--) { 162. tmp = (l >> rb) & BN_MASK2; crypto/bn/bn_shift.c:163:17: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_rshift` 161. for (i = j - 1; i != 0; i--) { 162. tmp = (l >> rb) & BN_MASK2; 163. l = *(f++); ^ 164. *(t++) = (tmp | (l << lb)) & BN_MASK2; 165. }
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_shift.c/#L163
d2a_code_trace_data_45510
static ossl_inline unsigned int constant_time_lt(unsigned int a, unsigned int b) { return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); } crypto/rsa/rsa_ssl.c:120: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 10):unsigned32 by call to `constant_time_ge`. Showing all 9 steps of the trace crypto/rsa/rsa_ssl.c:68:5: Assignment 66. unsigned char *em = NULL; 67. unsigned int good, found_zero_byte, mask, threes_in_row; 68. int zero_index = 0, msg_index, mlen = -1, err; ^ 69. 70. if (tlen <= 0 || flen <= 0) crypto/rsa/rsa_ssl.c:120:13: Call 118. * also fails. 119. */ 120. good &= constant_time_ge(zero_index, 2 + 8); ^ 121. err = constant_time_select_int(mask | good, err, 122. RSA_R_NULL_BEFORE_BLOCK_MISSING); include/internal/constant_time_locl.h:142:1: Parameter `a` 140. } 141. 142. > static ossl_inline unsigned int constant_time_ge(unsigned int a, 143. unsigned int b) 144. { include/internal/constant_time_locl.h:145:13: Call 143. unsigned int b) 144. { 145. return ~constant_time_lt(a, b); ^ 146. } 147. include/internal/constant_time_locl.h:120:1: <LHS trace> 118. } 119. 120. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 121. unsigned int b) 122. { include/internal/constant_time_locl.h:120:1: Parameter `a` 118. } 119. 120. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 121. unsigned int b) 122. { include/internal/constant_time_locl.h:120:1: <RHS trace> 118. } 119. 120. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 121. unsigned int b) 122. { include/internal/constant_time_locl.h:120:1: Parameter `b` 118. } 119. 120. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 121. unsigned int b) 122. { include/internal/constant_time_locl.h:123:12: Binary operation: ([0, +oo] - 10):unsigned32 by call to `constant_time_ge` 121. unsigned int b) 122. { 123. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 124. } 125.
https://github.com/openssl/openssl/blob/4c2883a9bf59c5ee31e8e2e101b3894a16c06950/include/internal/constant_time_locl.h/#L123
d2a_code_trace_data_45511
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1110: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_sqr`. Showing all 10 steps of the trace test/bntest.c:1110:10: Call 1108. BN_zero(zero); 1109. 1110. if (!BN_sqr(ret, a, ctx) ^ 1111. || !equalBN("A^2", square, ret) 1112. || !BN_mul(ret, a, a, ctx) crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; 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.depth` 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.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <LHS trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_sqr` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45512
void *lh_delete(LHASH *lh, void *data) { unsigned long hash; LHASH_NODE *nn,**rn; void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; Free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); return(ret); } ssl/s3_pkt.c:952: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `SSL_CTX_remove_session`. Showing all 9 steps of the trace ssl/s3_pkt.c:710:1: Parameter `s->ctx->sessions->num_items` 708. * none of our business 709. */ 710. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len) 711. { 712. int al,i,j,n,ret; ssl/s3_pkt.c:952:4: Call 950. ERR_add_error_data(2,"SSL alert number ",tmp); 951. s->shutdown|=SSL_RECEIVED_SHUTDOWN; 952. SSL_CTX_remove_session(s->ctx,s->session); ^ 953. return(0); 954. } ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->num_items` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->num_items` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `SSL_CTX_remove_session` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_45513
static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign, size_t inp_misalign, int frag) { CIPHER_DATA *expected = t->data; unsigned char *in, *expected_out, *tmp = NULL; size_t in_len, out_len, donelen = 0; int ok = 0, tmplen, chunklen, tmpflen; EVP_CIPHER_CTX *ctx = NULL; t->err = "TEST_FAILURE"; if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())) goto err; EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPHER_CTX_FLAG_WRAP_ALLOW); if (enc) { in = expected->plaintext; in_len = expected->plaintext_len; expected_out = expected->ciphertext; out_len = expected->ciphertext_len; } else { in = expected->ciphertext; in_len = expected->ciphertext_len; expected_out = expected->plaintext; out_len = expected->plaintext_len; } if (inp_misalign == (size_t)-1) { tmp = OPENSSL_malloc(out_misalign + in_len + 2 * EVP_MAX_BLOCK_LENGTH); if (!tmp) goto err; in = memcpy(tmp + out_misalign, in, in_len); } else { inp_misalign += 16 - ((out_misalign + in_len) & 15); tmp = OPENSSL_malloc(out_misalign + in_len + 2 * EVP_MAX_BLOCK_LENGTH + inp_misalign + in_len); if (!tmp) goto err; in = memcpy(tmp + out_misalign + in_len + 2 * EVP_MAX_BLOCK_LENGTH + inp_misalign, in, in_len); } if (!EVP_CipherInit_ex(ctx, expected->cipher, NULL, NULL, NULL, enc)) { t->err = "CIPHERINIT_ERROR"; goto err; } if (expected->iv) { if (expected->aead) { if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, expected->iv_len, 0)) { t->err = "INVALID_IV_LENGTH"; goto err; } } else if (expected->iv_len != (size_t)EVP_CIPHER_CTX_iv_length(ctx)) { t->err = "INVALID_IV_LENGTH"; goto err; } } if (expected->aead) { unsigned char *tag; if (enc || expected->aead == EVP_CIPH_OCB_MODE) { t->err = "TAG_LENGTH_SET_ERROR"; tag = NULL; } else { t->err = "TAG_SET_ERROR"; tag = expected->tag; } if (tag || expected->aead != EVP_CIPH_GCM_MODE) { if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, expected->tag_len, tag)) goto err; } } if (!EVP_CIPHER_CTX_set_key_length(ctx, expected->key_len)) { t->err = "INVALID_KEY_LENGTH"; goto err; } if (!EVP_CipherInit_ex(ctx, NULL, NULL, expected->key, expected->iv, -1)) { t->err = "KEY_SET_ERROR"; goto err; } if (!enc && expected->aead == EVP_CIPH_OCB_MODE) { if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, expected->tag_len, expected->tag)) { t->err = "TAG_SET_ERROR"; goto err; } } if (expected->aead == EVP_CIPH_CCM_MODE) { if (!EVP_CipherUpdate(ctx, NULL, &tmplen, NULL, out_len)) { t->err = "CCM_PLAINTEXT_LENGTH_SET_ERROR"; goto err; } } if (expected->aad) { t->err = "AAD_SET_ERROR"; if (!frag) { if (!EVP_CipherUpdate(ctx, NULL, &chunklen, expected->aad, expected->aad_len)) goto err; } else { if (expected->aad_len > 0) { if (!EVP_CipherUpdate(ctx, NULL, &chunklen, expected->aad, 1)) goto err; donelen++; } if (expected->aad_len > 2) { if (!EVP_CipherUpdate(ctx, NULL, &chunklen, expected->aad + donelen, expected->aad_len - 2)) goto err; donelen += expected->aad_len - 2; } if (expected->aad_len > 1 && !EVP_CipherUpdate(ctx, NULL, &chunklen, expected->aad + donelen, 1)) goto err; } } EVP_CIPHER_CTX_set_padding(ctx, 0); t->err = "CIPHERUPDATE_ERROR"; tmplen = 0; if (!frag) { if (!EVP_CipherUpdate(ctx, tmp + out_misalign, &tmplen, in, in_len)) goto err; } else { if (in_len > 0) { if (!EVP_CipherUpdate(ctx, tmp + out_misalign, &chunklen, in, 1)) goto err; tmplen += chunklen; in++; in_len--; } if (in_len > 1) { if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen, in, in_len - 1)) goto err; tmplen += chunklen; in += in_len - 1; in_len = 1; } if (in_len > 0 ) { if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen, in, 1)) goto err; tmplen += chunklen; } } if (!EVP_CipherFinal_ex(ctx, tmp + out_misalign + tmplen, &tmpflen)) { t->err = "CIPHERFINAL_ERROR"; goto err; } if (!TEST_mem_eq(expected_out, out_len, tmp + out_misalign, tmplen + tmpflen)) { t->err = "VALUE_MISMATCH"; goto err; } if (enc && expected->aead) { unsigned char rtag[16]; if (!TEST_size_t_le(expected->tag_len, sizeof(rtag))) { t->err = "TAG_LENGTH_INTERNAL_ERROR"; goto err; } if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, expected->tag_len, rtag)) { t->err = "TAG_RETRIEVE_ERROR"; goto err; } if (!TEST_mem_eq(expected->tag, expected->tag_len, rtag, expected->tag_len)) { t->err = "TAG_VALUE_MISMATCH"; goto err; } } t->err = NULL; ok = 1; err: OPENSSL_free(tmp); EVP_CIPHER_CTX_free(ctx); return ok; } test/evp_test.c:764: error: INTEGER_OVERFLOW_L1 ([18446744073709551615, +oo] + [1, 16]):unsigned64 by call to `cipher_test_enc`. Showing all 8 steps of the trace test/evp_test.c:740:14: Assignment 738. static char aux_err[64]; 739. t->aux_err = aux_err; 740. for (inp_misalign = (size_t)-1; inp_misalign != 2; inp_misalign++) { ^ 741. if (inp_misalign == (size_t)-1) { 742. /* kludge: inp_misalign == -1 means "exercise in-place" */ test/evp_test.c:764:22: Call 762. } 763. if (cdat->enc != 1) { 764. rv = cipher_test_enc(t, 0, out_misalign, inp_misalign, frag); ^ 765. /* Not fatal errors: return */ 766. if (rv != 1) { test/evp_test.c:514:1: <LHS trace> 512. } 513. 514. > static int cipher_test_enc(EVP_TEST *t, int enc, 515. size_t out_misalign, size_t inp_misalign, int frag) 516. { test/evp_test.c:514:1: Parameter `inp_misalign` 512. } 513. 514. > static int cipher_test_enc(EVP_TEST *t, int enc, 515. size_t out_misalign, size_t inp_misalign, int frag) 516. { test/evp_test.c:514:1: <RHS trace> 512. } 513. 514. > static int cipher_test_enc(EVP_TEST *t, int enc, 515. size_t out_misalign, size_t inp_misalign, int frag) 516. { test/evp_test.c:514:1: Parameter `t->data->plaintext_len` 512. } 513. 514. > static int cipher_test_enc(EVP_TEST *t, int enc, 515. size_t out_misalign, size_t inp_misalign, int frag) 516. { test/evp_test.c:529:9: Assignment 527. if (enc) { 528. in = expected->plaintext; 529. in_len = expected->plaintext_len; ^ 530. expected_out = expected->ciphertext; 531. out_len = expected->ciphertext_len; test/evp_test.c:547:9: Binary operation: ([18446744073709551615, +oo] + [1, 16]):unsigned64 by call to `cipher_test_enc` 545. in = memcpy(tmp + out_misalign, in, in_len); 546. } else { 547. inp_misalign += 16 - ((out_misalign + in_len) & 15); ^ 548. /* 549. * 'tmp' will store both output and copy of input. We make the copy
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/test/evp_test.c/#L547
d2a_code_trace_data_45514
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_gcd.c:537: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 30 steps of the trace crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:537:18: Call 535. 536. /* (D, M) := (A/B, A%B) ... */ 537. if (!BN_div(D, M, &local_A, B, ctx)) ^ 538. goto err; 539. /* Ensure local_A goes out of scope before any further use of A */ crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45515
void BF_set_key(BF_KEY *key, int len, const unsigned char *data) #ifdef OPENSSL_FIPS { fips_cipher_abort(BLOWFISH); private_BF_set_key(key, len, data); } void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data) #endif { int i; BF_LONG *p,ri,in[2]; const unsigned char *d,*end; memcpy(key,&bf_init,sizeof(BF_KEY)); p=key->P; if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; d=data; end= &(data[len]); for (i=0; i<(BF_ROUNDS+2); i++) { ri= *(d++); if (d >= end) d=data; ri<<=8; ri|= *(d++); if (d >= end) d=data; ri<<=8; ri|= *(d++); if (d >= end) d=data; ri<<=8; ri|= *(d++); if (d >= end) d=data; p[i]^=ri; } in[0]=0L; in[1]=0L; for (i=0; i<(BF_ROUNDS+2); i+=2) { BF_encrypt(in,key); p[i ]=in[0]; p[i+1]=in[1]; } p=key->S; for (i=0; i<4*256; i+=2) { BF_encrypt(in,key); p[i ]=in[0]; p[i+1]=in[1]; } } apps/speed.c:1249: error: BUFFER_OVERRUN_L2 Offset: [0, 71] Size: 16 by call to `BF_set_key`. Showing all 6 steps of the trace apps/speed.c:425:2: Array declaration 423. CAST_KEY cast_ks; 424. #endif 425. static const unsigned char key16[16]= ^ 426. {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, 427. 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; apps/speed.c:1249:2: Call 1247. #endif 1248. #ifndef OPENSSL_NO_BF 1249. BF_set_key(&bf_ks,16,key16); ^ 1250. #endif 1251. #ifndef OPENSSL_NO_CAST crypto/bf/bf_skey.c:66:1: <Length trace> 64. #include "bf_pi.h" 65. 66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data) 67. #ifdef OPENSSL_FIPS 68. { crypto/bf/bf_skey.c:66:1: Parameter `*data` 64. #include "bf_pi.h" 65. 66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data) 67. #ifdef OPENSSL_FIPS 68. { crypto/bf/bf_skey.c:85:2: Assignment 83. if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; 84. 85. d=data; ^ 86. end= &(data[len]); 87. for (i=0; i<(BF_ROUNDS+2); i++) crypto/bf/bf_skey.c:89:7: Array access: Offset: [0, 71] Size: 16 by call to `BF_set_key` 87. for (i=0; i<(BF_ROUNDS+2); i++) 88. { 89. ri= *(d++); ^ 90. if (d >= end) d=data; 91.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bf/bf_skey.c/#L89
d2a_code_trace_data_45516
int MAIN(int argc, char **argv) { unsigned char *buf_malloc = NULL, *buf2_malloc = NULL; unsigned char *buf = NULL, *buf2 = NULL; int mret = 1; long count = 0, save_count = 0; int i, j, k; #if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) long rsa_count; #endif #ifndef OPENSSL_NO_RSA unsigned rsa_num; #endif unsigned char md[EVP_MAX_MD_SIZE]; #ifndef OPENSSL_NO_MD2 unsigned char md2[MD2_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_MDC2 unsigned char mdc2[MDC2_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_MD4 unsigned char md4[MD4_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_MD5 unsigned char md5[MD5_DIGEST_LENGTH]; unsigned char hmac[MD5_DIGEST_LENGTH]; #endif unsigned char sha[SHA_DIGEST_LENGTH]; unsigned char sha256[SHA256_DIGEST_LENGTH]; unsigned char sha512[SHA512_DIGEST_LENGTH]; #ifndef OPENSSL_NO_WHIRLPOOL unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_RMD160 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_RC4 RC4_KEY rc4_ks; #endif #ifndef OPENSSL_NO_RC5 RC5_32_KEY rc5_ks; #endif #ifndef OPENSSL_NO_RC2 RC2_KEY rc2_ks; #endif #ifndef OPENSSL_NO_IDEA IDEA_KEY_SCHEDULE idea_ks; #endif #ifndef OPENSSL_NO_SEED SEED_KEY_SCHEDULE seed_ks; #endif #ifndef OPENSSL_NO_BF BF_KEY bf_ks; #endif #ifndef OPENSSL_NO_CAST CAST_KEY cast_ks; #endif static const unsigned char key16[16] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; #ifndef OPENSSL_NO_AES static const unsigned char key24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char key32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; #endif #ifndef OPENSSL_NO_CAMELLIA static const unsigned char ckey24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char ckey32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; #endif #ifndef OPENSSL_NO_AES # define MAX_BLOCK_SIZE 128 #else # define MAX_BLOCK_SIZE 64 #endif unsigned char DES_iv[8]; unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; #ifndef OPENSSL_NO_DES static DES_cblock key = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }; static DES_cblock key2 = { 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; static DES_cblock key3 = { 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; DES_key_schedule sch; DES_key_schedule sch2; DES_key_schedule sch3; #endif #ifndef OPENSSL_NO_AES AES_KEY aes_ks1, aes_ks2, aes_ks3; #endif #ifndef OPENSSL_NO_CAMELLIA CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; #endif #define D_MD2 0 #define D_MDC2 1 #define D_MD4 2 #define D_MD5 3 #define D_HMAC 4 #define D_SHA1 5 #define D_RMD160 6 #define D_RC4 7 #define D_CBC_DES 8 #define D_EDE3_DES 9 #define D_CBC_IDEA 10 #define D_CBC_SEED 11 #define D_CBC_RC2 12 #define D_CBC_RC5 13 #define D_CBC_BF 14 #define D_CBC_CAST 15 #define D_CBC_128_AES 16 #define D_CBC_192_AES 17 #define D_CBC_256_AES 18 #define D_CBC_128_CML 19 #define D_CBC_192_CML 20 #define D_CBC_256_CML 21 #define D_EVP 22 #define D_SHA256 23 #define D_SHA512 24 #define D_WHIRLPOOL 25 #define D_IGE_128_AES 26 #define D_IGE_192_AES 27 #define D_IGE_256_AES 28 #define D_GHASH 29 double d = 0.0; long c[ALGOR_NUM][SIZE_NUM]; #ifndef OPENSSL_SYS_WIN32 #endif #define R_DSA_512 0 #define R_DSA_1024 1 #define R_DSA_2048 2 #define R_RSA_512 0 #define R_RSA_1024 1 #define R_RSA_2048 2 #define R_RSA_3072 3 #define R_RSA_4096 4 #define R_RSA_7680 5 #define R_RSA_15360 6 #define R_EC_P160 0 #define R_EC_P192 1 #define R_EC_P224 2 #define R_EC_P256 3 #define R_EC_P384 4 #define R_EC_P521 5 #define R_EC_K163 6 #define R_EC_K233 7 #define R_EC_K283 8 #define R_EC_K409 9 #define R_EC_K571 10 #define R_EC_B163 11 #define R_EC_B233 12 #define R_EC_B283 13 #define R_EC_B409 14 #define R_EC_B571 15 #ifndef OPENSSL_NO_RSA RSA *rsa_key[RSA_NUM]; long rsa_c[RSA_NUM][2]; static unsigned int rsa_bits[RSA_NUM] = { 512, 1024, 2048, 3072, 4096, 7680, 15360 }; static unsigned char *rsa_data[RSA_NUM] = { test512, test1024, test2048, test3072, test4096, test7680, test15360 }; static int rsa_data_length[RSA_NUM] = { sizeof(test512), sizeof(test1024), sizeof(test2048), sizeof(test3072), sizeof(test4096), sizeof(test7680), sizeof(test15360) }; #endif #ifndef OPENSSL_NO_DSA DSA *dsa_key[DSA_NUM]; long dsa_c[DSA_NUM][2]; static unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 }; #endif #ifndef OPENSSL_NO_EC static unsigned int test_curves[EC_NUM] = { NID_secp160r1, NID_X9_62_prime192v1, NID_secp224r1, NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1, NID_sect163k1, NID_sect233k1, NID_sect283k1, NID_sect409k1, NID_sect571k1, NID_sect163r2, NID_sect233r1, NID_sect283r1, NID_sect409r1, NID_sect571r1 }; static const char *test_curves_names[EC_NUM] = { "secp160r1", "nistp192", "nistp224", "nistp256", "nistp384", "nistp521", "nistk163", "nistk233", "nistk283", "nistk409", "nistk571", "nistb163", "nistb233", "nistb283", "nistb409", "nistb571" }; static int test_curves_bits[EC_NUM] = { 160, 192, 224, 256, 384, 521, 163, 233, 283, 409, 571, 163, 233, 283, 409, 571 }; #endif #ifndef OPENSSL_NO_EC unsigned char ecdsasig[256]; unsigned int ecdsasiglen; EC_KEY *ecdsa[EC_NUM]; long ecdsa_c[EC_NUM][2]; EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM]; unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE]; int secret_size_a, secret_size_b; int ecdh_checks = 0; int secret_idx = 0; long ecdh_c[EC_NUM][2]; int ecdsa_doit[EC_NUM]; int ecdh_doit[EC_NUM]; #endif int rsa_doit[RSA_NUM]; int dsa_doit[DSA_NUM]; int doit[ALGOR_NUM]; int pr_header = 0; const EVP_CIPHER *evp_cipher = NULL; const EVP_MD *evp_md = NULL; int decrypt = 0; #ifndef NO_FORK int multi = 0; #endif int multiblock = 0; int misalign = MAX_MISALIGNMENT + 1; #ifndef TIMES usertime = -1; #endif apps_startup(); memset(results, 0, sizeof(results)); #ifndef OPENSSL_NO_DSA memset(dsa_key, 0, sizeof(dsa_key)); #endif #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) ecdsa[i] = NULL; for (i = 0; i < EC_NUM; i++) { ecdh_a[i] = NULL; ecdh_b[i] = NULL; } #endif if (bio_err == NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL) BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT); if (!load_config(bio_err, NULL)) goto end; #ifndef OPENSSL_NO_RSA memset(rsa_key, 0, sizeof(rsa_key)); for (i = 0; i < RSA_NUM; i++) rsa_key[i] = NULL; #endif if ((buf_malloc = (unsigned char *)OPENSSL_malloc(BUFSIZE + misalign)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; } if ((buf2_malloc = (unsigned char *)OPENSSL_malloc(BUFSIZE + misalign)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; } misalign = 0; buf = buf_malloc; buf2 = buf2_malloc; memset(c, 0, sizeof(c)); memset(DES_iv, 0, sizeof(DES_iv)); memset(iv, 0, sizeof(iv)); for (i = 0; i < ALGOR_NUM; i++) doit[i] = 0; for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 0; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 0; #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 0; for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 0; #endif j = 0; argc--; argv++; while (argc) { if ((argc > 0) && (strcmp(*argv, "-elapsed") == 0)) { usertime = 0; j--; } else if ((argc > 0) && (strcmp(*argv, "-evp") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no EVP given\n"); goto end; } evp_cipher = EVP_get_cipherbyname(*argv); if (!evp_cipher) { evp_md = EVP_get_digestbyname(*argv); } if (!evp_cipher && !evp_md) { BIO_printf(bio_err, "%s is an unknown cipher or digest\n", *argv); goto end; } doit[D_EVP] = 1; } else if (argc > 0 && !strcmp(*argv, "-decrypt")) { decrypt = 1; j--; } #ifndef OPENSSL_NO_ENGINE else if ((argc > 0) && (strcmp(*argv, "-engine") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no engine given\n"); goto end; } setup_engine(bio_err, *argv, 0); j--; } #endif #ifndef NO_FORK else if ((argc > 0) && (strcmp(*argv, "-multi") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no multi count given\n"); goto end; } multi = atoi(argv[0]); if (multi <= 0) { BIO_printf(bio_err, "bad multi count\n"); goto end; } j--; } #endif else if (argc > 0 && !strcmp(*argv, "-mr")) { mr = 1; j--; } else if (argc > 0 && !strcmp(*argv, "-mb")) { multiblock = 1; j--; } else if (argc > 0 && !strcmp(*argv, "-misalign")) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no misalignment given\n"); goto end; } misalign = atoi(argv[0]); if (misalign < 0 || misalign > MAX_MISALIGNMENT) { BIO_printf(bio_err, "misalignment is outsize permitted range 0-%d\n", MAX_MISALIGNMENT); goto end; } buf = buf_malloc + misalign; buf2 = buf2_malloc + misalign; j--; } else #ifndef OPENSSL_NO_MD2 if (strcmp(*argv, "md2") == 0) doit[D_MD2] = 1; else #endif #ifndef OPENSSL_NO_MDC2 if (strcmp(*argv, "mdc2") == 0) doit[D_MDC2] = 1; else #endif #ifndef OPENSSL_NO_MD4 if (strcmp(*argv, "md4") == 0) doit[D_MD4] = 1; else #endif #ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "md5") == 0) doit[D_MD5] = 1; else #endif #ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "hmac") == 0) doit[D_HMAC] = 1; else #endif if (strcmp(*argv, "sha1") == 0) doit[D_SHA1] = 1; else if (strcmp(*argv, "sha") == 0) doit[D_SHA1] = 1, doit[D_SHA256] = 1, doit[D_SHA512] = 1; else if (strcmp(*argv, "sha256") == 0) doit[D_SHA256] = 1; else if (strcmp(*argv, "sha512") == 0) doit[D_SHA512] = 1; else #ifndef OPENSSL_NO_WHIRLPOOL if (strcmp(*argv, "whirlpool") == 0) doit[D_WHIRLPOOL] = 1; else #endif #ifndef OPENSSL_NO_RMD160 if (strcmp(*argv, "ripemd") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "rmd160") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "ripemd160") == 0) doit[D_RMD160] = 1; else #endif #ifndef OPENSSL_NO_RC4 if (strcmp(*argv, "rc4") == 0) doit[D_RC4] = 1; else #endif #ifndef OPENSSL_NO_DES if (strcmp(*argv, "des-cbc") == 0) doit[D_CBC_DES] = 1; else if (strcmp(*argv, "des-ede3") == 0) doit[D_EDE3_DES] = 1; else #endif #ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes-128-cbc") == 0) doit[D_CBC_128_AES] = 1; else if (strcmp(*argv, "aes-192-cbc") == 0) doit[D_CBC_192_AES] = 1; else if (strcmp(*argv, "aes-256-cbc") == 0) doit[D_CBC_256_AES] = 1; else if (strcmp(*argv, "aes-128-ige") == 0) doit[D_IGE_128_AES] = 1; else if (strcmp(*argv, "aes-192-ige") == 0) doit[D_IGE_192_AES] = 1; else if (strcmp(*argv, "aes-256-ige") == 0) doit[D_IGE_256_AES] = 1; else #endif #ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia-128-cbc") == 0) doit[D_CBC_128_CML] = 1; else if (strcmp(*argv, "camellia-192-cbc") == 0) doit[D_CBC_192_CML] = 1; else if (strcmp(*argv, "camellia-256-cbc") == 0) doit[D_CBC_256_CML] = 1; else #endif #ifndef OPENSSL_NO_RSA # ifndef RSA_NULL if (strcmp(*argv, "openssl") == 0) { RSA_set_default_method(RSA_PKCS1_SSLeay()); j--; } else # endif #endif if (strcmp(*argv, "dsa512") == 0) dsa_doit[R_DSA_512] = 2; else if (strcmp(*argv, "dsa1024") == 0) dsa_doit[R_DSA_1024] = 2; else if (strcmp(*argv, "dsa2048") == 0) dsa_doit[R_DSA_2048] = 2; else if (strcmp(*argv, "rsa512") == 0) rsa_doit[R_RSA_512] = 2; else if (strcmp(*argv, "rsa1024") == 0) rsa_doit[R_RSA_1024] = 2; else if (strcmp(*argv, "rsa2048") == 0) rsa_doit[R_RSA_2048] = 2; else if (strcmp(*argv, "rsa3072") == 0) rsa_doit[R_RSA_3072] = 2; else if (strcmp(*argv, "rsa4096") == 0) rsa_doit[R_RSA_4096] = 2; else if (strcmp(*argv, "rsa7680") == 0) rsa_doit[R_RSA_7680] = 2; else if (strcmp(*argv, "rsa15360") == 0) rsa_doit[R_RSA_15360] = 2; else #ifndef OPENSSL_NO_RC2 if (strcmp(*argv, "rc2-cbc") == 0) doit[D_CBC_RC2] = 1; else if (strcmp(*argv, "rc2") == 0) doit[D_CBC_RC2] = 1; else #endif #ifndef OPENSSL_NO_RC5 if (strcmp(*argv, "rc5-cbc") == 0) doit[D_CBC_RC5] = 1; else if (strcmp(*argv, "rc5") == 0) doit[D_CBC_RC5] = 1; else #endif #ifndef OPENSSL_NO_IDEA if (strcmp(*argv, "idea-cbc") == 0) doit[D_CBC_IDEA] = 1; else if (strcmp(*argv, "idea") == 0) doit[D_CBC_IDEA] = 1; else #endif #ifndef OPENSSL_NO_SEED if (strcmp(*argv, "seed-cbc") == 0) doit[D_CBC_SEED] = 1; else if (strcmp(*argv, "seed") == 0) doit[D_CBC_SEED] = 1; else #endif #ifndef OPENSSL_NO_BF if (strcmp(*argv, "bf-cbc") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "blowfish") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "bf") == 0) doit[D_CBC_BF] = 1; else #endif #ifndef OPENSSL_NO_CAST if (strcmp(*argv, "cast-cbc") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast5") == 0) doit[D_CBC_CAST] = 1; else #endif #ifndef OPENSSL_NO_DES if (strcmp(*argv, "des") == 0) { doit[D_CBC_DES] = 1; doit[D_EDE3_DES] = 1; } else #endif #ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes") == 0) { doit[D_CBC_128_AES] = 1; doit[D_CBC_192_AES] = 1; doit[D_CBC_256_AES] = 1; } else if (strcmp(*argv, "ghash") == 0) { doit[D_GHASH] = 1; } else #endif #ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia") == 0) { doit[D_CBC_128_CML] = 1; doit[D_CBC_192_CML] = 1; doit[D_CBC_256_CML] = 1; } else #endif #ifndef OPENSSL_NO_RSA if (strcmp(*argv, "rsa") == 0) { rsa_doit[R_RSA_512] = 1; rsa_doit[R_RSA_1024] = 1; rsa_doit[R_RSA_2048] = 1; rsa_doit[R_RSA_3072] = 1; rsa_doit[R_RSA_4096] = 1; rsa_doit[R_RSA_7680] = 1; rsa_doit[R_RSA_15360] = 1; } else #endif #ifndef OPENSSL_NO_DSA if (strcmp(*argv, "dsa") == 0) { dsa_doit[R_DSA_512] = 1; dsa_doit[R_DSA_1024] = 1; dsa_doit[R_DSA_2048] = 1; } else #endif #ifndef OPENSSL_NO_EC if (strcmp(*argv, "ecdsap160") == 0) ecdsa_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdsap192") == 0) ecdsa_doit[R_EC_P192] = 2; else if (strcmp(*argv, "ecdsap224") == 0) ecdsa_doit[R_EC_P224] = 2; else if (strcmp(*argv, "ecdsap256") == 0) ecdsa_doit[R_EC_P256] = 2; else if (strcmp(*argv, "ecdsap384") == 0) ecdsa_doit[R_EC_P384] = 2; else if (strcmp(*argv, "ecdsap521") == 0) ecdsa_doit[R_EC_P521] = 2; else if (strcmp(*argv, "ecdsak163") == 0) ecdsa_doit[R_EC_K163] = 2; else if (strcmp(*argv, "ecdsak233") == 0) ecdsa_doit[R_EC_K233] = 2; else if (strcmp(*argv, "ecdsak283") == 0) ecdsa_doit[R_EC_K283] = 2; else if (strcmp(*argv, "ecdsak409") == 0) ecdsa_doit[R_EC_K409] = 2; else if (strcmp(*argv, "ecdsak571") == 0) ecdsa_doit[R_EC_K571] = 2; else if (strcmp(*argv, "ecdsab163") == 0) ecdsa_doit[R_EC_B163] = 2; else if (strcmp(*argv, "ecdsab233") == 0) ecdsa_doit[R_EC_B233] = 2; else if (strcmp(*argv, "ecdsab283") == 0) ecdsa_doit[R_EC_B283] = 2; else if (strcmp(*argv, "ecdsab409") == 0) ecdsa_doit[R_EC_B409] = 2; else if (strcmp(*argv, "ecdsab571") == 0) ecdsa_doit[R_EC_B571] = 2; else if (strcmp(*argv, "ecdsa") == 0) { for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; } else if (strcmp(*argv, "ecdhp160") == 0) ecdh_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdhp192") == 0) ecdh_doit[R_EC_P192] = 2; else if (strcmp(*argv, "ecdhp224") == 0) ecdh_doit[R_EC_P224] = 2; else if (strcmp(*argv, "ecdhp256") == 0) ecdh_doit[R_EC_P256] = 2; else if (strcmp(*argv, "ecdhp384") == 0) ecdh_doit[R_EC_P384] = 2; else if (strcmp(*argv, "ecdhp521") == 0) ecdh_doit[R_EC_P521] = 2; else if (strcmp(*argv, "ecdhk163") == 0) ecdh_doit[R_EC_K163] = 2; else if (strcmp(*argv, "ecdhk233") == 0) ecdh_doit[R_EC_K233] = 2; else if (strcmp(*argv, "ecdhk283") == 0) ecdh_doit[R_EC_K283] = 2; else if (strcmp(*argv, "ecdhk409") == 0) ecdh_doit[R_EC_K409] = 2; else if (strcmp(*argv, "ecdhk571") == 0) ecdh_doit[R_EC_K571] = 2; else if (strcmp(*argv, "ecdhb163") == 0) ecdh_doit[R_EC_B163] = 2; else if (strcmp(*argv, "ecdhb233") == 0) ecdh_doit[R_EC_B233] = 2; else if (strcmp(*argv, "ecdhb283") == 0) ecdh_doit[R_EC_B283] = 2; else if (strcmp(*argv, "ecdhb409") == 0) ecdh_doit[R_EC_B409] = 2; else if (strcmp(*argv, "ecdhb571") == 0) ecdh_doit[R_EC_B571] = 2; else if (strcmp(*argv, "ecdh") == 0) { for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; } else #endif { BIO_printf(bio_err, "Error: bad option or value\n"); BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available values:\n"); #ifndef OPENSSL_NO_MD2 BIO_printf(bio_err, "md2 "); #endif #ifndef OPENSSL_NO_MDC2 BIO_printf(bio_err, "mdc2 "); #endif #ifndef OPENSSL_NO_MD4 BIO_printf(bio_err, "md4 "); #endif #ifndef OPENSSL_NO_MD5 BIO_printf(bio_err, "md5 "); BIO_printf(bio_err, "hmac "); #endif BIO_printf(bio_err, "sha1 "); BIO_printf(bio_err, "sha256 "); BIO_printf(bio_err, "sha512 "); #ifndef OPENSSL_NO_WHIRLPOOL BIO_printf(bio_err, "whirlpool"); #endif #ifndef OPENSSL_NO_RMD160 BIO_printf(bio_err, "rmd160"); #endif BIO_printf(bio_err, "\n"); #ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea-cbc "); #endif #ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed-cbc "); #endif #ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2-cbc "); #endif #ifndef OPENSSL_NO_RC5 BIO_printf(bio_err, "rc5-cbc "); #endif #ifndef OPENSSL_NO_BF BIO_printf(bio_err, "bf-cbc"); #endif #if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \ !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5) BIO_printf(bio_err, "\n"); #endif #ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des-cbc des-ede3 "); #endif #ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes-128-cbc aes-192-cbc aes-256-cbc "); BIO_printf(bio_err, "aes-128-ige aes-192-ige aes-256-ige "); #endif #ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "camellia-128-cbc camellia-192-cbc camellia-256-cbc "); #endif #ifndef OPENSSL_NO_RC4 BIO_printf(bio_err, "rc4"); #endif BIO_printf(bio_err, "\n"); #ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa512 rsa1024 rsa2048 rsa3072 rsa4096\n"); BIO_printf(bio_err, "rsa7680 rsa15360\n"); #endif #ifndef OPENSSL_NO_DSA BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n"); #endif #ifndef OPENSSL_NO_EC BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 " "ecdsap256 ecdsap384 ecdsap521\n"); BIO_printf(bio_err, "ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n"); BIO_printf(bio_err, "ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n"); BIO_printf(bio_err, "ecdsa\n"); BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 " "ecdhp256 ecdhp384 ecdhp521\n"); BIO_printf(bio_err, "ecdhk163 ecdhk233 ecdhk283 ecdhk409 ecdhk571\n"); BIO_printf(bio_err, "ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571\n"); BIO_printf(bio_err, "ecdh\n"); #endif #ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea "); #endif #ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed "); #endif #ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2 "); #endif #ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des "); #endif #ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes "); #endif #ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "camellia "); #endif #ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa "); #endif #ifndef OPENSSL_NO_BF BIO_printf(bio_err, "blowfish"); #endif #if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \ !defined(OPENSSL_NO_RC2) || !defined(OPENSSL_NO_DES) || \ !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_BF) || \ !defined(OPENSSL_NO_AES) || !defined(OPENSSL_NO_CAMELLIA) BIO_printf(bio_err, "\n"); #endif BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available options:\n"); #if defined(TIMES) || defined(USE_TOD) BIO_printf(bio_err, "-elapsed " "measure time in real time instead of CPU user time.\n"); #endif #ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, "-engine e " "use engine e, possibly a hardware device.\n"); #endif BIO_printf(bio_err, "-evp e " "use EVP e.\n"); BIO_printf(bio_err, "-decrypt " "time decryption instead of encryption (only EVP).\n"); BIO_printf(bio_err, "-mr " "produce machine readable output.\n"); BIO_printf(bio_err, "-mb " "perform multi-block benchmark (for specific ciphers)\n"); BIO_printf(bio_err, "-misalign n " "perform benchmark with misaligned data\n"); #ifndef NO_FORK BIO_printf(bio_err, "-multi n " "run n benchmarks in parallel.\n"); #endif goto end; } argc--; argv++; j++; } #ifndef NO_FORK if (multi && do_multi(multi)) goto show_res; #endif if (j == 0) { for (i = 0; i < ALGOR_NUM; i++) { if (i != D_EVP) doit[i] = 1; } for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 1; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 1; #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; #endif } for (i = 0; i < ALGOR_NUM; i++) if (doit[i]) pr_header++; if (usertime == 0 && !mr) BIO_printf(bio_err, "You have chosen to measure elapsed time " "instead of user CPU time.\n"); #ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) { const unsigned char *p; p = rsa_data[i]; rsa_key[i] = d2i_RSAPrivateKey(NULL, &p, rsa_data_length[i]); if (rsa_key[i] == NULL) { BIO_printf(bio_err, "internal error loading RSA key number %d\n", i); goto end; } } #endif #ifndef OPENSSL_NO_DSA dsa_key[0] = get_dsa512(); dsa_key[1] = get_dsa1024(); dsa_key[2] = get_dsa2048(); #endif #ifndef OPENSSL_NO_DES DES_set_key_unchecked(&key, &sch); DES_set_key_unchecked(&key2, &sch2); DES_set_key_unchecked(&key3, &sch3); #endif #ifndef OPENSSL_NO_AES AES_set_encrypt_key(key16, 128, &aes_ks1); AES_set_encrypt_key(key24, 192, &aes_ks2); AES_set_encrypt_key(key32, 256, &aes_ks3); #endif #ifndef OPENSSL_NO_CAMELLIA Camellia_set_key(key16, 128, &camellia_ks1); Camellia_set_key(ckey24, 192, &camellia_ks2); Camellia_set_key(ckey32, 256, &camellia_ks3); #endif #ifndef OPENSSL_NO_IDEA idea_set_encrypt_key(key16, &idea_ks); #endif #ifndef OPENSSL_NO_SEED SEED_set_key(key16, &seed_ks); #endif #ifndef OPENSSL_NO_RC4 RC4_set_key(&rc4_ks, 16, key16); #endif #ifndef OPENSSL_NO_RC2 RC2_set_key(&rc2_ks, 16, key16, 128); #endif #ifndef OPENSSL_NO_RC5 RC5_32_set_key(&rc5_ks, 16, key16, 12); #endif #ifndef OPENSSL_NO_BF BF_set_key(&bf_ks, 16, key16); #endif #ifndef OPENSSL_NO_CAST CAST_set_key(&cast_ks, 16, key16); #endif #ifndef OPENSSL_NO_RSA memset(rsa_c, 0, sizeof(rsa_c)); #endif #ifndef SIGALRM # ifndef OPENSSL_NO_DES BIO_printf(bio_err, "First we calculate the approximate speed ...\n"); count = 10; do { long it; count *= 2; Time_F(START); for (it = count; it; it--) DES_ecb_encrypt((DES_cblock *)buf, (DES_cblock *)buf, &sch, DES_ENCRYPT); d = Time_F(STOP); } while (d < 3); save_count = count; c[D_MD2][0] = count / 10; c[D_MDC2][0] = count / 10; c[D_MD4][0] = count; c[D_MD5][0] = count; c[D_HMAC][0] = count; c[D_SHA1][0] = count; c[D_RMD160][0] = count; c[D_RC4][0] = count * 5; c[D_CBC_DES][0] = count; c[D_EDE3_DES][0] = count / 3; c[D_CBC_IDEA][0] = count; c[D_CBC_SEED][0] = count; c[D_CBC_RC2][0] = count; c[D_CBC_RC5][0] = count; c[D_CBC_BF][0] = count; c[D_CBC_CAST][0] = count; c[D_CBC_128_AES][0] = count; c[D_CBC_192_AES][0] = count; c[D_CBC_256_AES][0] = count; c[D_CBC_128_CML][0] = count; c[D_CBC_192_CML][0] = count; c[D_CBC_256_CML][0] = count; c[D_SHA256][0] = count; c[D_SHA512][0] = count; c[D_WHIRLPOOL][0] = count; c[D_IGE_128_AES][0] = count; c[D_IGE_192_AES][0] = count; c[D_IGE_256_AES][0] = count; c[D_GHASH][0] = count; for (i = 1; i < SIZE_NUM; i++) { long l0, l1; l0 = (long)lengths[0]; l1 = (long)lengths[i]; c[D_MD2][i] = c[D_MD2][0] * 4 * l0 / l1; c[D_MDC2][i] = c[D_MDC2][0] * 4 * l0 / l1; c[D_MD4][i] = c[D_MD4][0] * 4 * l0 / l1; c[D_MD5][i] = c[D_MD5][0] * 4 * l0 / l1; c[D_HMAC][i] = c[D_HMAC][0] * 4 * l0 / l1; c[D_SHA1][i] = c[D_SHA1][0] * 4 * l0 / l1; c[D_RMD160][i] = c[D_RMD160][0] * 4 * l0 / l1; c[D_SHA256][i] = c[D_SHA256][0] * 4 * l0 / l1; c[D_SHA512][i] = c[D_SHA512][0] * 4 * l0 / l1; c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * l0 / l1; l0 = (long)lengths[i - 1]; c[D_RC4][i] = c[D_RC4][i - 1] * l0 / l1; c[D_CBC_DES][i] = c[D_CBC_DES][i - 1] * l0 / l1; c[D_EDE3_DES][i] = c[D_EDE3_DES][i - 1] * l0 / l1; c[D_CBC_IDEA][i] = c[D_CBC_IDEA][i - 1] * l0 / l1; c[D_CBC_SEED][i] = c[D_CBC_SEED][i - 1] * l0 / l1; c[D_CBC_RC2][i] = c[D_CBC_RC2][i - 1] * l0 / l1; c[D_CBC_RC5][i] = c[D_CBC_RC5][i - 1] * l0 / l1; c[D_CBC_BF][i] = c[D_CBC_BF][i - 1] * l0 / l1; c[D_CBC_CAST][i] = c[D_CBC_CAST][i - 1] * l0 / l1; c[D_CBC_128_AES][i] = c[D_CBC_128_AES][i - 1] * l0 / l1; c[D_CBC_192_AES][i] = c[D_CBC_192_AES][i - 1] * l0 / l1; c[D_CBC_256_AES][i] = c[D_CBC_256_AES][i - 1] * l0 / l1; c[D_CBC_128_CML][i] = c[D_CBC_128_CML][i - 1] * l0 / l1; c[D_CBC_192_CML][i] = c[D_CBC_192_CML][i - 1] * l0 / l1; c[D_CBC_256_CML][i] = c[D_CBC_256_CML][i - 1] * l0 / l1; c[D_IGE_128_AES][i] = c[D_IGE_128_AES][i - 1] * l0 / l1; c[D_IGE_192_AES][i] = c[D_IGE_192_AES][i - 1] * l0 / l1; c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1; } # ifndef OPENSSL_NO_RSA rsa_c[R_RSA_512][0] = count / 2000; rsa_c[R_RSA_512][1] = count / 400; for (i = 1; i < RSA_NUM; i++) { rsa_c[i][0] = rsa_c[i - 1][0] / 8; rsa_c[i][1] = rsa_c[i - 1][1] / 4; if ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0)) rsa_doit[i] = 0; else { if (rsa_c[i][0] == 0) { rsa_c[i][0] = 1; rsa_c[i][1] = 20; } } } # endif # ifndef OPENSSL_NO_DSA dsa_c[R_DSA_512][0] = count / 1000; dsa_c[R_DSA_512][1] = count / 1000 / 2; for (i = 1; i < DSA_NUM; i++) { dsa_c[i][0] = dsa_c[i - 1][0] / 4; dsa_c[i][1] = dsa_c[i - 1][1] / 4; if ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0)) dsa_doit[i] = 0; else { if (dsa_c[i] == 0) { dsa_c[i][0] = 1; dsa_c[i][1] = 1; } } } # endif # ifndef OPENSSL_NO_EC ecdsa_c[R_EC_P160][0] = count / 1000; ecdsa_c[R_EC_P160][1] = count / 1000 / 2; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_K163][0] = count / 1000; ecdsa_c[R_EC_K163][1] = count / 1000 / 2; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_B163][0] = count / 1000; ecdsa_c[R_EC_B163][1] = count / 1000 / 2; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdh_c[R_EC_P160][0] = count / 1000; ecdh_c[R_EC_P160][1] = count / 1000; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } ecdh_c[R_EC_K163][0] = count / 1000; ecdh_c[R_EC_K163][1] = count / 1000; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } ecdh_c[R_EC_B163][0] = count / 1000; ecdh_c[R_EC_B163][1] = count / 1000; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } # endif # define COND(d) (count < (d)) # define COUNT(d) (d) # else # error "You cannot disable DES on systems without SIGALRM." # endif #else # define COND(c) (run && count<0x7fffffff) # define COUNT(d) (count) # ifndef _WIN32 signal(SIGALRM, sig_done); # endif #endif #ifndef OPENSSL_NO_MD2 if (doit[D_MD2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD2], c[D_MD2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD2][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(md2[0]), NULL, EVP_md2(), NULL); d = Time_F(STOP); print_result(D_MD2, j, count, d); } } #endif #ifndef OPENSSL_NO_MDC2 if (doit[D_MDC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MDC2], c[D_MDC2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MDC2][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(mdc2[0]), NULL, EVP_mdc2(), NULL); d = Time_F(STOP); print_result(D_MDC2, j, count, d); } } #endif #ifndef OPENSSL_NO_MD4 if (doit[D_MD4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD4], c[D_MD4][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD4][j]); count++) EVP_Digest(&(buf[0]), (unsigned long)lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); d = Time_F(STOP); print_result(D_MD4, j, count, d); } } #endif #ifndef OPENSSL_NO_MD5 if (doit[D_MD5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD5], c[D_MD5][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD5][j]); count++) MD5(buf, lengths[j], md5); d = Time_F(STOP); print_result(D_MD5, j, count, d); } } #endif #if !defined(OPENSSL_NO_MD5) if (doit[D_HMAC]) { HMAC_CTX hctx; HMAC_CTX_init(&hctx); HMAC_Init_ex(&hctx, (unsigned char *)"This is a key...", 16, EVP_md5(), NULL); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { HMAC_Init_ex(&hctx, NULL, 0, NULL, NULL); HMAC_Update(&hctx, buf, lengths[j]); HMAC_Final(&hctx, &(hmac[0]), NULL); } d = Time_F(STOP); print_result(D_HMAC, j, count, d); } HMAC_CTX_cleanup(&hctx); } #endif if (doit[D_SHA1]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) SHA1(buf, lengths[j], sha); d = Time_F(STOP); print_result(D_SHA1, j, count, d); } } if (doit[D_SHA256]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA256][j]); count++) SHA256(buf, lengths[j], sha256); d = Time_F(STOP); print_result(D_SHA256, j, count, d); } } if (doit[D_SHA512]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA512][j]); count++) SHA512(buf, lengths[j], sha512); d = Time_F(STOP); print_result(D_SHA512, j, count, d); } } #ifndef OPENSSL_NO_WHIRLPOOL if (doit[D_WHIRLPOOL]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++) WHIRLPOOL(buf, lengths[j], whirlpool); d = Time_F(STOP); print_result(D_WHIRLPOOL, j, count, d); } } #endif #ifndef OPENSSL_NO_RMD160 if (doit[D_RMD160]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_RMD160][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(rmd160[0]), NULL, EVP_ripemd160(), NULL); d = Time_F(STOP); print_result(D_RMD160, j, count, d); } } #endif #ifndef OPENSSL_NO_RC4 if (doit[D_RC4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RC4], c[D_RC4][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_RC4][j]); count++) RC4(&rc4_ks, (unsigned int)lengths[j], buf, buf); d = Time_F(STOP); print_result(D_RC4, j, count, d); } } #endif #ifndef OPENSSL_NO_DES if (doit[D_CBC_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++) DES_ncbc_encrypt(buf, buf, lengths[j], &sch, &DES_iv, DES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_DES, j, count, d); } } if (doit[D_EDE3_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++) DES_ede3_cbc_encrypt(buf, buf, lengths[j], &sch, &sch2, &sch3, &DES_iv, DES_ENCRYPT); d = Time_F(STOP); print_result(D_EDE3_DES, j, count, d); } } #endif #ifndef OPENSSL_NO_AES if (doit[D_CBC_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks1, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_AES, j, count, d); } } if (doit[D_CBC_192_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks2, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_AES, j, count, d); } } if (doit[D_CBC_256_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks3, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_AES, j, count, d); } } if (doit[D_IGE_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks1, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_128_AES, j, count, d); } } if (doit[D_IGE_192_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks2, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_192_AES, j, count, d); } } if (doit[D_IGE_256_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks3, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_256_AES, j, count, d); } } if (doit[D_GHASH]) { GCM128_CONTEXT *ctx = CRYPTO_gcm128_new(&aes_ks1, (block128_f) AES_encrypt); CRYPTO_gcm128_setiv(ctx, (unsigned char *)"0123456789ab", 12); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_GHASH][j]); count++) CRYPTO_gcm128_aad(ctx, buf, lengths[j]); d = Time_F(STOP); print_result(D_GHASH, j, count, d); } CRYPTO_gcm128_release(ctx); } #endif #ifndef OPENSSL_NO_CAMELLIA if (doit[D_CBC_128_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks1, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_CML, j, count, d); } } if (doit[D_CBC_192_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks2, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_CML, j, count, d); } } if (doit[D_CBC_256_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks3, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_CML, j, count, d); } } #endif #ifndef OPENSSL_NO_IDEA if (doit[D_CBC_IDEA]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++) idea_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &idea_ks, iv, IDEA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_IDEA, j, count, d); } } #endif #ifndef OPENSSL_NO_SEED if (doit[D_CBC_SEED]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_SEED], c[D_CBC_SEED][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_SEED][j]); count++) SEED_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &seed_ks, iv, 1); d = Time_F(STOP); print_result(D_CBC_SEED, j, count, d); } } #endif #ifndef OPENSSL_NO_RC2 if (doit[D_CBC_RC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++) RC2_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &rc2_ks, iv, RC2_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC2, j, count, d); } } #endif #ifndef OPENSSL_NO_RC5 if (doit[D_CBC_RC5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC5], c[D_CBC_RC5][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC5][j]); count++) RC5_32_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &rc5_ks, iv, RC5_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC5, j, count, d); } } #endif #ifndef OPENSSL_NO_BF if (doit[D_CBC_BF]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++) BF_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &bf_ks, iv, BF_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_BF, j, count, d); } } #endif #ifndef OPENSSL_NO_CAST if (doit[D_CBC_CAST]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++) CAST_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &cast_ks, iv, CAST_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_CAST, j, count, d); } } #endif if (doit[D_EVP]) { #ifdef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK if (multiblock && evp_cipher) { if (! (EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) { fprintf(stderr, "%s is not multi-block capable\n", OBJ_nid2ln(evp_cipher->nid)); goto end; } multiblock_speed(evp_cipher); mret = 0; goto end; } #endif for (j = 0; j < SIZE_NUM; j++) { if (evp_cipher) { EVP_CIPHER_CTX ctx; int outl; names[D_EVP] = OBJ_nid2ln(evp_cipher->nid); print_message(names[D_EVP], save_count, lengths[j]); EVP_CIPHER_CTX_init(&ctx); if (decrypt) EVP_DecryptInit_ex(&ctx, evp_cipher, NULL, key16, iv); else EVP_EncryptInit_ex(&ctx, evp_cipher, NULL, key16, iv); EVP_CIPHER_CTX_set_padding(&ctx, 0); Time_F(START); if (decrypt) for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_DecryptUpdate(&ctx, buf, &outl, buf, lengths[j]); else for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_EncryptUpdate(&ctx, buf, &outl, buf, lengths[j]); if (decrypt) EVP_DecryptFinal_ex(&ctx, buf, &outl); else EVP_EncryptFinal_ex(&ctx, buf, &outl); d = Time_F(STOP); EVP_CIPHER_CTX_cleanup(&ctx); } if (evp_md) { names[D_EVP] = OBJ_nid2ln(evp_md->type); print_message(names[D_EVP], save_count, lengths[j]); Time_F(START); for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); d = Time_F(STOP); } print_result(D_EVP, j, count, d); } } #ifndef OPENSSL_SYS_WIN32 #endif RAND_pseudo_bytes(buf, 36); #ifndef OPENSSL_NO_RSA for (j = 0; j < RSA_NUM; j++) { int ret; if (!rsa_doit[j]) continue; ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "RSA sign failure. No RSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("private", "rsa", rsa_c[j][0], rsa_bits[j], RSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(rsa_c[j][0]); count++) { ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "RSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" : "%ld %d bit private RSA's in %.2fs\n", count, rsa_bits[j], d); rsa_results[j][0] = d / (double)count; rsa_count = count; } ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure. No RSA verify will be done.\n"); ERR_print_errors(bio_err); rsa_doit[j] = 0; } else { pkey_print_message("public", "rsa", rsa_c[j][1], rsa_bits[j], RSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(rsa_c[j][1]); count++) { ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" : "%ld %d bit public RSA's in %.2fs\n", count, rsa_bits[j], d); rsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { for (j++; j < RSA_NUM; j++) rsa_doit[j] = 0; } } #endif RAND_pseudo_bytes(buf, 20); #ifndef OPENSSL_NO_DSA if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < DSA_NUM; j++) { unsigned int kk; int ret; if (!dsa_doit[j]) continue; ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "DSA sign failure. No DSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "dsa", dsa_c[j][0], dsa_bits[j], DSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(dsa_c[j][0]); count++) { ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "DSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" : "%ld %d bit DSA signs in %.2fs\n", count, dsa_bits[j], d); dsa_results[j][0] = d / (double)count; rsa_count = count; } ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "DSA verify failure. No DSA verify will be done.\n"); ERR_print_errors(bio_err); dsa_doit[j] = 0; } else { pkey_print_message("verify", "dsa", dsa_c[j][1], dsa_bits[j], DSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(dsa_c[j][1]); count++) { ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "DSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" : "%ld %d bit DSA verify in %.2fs\n", count, dsa_bits[j], d); dsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { for (j++; j < DSA_NUM; j++) dsa_doit[j] = 0; } } if (rnd_fake) RAND_cleanup(); #endif #ifndef OPENSSL_NO_EC if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < EC_NUM; j++) { int ret; if (!ecdsa_doit[j]) continue; ecdsa[j] = EC_KEY_new_by_curve_name(test_curves[j]); if (ecdsa[j] == NULL) { BIO_printf(bio_err, "ECDSA failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { EC_KEY_precompute_mult(ecdsa[j], NULL); EC_KEY_generate_key(ecdsa[j]); ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); if (ret == 0) { BIO_printf(bio_err, "ECDSA sign failure. No ECDSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "ecdsa", ecdsa_c[j][0], test_curves_bits[j], ECDSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdsa_c[j][0]); count++) { ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); if (ret == 0) { BIO_printf(bio_err, "ECDSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : "%ld %d bit ECDSA signs in %.2fs \n", count, test_curves_bits[j], d); ecdsa_results[j][0] = d / (double)count; rsa_count = count; } ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); if (ret != 1) { BIO_printf(bio_err, "ECDSA verify failure. No ECDSA verify will be done.\n"); ERR_print_errors(bio_err); ecdsa_doit[j] = 0; } else { pkey_print_message("verify", "ecdsa", ecdsa_c[j][1], test_curves_bits[j], ECDSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) { ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); if (ret != 1) { BIO_printf(bio_err, "ECDSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" : "%ld %d bit ECDSA verify in %.2fs\n", count, test_curves_bits[j], d); ecdsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { for (j++; j < EC_NUM; j++) ecdsa_doit[j] = 0; } } } if (rnd_fake) RAND_cleanup(); if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < EC_NUM; j++) { if (!ecdh_doit[j]) continue; ecdh_a[j] = EC_KEY_new_by_curve_name(test_curves[j]); ecdh_b[j] = EC_KEY_new_by_curve_name(test_curves[j]); if ((ecdh_a[j] == NULL) || (ecdh_b[j] == NULL)) { BIO_printf(bio_err, "ECDH failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { if (!EC_KEY_generate_key(ecdh_a[j]) || !EC_KEY_generate_key(ecdh_b[j])) { BIO_printf(bio_err, "ECDH key generation failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { int field_size, outlen; void *(*kdf) (const void *in, size_t inlen, void *out, size_t *xoutlen); field_size = EC_GROUP_get_degree(EC_KEY_get0_group(ecdh_a[j])); if (field_size <= 24 * 8) { outlen = KDF1_SHA1_len; kdf = KDF1_SHA1; } else { outlen = (field_size + 7) / 8; kdf = NULL; } secret_size_a = ECDH_compute_key(secret_a, outlen, EC_KEY_get0_public_key(ecdh_b[j]), ecdh_a[j], kdf); secret_size_b = ECDH_compute_key(secret_b, outlen, EC_KEY_get0_public_key(ecdh_a[j]), ecdh_b[j], kdf); if (secret_size_a != secret_size_b) ecdh_checks = 0; else ecdh_checks = 1; for (secret_idx = 0; (secret_idx < secret_size_a) && (ecdh_checks == 1); secret_idx++) { if (secret_a[secret_idx] != secret_b[secret_idx]) ecdh_checks = 0; } if (ecdh_checks == 0) { BIO_printf(bio_err, "ECDH computations don't match.\n"); ERR_print_errors(bio_err); rsa_count = 1; } pkey_print_message("", "ecdh", ecdh_c[j][0], test_curves_bits[j], ECDH_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdh_c[j][0]); count++) { ECDH_compute_key(secret_a, outlen, EC_KEY_get0_public_key(ecdh_b[j]), ecdh_a[j], kdf); } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" : "%ld %d-bit ECDH ops in %.2fs\n", count, test_curves_bits[j], d); ecdh_results[j][0] = d / (double)count; rsa_count = count; } } if (rsa_count <= 1) { for (j++; j < EC_NUM; j++) ecdh_doit[j] = 0; } } if (rnd_fake) RAND_cleanup(); #endif #ifndef NO_FORK show_res: #endif if (!mr) { fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION)); fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON)); printf("options:"); printf("%s ", BN_options()); #ifndef OPENSSL_NO_MD2 printf("%s ", MD2_options()); #endif #ifndef OPENSSL_NO_RC4 printf("%s ", RC4_options()); #endif #ifndef OPENSSL_NO_DES printf("%s ", DES_options()); #endif #ifndef OPENSSL_NO_AES printf("%s ", AES_options()); #endif #ifndef OPENSSL_NO_IDEA printf("%s ", idea_options()); #endif #ifndef OPENSSL_NO_BF printf("%s ", BF_options()); #endif fprintf(stdout, "\n%s\n", SSLeay_version(SSLEAY_CFLAGS)); } if (pr_header) { if (mr) fprintf(stdout, "+H"); else { fprintf(stdout, "The 'numbers' are in 1000s of bytes per second processed.\n"); fprintf(stdout, "type "); } for (j = 0; j < SIZE_NUM; j++) fprintf(stdout, mr ? ":%d" : "%7d bytes", lengths[j]); fprintf(stdout, "\n"); } for (k = 0; k < ALGOR_NUM; k++) { if (!doit[k]) continue; if (mr) fprintf(stdout, "+F:%d:%s", k, names[k]); else fprintf(stdout, "%-13s", names[k]); for (j = 0; j < SIZE_NUM; j++) { if (results[k][j] > 10000 && !mr) fprintf(stdout, " %11.2fk", results[k][j] / 1e3); else fprintf(stdout, mr ? ":%.2f" : " %11.2f ", results[k][j]); } fprintf(stdout, "\n"); } #ifndef OPENSSL_NO_RSA j = 1; for (k = 0; k < RSA_NUM; k++) { if (!rsa_doit[k]) continue; if (j && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F2:%u:%u:%f:%f\n", k, rsa_bits[k], rsa_results[k][0], rsa_results[k][1]); else fprintf(stdout, "rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", rsa_bits[k], rsa_results[k][0], rsa_results[k][1], 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1]); } #endif #ifndef OPENSSL_NO_DSA j = 1; for (k = 0; k < DSA_NUM; k++) { if (!dsa_doit[k]) continue; if (j && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F3:%u:%u:%f:%f\n", k, dsa_bits[k], dsa_results[k][0], dsa_results[k][1]); else fprintf(stdout, "dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", dsa_bits[k], dsa_results[k][0], dsa_results[k][1], 1.0 / dsa_results[k][0], 1.0 / dsa_results[k][1]); } #endif #ifndef OPENSSL_NO_EC j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdsa_doit[k]) continue; if (j && !mr) { printf("%30ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F4:%u:%u:%f:%f\n", k, test_curves_bits[k], ecdsa_results[k][0], ecdsa_results[k][1]); else fprintf(stdout, "%4u bit ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n", test_curves_bits[k], test_curves_names[k], ecdsa_results[k][0], ecdsa_results[k][1], 1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1]); } j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdh_doit[k]) continue; if (j && !mr) { printf("%30sop op/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F5:%u:%u:%f:%f\n", k, test_curves_bits[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); else fprintf(stdout, "%4u bit ecdh (%s) %8.4fs %8.1f\n", test_curves_bits[k], test_curves_names[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); } #endif mret = 0; end: ERR_print_errors(bio_err); if (buf_malloc != NULL) OPENSSL_free(buf_malloc); if (buf2_malloc != NULL) OPENSSL_free(buf2_malloc); #ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) if (rsa_key[i] != NULL) RSA_free(rsa_key[i]); #endif #ifndef OPENSSL_NO_DSA for (i = 0; i < DSA_NUM; i++) if (dsa_key[i] != NULL) DSA_free(dsa_key[i]); #endif #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) if (ecdsa[i] != NULL) EC_KEY_free(ecdsa[i]); for (i = 0; i < EC_NUM; i++) { if (ecdh_a[i] != NULL) EC_KEY_free(ecdh_a[i]); if (ecdh_b[i] != NULL) EC_KEY_free(ecdh_b[i]); } #endif apps_shutdown(); OPENSSL_EXIT(mret); } apps/speed.c:2465: error: UNINITIALIZED_VALUE The value read from ecdh_a[_] was never initialized. Showing all 1 steps of the trace apps/speed.c:2465:13: 2463. EC_KEY_free(ecdsa[i]); 2464. for (i = 0; i < EC_NUM; i++) { 2465. > if (ecdh_a[i] != NULL) 2466. EC_KEY_free(ecdh_a[i]); 2467. if (ecdh_b[i] != NULL)
https://github.com/openssl/openssl/blob/6b937f8b115d817b00116bc6291d604b16dc4602/apps/speed.c/#L2465
d2a_code_trace_data_45517
char *CRYPTO_strdup(const char *str, const char* file, int line) { char *ret; if (str == NULL) return NULL; ret = CRYPTO_malloc(strlen(str) + 1, file, line); if (ret != NULL) strcpy(ret, str); return ret; } apps/rehash.c:204: error: BUFFER_OVERRUN_L3 Offset: [0, 4095] Size: [1, 4096] by call to `add_entry`. Showing all 12 steps of the trace apps/rehash.c:171:1: Array declaration 169. * This can be -1 if bad filename, or an error count. 170. */ 171. > static int handle_symlink(const char *filename, const char *fullpath) 172. { 173. unsigned int hash = 0; apps/rehash.c:204:12: Call 202. linktarget[n] = 0; 203. 204. return add_entry(type, hash, linktarget, NULL, 0, id); ^ 205. } 206. apps/rehash.c:103:1: Parameter `filename->strlen` 101. * Process an entry; return number of errors. 102. */ 103. > static int add_entry(enum Type type, unsigned int hash, const char *filename, 104. const unsigned char *digest, int need_symlink, 105. unsigned short old_id) apps/rehash.c:149:24: Call 147. *ep = nilhentry; 148. ep->old_id = ~0; 149. ep->filename = OPENSSL_strdup(filename); ^ 150. if (bp->last_entry) 151. bp->last_entry->next = ep; crypto/o_str.c:27:1: <Offset trace> 25. } 26. 27. > char *CRYPTO_strdup(const char *str, const char* file, int line) 28. { 29. char *ret; crypto/o_str.c:27:1: Parameter `str->strlen` 25. } 26. 27. > char *CRYPTO_strdup(const char *str, const char* file, int line) 28. { 29. char *ret; crypto/o_str.c:27:1: <Length trace> 25. } 26. 27. > char *CRYPTO_strdup(const char *str, const char* file, int line) 28. { 29. char *ret; crypto/o_str.c:27:1: Parameter `str->strlen` 25. } 26. 27. > char *CRYPTO_strdup(const char *str, const char* file, int line) 28. { 29. char *ret; crypto/o_str.c:33:11: Call 31. if (str == NULL) 32. return NULL; 33. ret = CRYPTO_malloc(strlen(str) + 1, file, line); ^ 34. if (ret != NULL) 35. strcpy(ret, str); crypto/mem.c:178:9: Assignment 176. 177. if (num == 0) 178. return NULL; ^ 179. 180. FAILTEST(); crypto/o_str.c:33:5: Assignment 31. if (str == NULL) 32. return NULL; 33. ret = CRYPTO_malloc(strlen(str) + 1, file, line); ^ 34. if (ret != NULL) 35. strcpy(ret, str); crypto/o_str.c:35:9: Array access: Offset: [0, 4095] Size: [1, 4096] by call to `add_entry` 33. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 34. if (ret != NULL) 35. strcpy(ret, str); ^ 36. return ret; 37. }
https://github.com/openssl/openssl/blob/f4eb24839228675386d0cbfd3e5c2291763a0be4/crypto/o_str.c/#L35
d2a_code_trace_data_45518
int ssl_handshake_hash(SSL *s, unsigned char *out, int outlen) { EVP_MD_CTX *ctx = NULL; EVP_MD_CTX *hdgst = s->s3->handshake_dgst; int ret = EVP_MD_CTX_size(hdgst); if (ret < 0 || ret > outlen) { ret = 0; goto err; } ctx = EVP_MD_CTX_new(); if (ctx == NULL) { ret = 0; goto err; } if (!EVP_MD_CTX_copy_ex(ctx, hdgst) || EVP_DigestFinal_ex(ctx, out, NULL) <= 0) ret = 0; err: EVP_MD_CTX_free(ctx); return ret; } ssl/ssl_lib.c:3201: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 3192 could be null and is dereferenced by call to `EVP_MD_CTX_free()` at line 3201, column 5. Showing all 37 steps of the trace ssl/ssl_lib.c:3183:1: start of procedure ssl_handshake_hash() 3181. 3182. /* Retrieve handshake hashes */ 3183. > int ssl_handshake_hash(SSL *s, unsigned char *out, int outlen) 3184. { 3185. EVP_MD_CTX *ctx = NULL; ssl/ssl_lib.c:3185:5: 3183. int ssl_handshake_hash(SSL *s, unsigned char *out, int outlen) 3184. { 3185. > EVP_MD_CTX *ctx = NULL; 3186. EVP_MD_CTX *hdgst = s->s3->handshake_dgst; 3187. int ret = EVP_MD_CTX_size(hdgst); ssl/ssl_lib.c:3186:5: 3184. { 3185. EVP_MD_CTX *ctx = NULL; 3186. > EVP_MD_CTX *hdgst = s->s3->handshake_dgst; 3187. int ret = EVP_MD_CTX_size(hdgst); 3188. if (ret < 0 || ret > outlen) { ssl/ssl_lib.c:3187:5: 3185. EVP_MD_CTX *ctx = NULL; 3186. EVP_MD_CTX *hdgst = s->s3->handshake_dgst; 3187. > int ret = EVP_MD_CTX_size(hdgst); 3188. if (ret < 0 || ret > outlen) { 3189. ret = 0; crypto/evp/evp_lib.c:436:1: start of procedure EVP_MD_CTX_md() 434. } 435. 436. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) 437. { 438. if (!ctx) crypto/evp/evp_lib.c:438:10: Taking false branch 436. const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) 437. { 438. if (!ctx) ^ 439. return NULL; 440. return ctx->digest; crypto/evp/evp_lib.c:440:5: 438. if (!ctx) 439. return NULL; 440. > return ctx->digest; 441. } 442. crypto/evp/evp_lib.c:441:1: return from a call to EVP_MD_CTX_md 439. return NULL; 440. return ctx->digest; 441. > } 442. 443. EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx) crypto/evp/evp_lib.c:300:1: start of procedure EVP_MD_size() 298. } 299. 300. > int EVP_MD_size(const EVP_MD *md) 301. { 302. if (!md) { crypto/evp/evp_lib.c:302:10: Taking false branch 300. int EVP_MD_size(const EVP_MD *md) 301. { 302. if (!md) { ^ 303. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL); 304. return -1; crypto/evp/evp_lib.c:306:5: 304. return -1; 305. } 306. > return md->md_size; 307. } 308. crypto/evp/evp_lib.c:307:1: return from a call to EVP_MD_size 305. } 306. return md->md_size; 307. > } 308. 309. unsigned long EVP_MD_flags(const EVP_MD *md) ssl/ssl_lib.c:3188:9: Taking false branch 3186. EVP_MD_CTX *hdgst = s->s3->handshake_dgst; 3187. int ret = EVP_MD_CTX_size(hdgst); 3188. if (ret < 0 || ret > outlen) { ^ 3189. ret = 0; 3190. goto err; ssl/ssl_lib.c:3188:20: Taking false branch 3186. EVP_MD_CTX *hdgst = s->s3->handshake_dgst; 3187. int ret = EVP_MD_CTX_size(hdgst); 3188. if (ret < 0 || ret > outlen) { ^ 3189. ret = 0; 3190. goto err; ssl/ssl_lib.c:3192:5: 3190. goto err; 3191. } 3192. > ctx = EVP_MD_CTX_new(); 3193. if (ctx == NULL) { 3194. ret = 0; 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:312:1: start of procedure CRYPTO_zalloc() 310. } 311. 312. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 313. { 314. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:314:5: 312. void *CRYPTO_zalloc(size_t num, const char *file, int line) 313. { 314. > void *ret = CRYPTO_malloc(num, file, line); 315. 316. if (ret != NULL) crypto/mem.c:279:1: start of procedure CRYPTO_malloc() 277. } 278. 279. > void *CRYPTO_malloc(size_t num, const char *file, int line) 280. { 281. void *ret = NULL; crypto/mem.c:281:5: 279. void *CRYPTO_malloc(size_t num, const char *file, int line) 280. { 281. > void *ret = NULL; 282. 283. if (num <= 0) crypto/mem.c:283:9: Taking false branch 281. void *ret = NULL; 282. 283. if (num <= 0) ^ 284. return NULL; 285. crypto/mem.c:286:9: Taking true branch 284. return NULL; 285. 286. if (allow_customize) ^ 287. allow_customize = 0; 288. if (malloc_debug_func != NULL) { crypto/mem.c:287:9: 285. 286. if (allow_customize) 287. > allow_customize = 0; 288. if (malloc_debug_func != NULL) { 289. if (allow_customize_debug) crypto/mem.c:288:9: Taking false branch 286. if (allow_customize) 287. allow_customize = 0; 288. if (malloc_debug_func != NULL) { ^ 289. if (allow_customize_debug) 290. allow_customize_debug = 0; crypto/mem.c:293:5: Skipping __function_pointer__(): unresolved function pointer 291. malloc_debug_func(NULL, num, file, line, 0); 292. } 293. ret = malloc_ex_func(num, file, line); ^ 294. if (malloc_debug_func != NULL) 295. malloc_debug_func(ret, num, file, line, 1); crypto/mem.c:294:9: Taking false branch 292. } 293. ret = malloc_ex_func(num, file, line); 294. if (malloc_debug_func != NULL) ^ 295. malloc_debug_func(ret, num, file, line, 1); 296. crypto/mem.c:309:5: 307. #endif 308. 309. > return ret; 310. } 311. crypto/mem.c:310:1: return from a call to CRYPTO_malloc 308. 309. return ret; 310. > } 311. 312. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:316:9: Taking false branch 314. void *ret = CRYPTO_malloc(num, file, line); 315. 316. if (ret != NULL) ^ 317. memset(ret, 0, num); 318. return ret; crypto/mem.c:318:5: 316. if (ret != NULL) 317. memset(ret, 0, num); 318. > return ret; 319. } 320. crypto/mem.c:319:1: return from a call to CRYPTO_zalloc 317. memset(ret, 0, num); 318. return ret; 319. > } 320. 321. 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/ssl_lib.c:3193:9: Taking true branch 3191. } 3192. ctx = EVP_MD_CTX_new(); 3193. if (ctx == NULL) { ^ 3194. ret = 0; 3195. goto err; ssl/ssl_lib.c:3194:9: 3192. ctx = EVP_MD_CTX_new(); 3193. if (ctx == NULL) { 3194. > ret = 0; 3195. goto err; 3196. } ssl/ssl_lib.c:3200:2: 3198. || EVP_DigestFinal_ex(ctx, out, NULL) <= 0) 3199. ret = 0; 3200. > err: 3201. EVP_MD_CTX_free(ctx); 3202. return ret; ssl/ssl_lib.c:3201:5: 3199. ret = 0; 3200. err: 3201. > EVP_MD_CTX_free(ctx); 3202. return ret; 3203. }
https://github.com/openssl/openssl/blob/bc71f91064a3eec10310fa4cc14fe2a3fd9bc7bb/ssl/ssl_lib.c/#L3201
d2a_code_trace_data_45519
static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) { int i; for (i = 0; i < 4; i++) { block[0] = pixels[0]; block[1] = pixels[1]; block[2] = pixels[2]; block[3] = pixels[3]; block[4] = pixels[4]; block[5] = pixels[5]; block[6] = pixels[6]; block[7] = pixels[7]; pixels += line_size; block += 8; } memcpy(block , block- 8, sizeof(*block)*8); memcpy(block+ 8, block-16, sizeof(*block)*8); memcpy(block+16, block-24, sizeof(*block)*8); memcpy(block+24, block-32, sizeof(*block)*8); } libavcodec/dnxhdenc.c:416: error: Buffer Overrun L3 Offset added: [-11, +oo] (⇐ [-27, +oo] + 16) Size: 128 by call to `dnxhd_get_pixels_4x8`. libavcodec/dnxhdenc.c:401:1: Parameter `ctx->blocks[*]` 399. } 400. 401. static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y) ^ 402. { 403. const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize) + (mb_x << 4); libavcodec/dnxhdenc.c:416:13: Call 414. if (ctx->interlaced) { 415. dnxhd_get_pixels_4x8(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize); 416. dnxhd_get_pixels_4x8(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize); ^ 417. dnxhd_get_pixels_4x8(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize); 418. dnxhd_get_pixels_4x8(ctx->blocks[7], ptr_v + ctx->dct_uv_offset , ctx->m.uvlinesize); libavcodec/dnxhdenc.c:380:1: <Length trace> 378. } 379. 380. static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) ^ 381. { 382. int i; libavcodec/dnxhdenc.c:380:1: Parameter `*block` 378. } 379. 380. static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) ^ 381. { 382. int i; libavcodec/dnxhdenc.c:398:5: Array access: Offset added: [-11, +oo] (⇐ [-27, +oo] + 16) Size: 128 by call to `dnxhd_get_pixels_4x8` 396. memcpy(block+ 8, block-16, sizeof(*block)*8); 397. memcpy(block+16, block-24, sizeof(*block)*8); 398. memcpy(block+24, block-32, sizeof(*block)*8); ^ 399. } 400.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dnxhdenc.c/#L398
d2a_code_trace_data_45520
int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, X509_OBJECT *ret) { X509_STORE *ctx=vs->ctx; X509_LOOKUP *lu; X509_OBJECT stmp,*tmp; int i,j; CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); if (tmp == NULL || type == X509_LU_CRL) { for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) { lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); j=X509_LOOKUP_by_subject(lu,type,name,&stmp); if (j < 0) { vs->current_method=j; return j; } else if (j) { tmp= &stmp; break; } } vs->current_method=0; if (tmp == NULL) return 0; } ret->type=tmp->type; ret->data.ptr=tmp->data.ptr; X509_OBJECT_up_ref_count(ret); return 1; } crypto/x509/x509_lu.c:319: error: NULL_DEREFERENCE pointer `lu` last assigned on line 318 could be null and is dereferenced by call to `X509_LOOKUP_by_subject()` at line 319, column 6. Showing all 52 steps of the trace crypto/x509/x509_lu.c:302:1: start of procedure X509_STORE_get_by_subject() 300. } 301. 302. > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, 303. X509_OBJECT *ret) 304. { crypto/x509/x509_lu.c:305:2: 303. X509_OBJECT *ret) 304. { 305. > X509_STORE *ctx=vs->ctx; 306. X509_LOOKUP *lu; 307. X509_OBJECT stmp,*tmp; crypto/x509/x509_lu.c:310:2: 308. int i,j; 309. 310. > CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 311. tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); 312. CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); crypto/lock.c:426:1: start of procedure CRYPTO_lock() 424. } 425. 426. > void CRYPTO_lock(int mode, int type, const char *file, int line) 427. { 428. #ifdef LOCK_DEBUG crypto/lock.c:453:6: Taking false branch 451. } 452. #endif 453. if (type < 0) ^ 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:468:7: Taking true branch 466. } 467. else 468. if (locking_callback != NULL) ^ 469. locking_callback(mode,type,file,line); 470. } crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer 467. else 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); ^ 470. } 471. crypto/lock.c:453:2: 451. } 452. #endif 453. > if (type < 0) 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:470:2: return from a call to CRYPTO_lock 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); 470. } ^ 471. 472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/x509/x509_lu.c:311:2: 309. 310. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 311. > tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); 312. CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); 313. crypto/x509/x509_lu.c:492:1: start of procedure X509_OBJECT_retrieve_by_subject() 490. } 491. 492. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, 493. X509_NAME *name) 494. { crypto/x509/x509_lu.c:496:2: 494. { 495. int idx; 496. > idx = X509_OBJECT_idx_by_subject(h, type, name); 497. if (idx==-1) return NULL; 498. return sk_X509_OBJECT_value(h, idx); crypto/x509/x509_lu.c:486:1: start of procedure X509_OBJECT_idx_by_subject() 484. 485. 486. > int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, 487. X509_NAME *name) 488. { crypto/x509/x509_lu.c:489:2: Skipping x509_object_idx_cnt(): empty list of specs 487. X509_NAME *name) 488. { 489. return x509_object_idx_cnt(h, type, name, NULL); ^ 490. } 491. crypto/x509/x509_lu.c:490:2: return from a call to X509_OBJECT_idx_by_subject 488. { 489. return x509_object_idx_cnt(h, type, name, NULL); 490. } ^ 491. 492. X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, crypto/x509/x509_lu.c:497:6: Taking false branch 495. int idx; 496. idx = X509_OBJECT_idx_by_subject(h, type, name); 497. if (idx==-1) return NULL; ^ 498. return sk_X509_OBJECT_value(h, idx); 499. } crypto/x509/x509_lu.c:498:9: Condition is true 496. idx = X509_OBJECT_idx_by_subject(h, type, name); 497. if (idx==-1) return NULL; 498. return sk_X509_OBJECT_value(h, idx); ^ 499. } 500. crypto/x509/x509_lu.c:498:2: 496. idx = X509_OBJECT_idx_by_subject(h, type, name); 497. if (idx==-1) return NULL; 498. > return sk_X509_OBJECT_value(h, idx); 499. } 500. crypto/stack/stack.c:300:1: start of procedure sk_value() 298. } 299. 300. > void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:302:6: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:13: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:24: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:303:2: 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. > return st->data[i]; 304. } 305. crypto/stack/stack.c:304:1: return from a call to sk_value 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. > } 305. 306. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_lu.c:499:2: return from a call to X509_OBJECT_retrieve_by_subject 497. if (idx==-1) return NULL; 498. return sk_X509_OBJECT_value(h, idx); 499. } ^ 500. 501. STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) crypto/x509/x509_lu.c:312:2: 310. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 311. tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); 312. > CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); 313. 314. if (tmp == NULL || type == X509_LU_CRL) crypto/lock.c:426:1: start of procedure CRYPTO_lock() 424. } 425. 426. > void CRYPTO_lock(int mode, int type, const char *file, int line) 427. { 428. #ifdef LOCK_DEBUG crypto/lock.c:453:6: Taking false branch 451. } 452. #endif 453. if (type < 0) ^ 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:468:7: Taking true branch 466. } 467. else 468. if (locking_callback != NULL) ^ 469. locking_callback(mode,type,file,line); 470. } crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer 467. else 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); ^ 470. } 471. crypto/lock.c:453:2: 451. } 452. #endif 453. > if (type < 0) 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:470:2: return from a call to CRYPTO_lock 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); 470. } ^ 471. 472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/x509/x509_lu.c:314:6: Taking false branch 312. CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); 313. 314. if (tmp == NULL || type == X509_LU_CRL) ^ 315. { 316. for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) crypto/x509/x509_lu.c:314:21: Taking true branch 312. CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); 313. 314. if (tmp == NULL || type == X509_LU_CRL) ^ 315. { 316. for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) crypto/x509/x509_lu.c:316:8: 314. if (tmp == NULL || type == X509_LU_CRL) 315. { 316. > for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) 317. { 318. lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); crypto/x509/x509_lu.c:316:32: Condition is true 314. if (tmp == NULL || type == X509_LU_CRL) 315. { 316. for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) ^ 317. { 318. lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); crypto/x509/x509_lu.c:316:30: 314. if (tmp == NULL || type == X509_LU_CRL) 315. { 316. > for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) 317. { 318. lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); crypto/stack/stack.c:294:1: start of procedure sk_num() 292. } 293. 294. > int sk_num(const _STACK *st) 295. { 296. if(st == NULL) return -1; crypto/stack/stack.c:296:5: Taking false branch 294. int sk_num(const _STACK *st) 295. { 296. if(st == NULL) return -1; ^ 297. return st->num; 298. } crypto/stack/stack.c:297:2: 295. { 296. if(st == NULL) return -1; 297. > return st->num; 298. } 299. crypto/stack/stack.c:298:1: return from a call to sk_num 296. if(st == NULL) return -1; 297. return st->num; 298. > } 299. 300. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lu.c:316:30: Loop condition is true. Entering loop body 314. if (tmp == NULL || type == X509_LU_CRL) 315. { 316. for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) ^ 317. { 318. lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); crypto/x509/x509_lu.c:318:7: Condition is true 316. for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) 317. { 318. lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); ^ 319. j=X509_LOOKUP_by_subject(lu,type,name,&stmp); 320. if (j < 0) crypto/x509/x509_lu.c:318:4: 316. for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) 317. { 318. > lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); 319. j=X509_LOOKUP_by_subject(lu,type,name,&stmp); 320. if (j < 0) crypto/stack/stack.c:300:1: start of procedure sk_value() 298. } 299. 300. > void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:302:6: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:13: Taking true branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:39: 300. void *sk_value(const _STACK *st, int i) 301. { 302. > if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. } crypto/stack/stack.c:304:1: return from a call to sk_value 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. > } 305. 306. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_lu.c:319:4: 317. { 318. lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); 319. > j=X509_LOOKUP_by_subject(lu,type,name,&stmp); 320. if (j < 0) 321. { crypto/x509/x509_lu.c:122:1: start of procedure X509_LOOKUP_by_subject() 120. } 121. 122. > int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, 123. X509_OBJECT *ret) 124. { crypto/x509/x509_lu.c:125:7: 123. X509_OBJECT *ret) 124. { 125. > if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL)) 126. return X509_LU_FAIL; 127. if (ctx->skip) return 0;
https://github.com/openssl/openssl/blob/ec4a50b3c3f2f50caccfd52e939857a5d6f02fd1/crypto/x509/x509_lu.c/#L319
d2a_code_trace_data_45521
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bntest.c:981: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont_consttime`. Showing all 27 steps of the trace crypto/bn/bntest.c:964:1: Parameter `ctx->stack.depth` 962. } 963. 964. > int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx) 965. { 966. BIGNUM *a,*b,*c,*d,*e; crypto/bn/bntest.c:981:8: Call 979. BN_bntest_rand(b,2+i,0,0); /**/ 980. 981. if (!BN_mod_exp_mont_consttime(d,a,b,c,ctx,NULL)) ^ 982. return(00); 983. crypto/bn/bn_exp.c:578:1: Parameter `ctx->stack.depth` 576. * http://www.daemonology.net/hyperthreading-considered-harmful/) 577. */ 578. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 579. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 580. { crypto/bn/bn_exp.c:609:2: Call 607. } 608. 609. BN_CTX_start(ctx); ^ 610. 611. /* Allocate a montgomery context if it was not supplied by the caller. crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:619:8: Call 617. { 618. if ((mont=BN_MONT_CTX_new()) == NULL) goto err; 619. if (!BN_MONT_CTX_set(mont,m,ctx)) goto err; ^ 620. } 621. crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth` 353. } 354. 355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 356. { 357. int ret = 0; crypto/bn/bn_mont.c:360:2: Call 358. BIGNUM *Ri,*R; 359. 360. BN_CTX_start(ctx); ^ 361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err; 362. R= &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont_consttime` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_45522
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)OPENSSL_realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/ssl_lib.c:2378: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 16 steps of the trace ssl/ssl_lib.c:2261:11: Call 2259. int i; 2260. 2261. if ((ret=SSL_new(SSL_get_SSL_CTX(s))) == NULL) ^ 2262. return(NULL); 2263. ssl/ssl_lib.c:264:1: Parameter `ctx->sessions->p` 262. } 263. 264. > SSL *SSL_new(SSL_CTX *ctx) 265. { 266. SSL *s; ssl/ssl_lib.c:2378:20: Call 2376. { 2377. err: 2378. if (ret != NULL) SSL_free(ret); ^ 2379. ret=NULL; 2380. } ssl/ssl_lib.c:472:1: Parameter `s->ctx->sessions->p` 470. } 471. 472. > void SSL_free(SSL *s) 473. { 474. int i; ssl/ssl_lib.c:521:3: Call 519. if (s->session != NULL) 520. { 521. ssl_clear_bad_session(s); ^ 522. SSL_SESSION_free(s->session); 523. } ssl/ssl_sess.c:843:1: Parameter `s->ctx->sessions->p` 841. } 842. 843. > int ssl_clear_bad_session(SSL *s) 844. { 845. if ( (s->session != NULL) && ssl/ssl_sess.c:849:3: Call 847. !(SSL_in_init(s) || SSL_in_before(s))) 848. { 849. SSL_CTX_remove_session(s->ctx,s->session); ^ 850. return(1); 851. } ssl/ssl_sess.c:614:1: Parameter `ctx->sessions->p` 612. } 613. 614. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:616:9: Call 614. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ^ 617. } 618. ssl/ssl_sess.c:619:1: Parameter `ctx->sessions->pmax` 617. } 618. 619. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 620. { 621. SSL_SESSION *r; ssl/ssl_sess.c:630:21: Call 628. { 629. ret=1; 630. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 631. SSL_SESSION_list_remove(ctx,c); 632. } crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:364:1: <LHS trace> 362. } 363. 364. > static void contract(LHASH *lh) 365. { 366. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:364:1: Parameter `lh->p` 362. } 363. 364. > static void contract(LHASH *lh) 365. { 366. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:368:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 366. LHASH_NODE **n,*n1,*np; 367. 368. np=lh->b[lh->p+lh->pmax-1]; ^ 369. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 370. if (lh->p == 0)
https://github.com/openssl/openssl/blob/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/crypto/lhash/lhash.c/#L368
d2a_code_trace_data_45523
static void encode_frame(MpegAudioContext *s, unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], int padding) { int i, j, k, l, bit_alloc_bits, b, ch; unsigned char *sf; int q[3]; PutBitContext *p = &s->pb; put_bits(p, 12, 0xfff); put_bits(p, 1, 1 - s->lsf); put_bits(p, 2, 4-2); put_bits(p, 1, 1); put_bits(p, 4, s->bitrate_index); put_bits(p, 2, s->freq_index); put_bits(p, 1, s->do_padding); put_bits(p, 1, 0); put_bits(p, 2, s->nb_channels == 2 ? MPA_STEREO : MPA_MONO); put_bits(p, 2, 0); put_bits(p, 1, 0); put_bits(p, 1, 1); put_bits(p, 2, 0); j = 0; for(i=0;i<s->sblimit;i++) { bit_alloc_bits = s->alloc_table[j]; for(ch=0;ch<s->nb_channels;ch++) { put_bits(p, bit_alloc_bits, bit_alloc[ch][i]); } j += 1 << bit_alloc_bits; } for(i=0;i<s->sblimit;i++) { for(ch=0;ch<s->nb_channels;ch++) { if (bit_alloc[ch][i]) put_bits(p, 2, s->scale_code[ch][i]); } } for(i=0;i<s->sblimit;i++) { for(ch=0;ch<s->nb_channels;ch++) { if (bit_alloc[ch][i]) { sf = &s->scale_factors[ch][i][0]; switch(s->scale_code[ch][i]) { case 0: put_bits(p, 6, sf[0]); put_bits(p, 6, sf[1]); put_bits(p, 6, sf[2]); break; case 3: case 1: put_bits(p, 6, sf[0]); put_bits(p, 6, sf[2]); break; case 2: put_bits(p, 6, sf[0]); break; } } } } for(k=0;k<3;k++) { for(l=0;l<12;l+=3) { j = 0; for(i=0;i<s->sblimit;i++) { bit_alloc_bits = s->alloc_table[j]; for(ch=0;ch<s->nb_channels;ch++) { b = bit_alloc[ch][i]; if (b) { int qindex, steps, m, sample, bits; qindex = s->alloc_table[j+b]; steps = ff_mpa_quant_steps[qindex]; for(m=0;m<3;m++) { sample = s->sb_samples[ch][k][l + m][i]; #ifdef USE_FLOATS { float a; a = (float)sample * scale_factor_inv_table[s->scale_factors[ch][i][k]]; q[m] = (int)((a + 1.0) * steps * 0.5); } #else { int q1, e, shift, mult; e = s->scale_factors[ch][i][k]; shift = scale_factor_shift[e]; mult = scale_factor_mult[e]; if (shift < 0) q1 = sample << (-shift); else q1 = sample >> shift; q1 = (q1 * mult) >> P; q[m] = ((q1 + (1 << P)) * steps) >> (P + 1); } #endif if (q[m] >= steps) q[m] = steps - 1; assert(q[m] >= 0 && q[m] < steps); } bits = ff_mpa_quant_bits[qindex]; if (bits < 0) { put_bits(p, -bits, q[0] + steps * (q[1] + steps * q[2])); #if 0 printf("%d: gr1 %d\n", i, q[0] + steps * (q[1] + steps * q[2])); #endif } else { #if 0 printf("%d: gr3 %d %d %d\n", i, q[0], q[1], q[2]); #endif put_bits(p, bits, q[0]); put_bits(p, bits, q[1]); put_bits(p, bits, q[2]); } } } j += 1 << bit_alloc_bits; } } } for(i=0;i<padding;i++) put_bits(p, 1, 0); flush_put_bits(p); } libavcodec/mpegaudioenc.c:692: error: Buffer Overrun L2 Offset: [0, 13] Size: 12. libavcodec/mpegaudioenc.c:680:13: <Offset trace> 678. 679. for(k=0;k<3;k++) { 680. for(l=0;l<12;l+=3) { ^ 681. j = 0; 682. for(i=0;i<s->sblimit;i++) { libavcodec/mpegaudioenc.c:680:13: Assignment 678. 679. for(k=0;k<3;k++) { 680. for(l=0;l<12;l+=3) { ^ 681. j = 0; 682. for(i=0;i<s->sblimit;i++) { libavcodec/mpegaudioenc.c:610:1: <Length trace> 608. * compared to other encoders :-) 609. */ 610. static void encode_frame(MpegAudioContext *s, ^ 611. unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], 612. int padding) libavcodec/mpegaudioenc.c:610:1: Parameter `s->sb_samples[*][*][*]` 608. * compared to other encoders :-) 609. */ 610. static void encode_frame(MpegAudioContext *s, ^ 611. unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], 612. int padding) libavcodec/mpegaudioenc.c:692:38: Array access: Offset: [0, 13] Size: 12 690. steps = ff_mpa_quant_steps[qindex]; 691. for(m=0;m<3;m++) { 692. sample = s->sb_samples[ch][k][l + m][i]; ^ 693. /* divide by scale factor */ 694. #ifdef USE_FLOATS
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudioenc.c/#L692
d2a_code_trace_data_45524
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:4152: error: Null Dereference pointer `f` last assigned on line 4147 could be null and is dereferenced by call to `feof()` at line 4152, column 12. ffmpeg.c:4139:1: start of procedure opt_preset() 4137. } 4138. 4139. static int opt_preset(const char *opt, const char *arg) ^ 4140. { 4141. FILE *f=NULL; ffmpeg.c:4141:5: 4139. static int opt_preset(const char *opt, const char *arg) 4140. { 4141. FILE *f=NULL; ^ 4142. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4143. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4143:24: Condition is false 4141. FILE *f=NULL; 4142. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4143. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4144. *opt == 'a' ? audio_codec_name : 4145. subtitle_codec_name; ffmpeg.c:4144:24: Condition is false 4142. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4143. char *codec_name = *opt == 'v' ? video_codec_name : 4144. *opt == 'a' ? audio_codec_name : ^ 4145. subtitle_codec_name; 4146. ffmpeg.c:4143:24: 4141. FILE *f=NULL; 4142. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4143. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4144. *opt == 'a' ? audio_codec_name : 4145. subtitle_codec_name; ffmpeg.c:4143:5: 4141. FILE *f=NULL; 4142. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4143. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4144. *opt == 'a' ? audio_codec_name : 4145. subtitle_codec_name; ffmpeg.c:4147:64: Condition is false 4145. subtitle_codec_name; 4146. 4147. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4148. fprintf(stderr, "File for preset '%s' not found\n", arg); 4149. ffmpeg_exit(1); ffmpeg.c:4147:11: Taking true branch 4145. subtitle_codec_name; 4146. 4147. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4148. fprintf(stderr, "File for preset '%s' not found\n", arg); 4149. ffmpeg_exit(1); ffmpeg.c:4148:9: 4146. 4147. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4148. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4149. ffmpeg_exit(1); 4150. } ffmpeg.c:4149:9: Skipping ffmpeg_exit(): empty list of specs 4147. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4148. fprintf(stderr, "File for preset '%s' not found\n", arg); 4149. ffmpeg_exit(1); ^ 4150. } 4151. ffmpeg.c:4152:12: 4150. } 4151. 4152. while(!feof(f)){ ^ 4153. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4154. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/ffmpeg.c/#L4152
d2a_code_trace_data_45525
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; } } } ssl/ssl_lib.c:2424: error: INTEGER_OVERFLOW_L2 ([0, 1+max(0, `s->initial_ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_flush_sessions`. Showing all 9 steps of the trace ssl/ssl_lib.c:2397:1: Parameter `s->initial_ctx->sessions->num_nodes` 2395. } 2396. 2397. > void ssl_update_cache(SSL *s,int mode) 2398. { 2399. int i; ssl/ssl_lib.c:2424:4: Call 2422. :s->session_ctx->stats.sess_accept_good) & 0xff) == 0xff) 2423. { 2424. SSL_CTX_flush_sessions(s->session_ctx,(unsigned long)time(NULL)); ^ 2425. } 2426. } ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes` 983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM) 984. 985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 986. { 987. unsigned long i; ssl/ssl_sess.c:997:2: Call 995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; 996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0; 997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), ^ 998. TIMEOUT_PARAM, &tp); 999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i; crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes` 303. } 304. 305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); crypto/lhash/lhash.c:307:2: Call 305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); ^ 308. } 309. crypto/lhash/lhash.c:270:1: <LHS trace> 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes` 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:281:7: Binary operation: ([0, 1+max(0, s->initial_ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_flush_sessions` 279. /* reverse the order so we search from 'top to bottom' 280. * We were having memory leaks otherwise */ 281. for (i=lh->num_nodes-1; i>=0; i--) ^ 282. { 283. a=lh->b[i];
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281
d2a_code_trace_data_45526
static int flic_decode_frame_8BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int stream_ptr_after_color_chunk; int pixel_ptr; int palette_ptr; unsigned char palette_idx1; unsigned char palette_idx2; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int color_packets; int color_changes; int color_shift; unsigned char r, g, b; int lines; int compressed_lines; int starting_line; signed short line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; frame_size = bytestream2_get_le32(&g2); bytestream2_skip(&g2, 2); num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); frame_size -= 16; while ((frame_size > 0) && (num_chunks > 0)) { chunk_size = bytestream2_get_le32(&g2); chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: stream_ptr_after_color_chunk = bytestream2_tell(&g2) + chunk_size - 6; if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE)) color_shift = 0; else color_shift = 2; color_packets = bytestream2_get_le16(&g2); palette_ptr = 0; for (i = 0; i < color_packets; i++) { palette_ptr += bytestream2_get_byte(&g2); color_changes = bytestream2_get_byte(&g2); if (color_changes == 0) color_changes = 256; for (j = 0; j < color_changes; j++) { unsigned int entry; if ((unsigned)palette_ptr >= 256) palette_ptr = 0; r = bytestream2_get_byte(&g2) << color_shift; g = bytestream2_get_byte(&g2) << color_shift; b = bytestream2_get_byte(&g2) << color_shift; entry = (r << 16) | (g << 8) | b; if (s->palette[palette_ptr] != entry) s->new_palette = 1; s->palette[palette_ptr++] = entry; } } if (stream_ptr_after_color_chunk - bytestream2_tell(&g2) > 0) bytestream2_skip(&g2, stream_ptr_after_color_chunk - bytestream2_tell(&g2)); break; case FLI_DELTA: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { line_packets = bytestream2_get_le16(&g2); if ((line_packets & 0xC000) == 0xC000) { line_packets = -line_packets; y_ptr += line_packets * s->frame->linesize[0]; } else if ((line_packets & 0xC000) == 0x4000) { av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets); } else if ((line_packets & 0xC000) == 0x8000) { pixel_ptr= y_ptr + s->frame->linesize[0] - 1; CHECK_PIXEL_PTR(0); pixels[pixel_ptr] = line_packets & 0xff; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); palette_idx2 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run * 2); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { pixels[pixel_ptr++] = palette_idx1; pixels[pixel_ptr++] = palette_idx2; } } else { CHECK_PIXEL_PTR(byte_run * 2); for (j = 0; j < byte_run * 2; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: starting_line = bytestream2_get_le16(&g2); y_ptr = 0; y_ptr += starting_line * s->frame->linesize[0]; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; line_packets = bytestream2_get_byte(&g2); if (line_packets > 0) { for (i = 0; i < line_packets; i++) { pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2),8); if (byte_run > 0) { CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } else if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = palette_idx1; } } } } y_ptr += s->frame->linesize[0]; compressed_lines--; } break; case FLI_BLACK: memset(pixels, 0, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (!byte_run) { av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n"); return AVERROR_INVALIDDATA; } if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } else { byte_run = -byte_run; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: if (chunk_size - 6 > s->avctx->width * s->avctx->height) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { bytestream2_get_buffer(&g2, &pixels[y_ptr], s->avctx->width); } } break; case FLI_MINI: bytestream2_skip(&g2, chunk_size - 6); break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } frame_size -= chunk_size; num_chunks--; } if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1)) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, buf_size - bytestream2_get_bytes_left(&g2)); memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE); if (s->new_palette) { s->frame->palette_has_changed = 1; s->new_palette = 0; } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; } libavcodec/flicvideo.c:388: error: Integer Overflow L2 ([min(0, `buf->l`), max(0, `buf->l`)] - 6):unsigned32. libavcodec/flicvideo.c:135:1: <LHS trace> 133. } 134. 135. static int flic_decode_frame_8BPP(AVCodecContext *avctx, ^ 136. void *data, int *got_frame, 137. const uint8_t *buf, int buf_size) libavcodec/flicvideo.c:135:1: Parameter `*buf` 133. } 134. 135. static int flic_decode_frame_8BPP(AVCodecContext *avctx, ^ 136. void *data, int *got_frame, 137. const uint8_t *buf, int buf_size) libavcodec/flicvideo.c:394:21: Call 392. for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; 393. y_ptr += s->frame->linesize[0]) { 394. bytestream2_get_buffer(&g2, &pixels[y_ptr], ^ 395. s->avctx->width); 396. } libavcodec/bytestream.h:260:1: Parameter `*g->buffer` 258. } 259. 260. static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, ^ 261. uint8_t *dst, 262. unsigned int size) libavcodec/flicvideo.c:388:17: Binary operation: ([min(0, buf->l), max(0, buf->l)] - 6):unsigned32 386. /* copy the chunk (uncompressed frame) */ 387. if (chunk_size - 6 > s->avctx->width * s->avctx->height) { 388. av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ ^ 389. "bigger than image, skipping chunk\n", chunk_size - 6); 390. bytestream2_skip(&g2, chunk_size - 6);
https://github.com/libav/libav/blob/004ea63714e31ed43326ad00d7420d104f0dab38/libavcodec/flicvideo.c/#L388
d2a_code_trace_data_45527
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); ffmpeg_exit(1); } *mid++= 0; av_metadata_set2(&metadata, arg, mid, 0); return 0; } ffmpeg.c:2818: error: Null Dereference pointer `mid` last assigned on line 2818 could be null and is dereferenced at line 2818, column 5. ffmpeg.c:2810:1: start of procedure opt_metadata() 2808. } 2809. 2810. static int opt_metadata(const char *opt, const char *arg) ^ 2811. { 2812. char *mid= strchr(arg, '='); ffmpeg.c:2812:5: 2810. static int opt_metadata(const char *opt, const char *arg) 2811. { 2812. char *mid= strchr(arg, '='); ^ 2813. 2814. if(!mid){ ffmpeg.c:2814:9: Taking true branch 2812. char *mid= strchr(arg, '='); 2813. 2814. if(!mid){ ^ 2815. fprintf(stderr, "Missing =\n"); 2816. ffmpeg_exit(1); ffmpeg.c:2815:9: 2813. 2814. if(!mid){ 2815. fprintf(stderr, "Missing =\n"); ^ 2816. ffmpeg_exit(1); 2817. } ffmpeg.c:2816:9: Skipping ffmpeg_exit(): empty list of specs 2814. if(!mid){ 2815. fprintf(stderr, "Missing =\n"); 2816. ffmpeg_exit(1); ^ 2817. } 2818. *mid++= 0; ffmpeg.c:2818:5: 2816. ffmpeg_exit(1); 2817. } 2818. *mid++= 0; ^ 2819. 2820. av_metadata_set2(&metadata, arg, mid, 0);
https://github.com/libav/libav/blob/771339ca206468636a64a6041852068be2da3dd2/ffmpeg.c/#L2818
d2a_code_trace_data_45528
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1055: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont_consttime`. Showing all 31 steps of the trace test/bntest.c:1034:1: Parameter `ctx->stack.depth` 1032. } 1033. 1034. > int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx) 1035. { 1036. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:1048:9: Call 1046. BN_one(b); 1047. BN_zero(c); 1048. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { ^ 1049. fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus " 1050. "succeeded\n"); crypto/bn/bn_exp.c:644:1: Parameter `ctx->stack.depth` 642. * http://www.daemong-consideredperthreading-considered-harmful/) 643. */ 644. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 645. const BIGNUM *m, BN_CTX *ctx, 646. BN_MONT_CTX *in_mont) test/bntest.c:1055:9: Call 1053. 1054. BN_set_word(c, 16); 1055. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { ^ 1056. fprintf(stderr, "BN_mod_exp_mont_consttime with even modulus " 1057. "succeeded\n"); crypto/bn/bn_exp.c:644:1: Parameter `ctx->stack.depth` 642. * http://www.daemong-consideredperthreading-considered-harmful/) 643. */ 644. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 645. const BIGNUM *m, BN_CTX *ctx, 646. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:678:5: Call 676. } 677. 678. BN_CTX_start(ctx); ^ 679. 680. /* crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:689:14: Call 687. if ((mont = BN_MONT_CTX_new()) == NULL) 688. goto err; 689. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 690. goto err; 691. } crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:428:14: Call 426. tmod.top = buf[0] != 0 ? 1 : 0; 427. /* Ri = R^-1 mod N */ 428. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 429. goto err; 430. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont_consttime` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_45529
SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section) { STACK_OF(CONF_VALUE) *sk_conf = NULL; SSL_TEST_CTX *ctx = NULL; int i; size_t j; if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section)) || !TEST_ptr(ctx = SSL_TEST_CTX_new())) goto err; for (i = 0; i < sk_CONF_VALUE_num(sk_conf); i++) { int found = 0; const CONF_VALUE *option = sk_CONF_VALUE_value(sk_conf, i); if (strcmp(option->name, "client") == 0) { if (!parse_client_options(&ctx->extra.client, conf, option->value)) goto err; } else if (strcmp(option->name, "server") == 0) { if (!TEST_true(parse_server_options(&ctx->extra.server, conf, option->value))) goto err; } else if (strcmp(option->name, "server2") == 0) { if (!TEST_true(parse_server_options(&ctx->extra.server2, conf, option->value))) goto err; } else if (strcmp(option->name, "resume-client") == 0) { if (!TEST_true(parse_client_options(&ctx->resume_extra.client, conf, option->value))) goto err; } else if (strcmp(option->name, "resume-server") == 0) { if (!TEST_true(parse_server_options(&ctx->resume_extra.server, conf, option->value))) goto err; } else if (strcmp(option->name, "resume-server2") == 0) { if (!parse_server_options(&ctx->resume_extra.server2, conf, option->value)) goto err; } else { for (j = 0; j < OSSL_NELEM(ssl_test_ctx_options); j++) { if (strcmp(option->name, ssl_test_ctx_options[j].name) == 0) { if (!ssl_test_ctx_options[j].parse(ctx, option->value)) { TEST_info("Bad value %s for option %s", option->value, option->name); goto err; } found = 1; break; } } if (!found) { TEST_info("Unknown test option: %s", option->name); goto err; } } } goto done; err: SSL_TEST_CTX_free(ctx); ctx = NULL; done: return ctx; } test/ssl_test_ctx.c:805: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 745 could be null and is dereferenced by call to `SSL_TEST_CTX_free()` at line 805, column 5. Showing all 50 steps of the trace test/ssl_test_ctx.c:742:1: start of procedure SSL_TEST_CTX_create() 740. } 741. 742. > SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section) 743. { 744. STACK_OF(CONF_VALUE) *sk_conf = NULL; test/ssl_test_ctx.c:744:5: 742. SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section) 743. { 744. > STACK_OF(CONF_VALUE) *sk_conf = NULL; 745. SSL_TEST_CTX *ctx = NULL; 746. int i; test/ssl_test_ctx.c:745:5: 743. { 744. STACK_OF(CONF_VALUE) *sk_conf = NULL; 745. > SSL_TEST_CTX *ctx = NULL; 746. int i; 747. size_t j; test/ssl_test_ctx.c:749:10: 747. size_t j; 748. 749. > if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section)) 750. || !TEST_ptr(ctx = SSL_TEST_CTX_new())) 751. goto err; crypto/conf/conf_lib.c:244:1: start of procedure NCONF_get_section() 242. } 243. 244. > STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) 245. { 246. if (conf == NULL) { crypto/conf/conf_lib.c:246:9: Taking false branch 244. STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) 245. { 246. if (conf == NULL) { ^ 247. CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_CONF); 248. return NULL; crypto/conf/conf_lib.c:251:9: Taking false branch 249. } 250. 251. if (section == NULL) { ^ 252. CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_SECTION); 253. return NULL; crypto/conf/conf_lib.c:256:5: 254. } 255. 256. > return _CONF_get_section_values(conf, section); 257. } 258. crypto/conf/conf_api.c:35:1: start of procedure _CONF_get_section_values() 33. 34. /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 35. > STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 36. const char *section) 37. { crypto/conf/conf_api.c:40:5: 38. CONF_VALUE *v; 39. 40. > v = _CONF_get_section(conf, section); 41. if (v != NULL) 42. return ((STACK_OF(CONF_VALUE) *)v->value); crypto/conf/conf_api.c:22:1: start of procedure _CONF_get_section() 20. 21. /* Up until OpenSSL 0.9.5a, this was get_section */ 22. > CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) 23. { 24. CONF_VALUE *v, vv; crypto/conf/conf_api.c:26:10: Taking false branch 24. CONF_VALUE *v, vv; 25. 26. if ((conf == NULL) || (section == NULL)) ^ 27. return (NULL); 28. vv.name = NULL; crypto/conf/conf_api.c:26:28: Taking false branch 24. CONF_VALUE *v, vv; 25. 26. if ((conf == NULL) || (section == NULL)) ^ 27. return (NULL); 28. vv.name = NULL; crypto/conf/conf_api.c:28:5: 26. if ((conf == NULL) || (section == NULL)) 27. return (NULL); 28. > vv.name = NULL; 29. vv.section = (char *)section; 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); crypto/conf/conf_api.c:29:5: 27. return (NULL); 28. vv.name = NULL; 29. > vv.section = (char *)section; 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. return (v); crypto/conf/conf_api.c:30:5: 28. vv.name = NULL; 29. vv.section = (char *)section; 30. > v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. return (v); 32. } include/openssl/conf.h:32:1: start of procedure lh_CONF_VALUE_retrieve() 30. 31. DEFINE_STACK_OF(CONF_VALUE) 32. > DEFINE_LHASH_OF(CONF_VALUE); 33. 34. struct conf_st; crypto/lhash/lhash.c:134:1: start of procedure OPENSSL_LH_retrieve() 132. } 133. 134. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data) 135. { 136. unsigned long hash; crypto/lhash/lhash.c:141:5: 139. int scratch; 140. 141. > lh->error = 0; 142. rn = getrn(lh, data, &hash); 143. crypto/lhash/lhash.c:142:5: Skipping getrn(): empty list of specs 140. 141. lh->error = 0; 142. rn = getrn(lh, data, &hash); ^ 143. 144. if (*rn == NULL) { crypto/lhash/lhash.c:144:9: Taking false branch 142. rn = getrn(lh, data, &hash); 143. 144. if (*rn == NULL) { ^ 145. CRYPTO_atomic_add(&lh->num_retrieve_miss, 1, &scratch, lh->retrieve_stats_lock); 146. return NULL; crypto/lhash/lhash.c:148:9: 146. return NULL; 147. } else { 148. > ret = (*rn)->data; 149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } crypto/lhash/lhash.c:149:9: 147. } else { 148. ret = (*rn)->data; 149. > CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } 151. return ret; crypto/threads_pthread.c:152:1: start of procedure CRYPTO_atomic_add() 150. } 151. 152. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) 153. { 154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) crypto/threads_pthread.c:155:9: Taking false branch 153. { 154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) 155. if (__atomic_is_lock_free(sizeof(*val), val)) { ^ 156. *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL); 157. return 1; crypto/threads_pthread.c:160:10: 158. } 159. # endif 160. > if (!CRYPTO_THREAD_write_lock(lock)) 161. return 0; 162. crypto/threads_pthread.c:64:1: start of procedure CRYPTO_THREAD_write_lock() 62. } 63. 64. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock) 65. { 66. # ifdef USE_RWLOCK crypto/threads_pthread.c:67:9: Taking true branch 65. { 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) ^ 68. return 0; 69. # else crypto/threads_pthread.c:68:9: 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) 68. > return 0; 69. # else 70. if (pthread_mutex_lock(lock) != 0) crypto/threads_pthread.c:75:1: return from a call to CRYPTO_THREAD_write_lock 73. 74. return 1; 75. > } 76. 77. int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock) crypto/threads_pthread.c:160:10: Taking true branch 158. } 159. # endif 160. if (!CRYPTO_THREAD_write_lock(lock)) ^ 161. return 0; 162. crypto/threads_pthread.c:161:9: 159. # endif 160. if (!CRYPTO_THREAD_write_lock(lock)) 161. > return 0; 162. 163. *val += amount; crypto/threads_pthread.c:170:1: return from a call to CRYPTO_atomic_add 168. 169. return 1; 170. > } 171. 172. # ifdef OPENSSL_SYS_UNIX crypto/lhash/lhash.c:151:5: 149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } 151. > return ret; 152. } 153. crypto/lhash/lhash.c:152:1: return from a call to OPENSSL_LH_retrieve 150. } 151. return ret; 152. > } 153. 154. static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, include/openssl/conf.h:32:1: return from a call to lh_CONF_VALUE_retrieve 30. 31. DEFINE_STACK_OF(CONF_VALUE) 32. > DEFINE_LHASH_OF(CONF_VALUE); 33. 34. struct conf_st; crypto/conf/conf_api.c:31:5: 29. vv.section = (char *)section; 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. > return (v); 32. } 33. crypto/conf/conf_api.c:32:1: return from a call to _CONF_get_section 30. v = lh_CONF_VALUE_retrieve(conf->data, &vv); 31. return (v); 32. > } 33. 34. /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ crypto/conf/conf_api.c:41:9: Taking true branch 39. 40. v = _CONF_get_section(conf, section); 41. if (v != NULL) ^ 42. return ((STACK_OF(CONF_VALUE) *)v->value); 43. else crypto/conf/conf_api.c:42:9: 40. v = _CONF_get_section(conf, section); 41. if (v != NULL) 42. > return ((STACK_OF(CONF_VALUE) *)v->value); 43. else 44. return (NULL); crypto/conf/conf_api.c:45:1: return from a call to _CONF_get_section_values 43. else 44. return (NULL); 45. > } 46. 47. int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) crypto/conf/conf_lib.c:257:1: return from a call to NCONF_get_section 255. 256. return _CONF_get_section_values(conf, section); 257. > } 258. 259. char *NCONF_get_string(const CONF *conf, const char *group, const char *name) test/testutil/tests.c:227:1: start of procedure test_ptr() 225. } 226. 227. > int test_ptr(const char *file, int line, const char *s, const void *p) 228. { 229. if (p != NULL) test/testutil/tests.c:229:9: Taking false branch 227. int test_ptr(const char *file, int line, const char *s, const void *p) 228. { 229. if (p != NULL) ^ 230. return 1; 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); test/testutil/tests.c:231:5: Skipping test_fail_message(): empty list of specs 229. if (p != NULL) 230. return 1; 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); ^ 232. return 0; 233. } test/testutil/tests.c:232:5: 230. return 1; 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 232. > return 0; 233. } 234. test/testutil/tests.c:233:1: return from a call to test_ptr 231. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 232. return 0; 233. > } 234. 235. int test_true(const char *file, int line, const char *s, int b) test/ssl_test_ctx.c:749:10: Taking true branch 747. size_t j; 748. 749. if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section)) ^ 750. || !TEST_ptr(ctx = SSL_TEST_CTX_new())) 751. goto err; test/ssl_test_ctx.c:804:2: 802. goto done; 803. 804. > err: 805. SSL_TEST_CTX_free(ctx); 806. ctx = NULL; test/ssl_test_ctx.c:805:5: 803. 804. err: 805. > SSL_TEST_CTX_free(ctx); 806. ctx = NULL; 807. done:
https://github.com/openssl/openssl/blob/b842fcbb37cf3cded72dd7706abd8d54a10cd508/test/ssl_test_ctx.c/#L805
d2a_code_trace_data_45530
static int cb_server_alpn(SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { unsigned char *protos; size_t protos_len; char* alpn_str = arg; protos = next_protos_parse(&protos_len, alpn_str); if (protos == NULL) { fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", alpn_str); abort(); } if (SSL_select_next_proto ((unsigned char **)out, outlen, protos, protos_len, in, inlen) != OPENSSL_NPN_NEGOTIATED) { OPENSSL_free(protos); return SSL_TLSEXT_ERR_NOACK; } alpn_selected = OPENSSL_malloc(*outlen); memcpy(alpn_selected, *out, *outlen); *out = alpn_selected; OPENSSL_free(protos); return SSL_TLSEXT_ERR_OK; } test/ssltest_old.c:393: error: NULL_DEREFERENCE pointer `alpn_selected` last assigned on line 392 could be null and is dereferenced by call to `memcpy()` at line 393, column 5. Showing all 18 steps of the trace test/ssltest_old.c:366:1: start of procedure cb_server_alpn() 364. } 365. 366. > static int cb_server_alpn(SSL *s, const unsigned char **out, 367. unsigned char *outlen, const unsigned char *in, 368. unsigned int inlen, void *arg) test/ssltest_old.c:372:5: 370. unsigned char *protos; 371. size_t protos_len; 372. > char* alpn_str = arg; 373. 374. protos = next_protos_parse(&protos_len, alpn_str); test/ssltest_old.c:374:5: Skipping next_protos_parse(): empty list of specs 372. char* alpn_str = arg; 373. 374. protos = next_protos_parse(&protos_len, alpn_str); ^ 375. if (protos == NULL) { 376. fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", test/ssltest_old.c:375:9: Taking false branch 373. 374. protos = next_protos_parse(&protos_len, alpn_str); 375. if (protos == NULL) { ^ 376. fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", 377. alpn_str); test/ssltest_old.c:381:9: Taking false branch 379. } 380. 381. if (SSL_select_next_proto ^ 382. ((unsigned char **)out, outlen, protos, protos_len, in, 383. inlen) != OPENSSL_NPN_NEGOTIATED) { test/ssltest_old.c:392:5: 390. * verify_alpn. 391. */ 392. > alpn_selected = OPENSSL_malloc(*outlen); 393. memcpy(alpn_selected, *out, *outlen); 394. *out = alpn_selected; crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking true branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:75:32: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) test/ssltest_old.c:393:5: 391. */ 392. alpn_selected = OPENSSL_malloc(*outlen); 393. > memcpy(alpn_selected, *out, *outlen); 394. *out = alpn_selected; 395.
https://github.com/openssl/openssl/blob/f7a39a5a3f7f91e0d1ba0030323eef26bc8ccddf/test/ssltest_old.c/#L393
d2a_code_trace_data_45531
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, CERT *c) { uint32_t alg_mkey, alg_auth, alg_enc, alg_mac, algo_strength; int min_tls; const char *l, *buf; int j, multi, found, rule, retval, ok, buflen; uint32_t cipher_id = 0; char ch; retval = 1; l = rule_str; for (;;) { ch = *l; if (ch == '\0') break; if (ch == '-') { rule = CIPHER_DEL; l++; } else if (ch == '+') { rule = CIPHER_ORD; l++; } else if (ch == '!') { rule = CIPHER_KILL; l++; } else if (ch == '@') { rule = CIPHER_SPECIAL; l++; } else { rule = CIPHER_ADD; } if (ITEM_SEP(ch)) { l++; continue; } alg_mkey = 0; alg_auth = 0; alg_enc = 0; alg_mac = 0; min_tls = 0; algo_strength = 0; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while (((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.') || (ch == '=')) #else while (isalnum(ch) || (ch == '-') || (ch == '.') || (ch == '=')) #endif { ch = *(++l); buflen++; } if (buflen == 0) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); retval = found = 0; l++; break; } if (rule == CIPHER_SPECIAL) { found = 0; break; } if (ch == '+') { multi = 1; l++; } else multi = 0; j = found = 0; cipher_id = 0; while (ca_list[j]) { if (strncmp(buf, ca_list[j]->name, buflen) == 0 && (ca_list[j]->name[buflen] == '\0')) { found = 1; break; } else j++; } if (!found) break; if (ca_list[j]->algorithm_mkey) { if (alg_mkey) { alg_mkey &= ca_list[j]->algorithm_mkey; if (!alg_mkey) { found = 0; break; } } else alg_mkey = ca_list[j]->algorithm_mkey; } if (ca_list[j]->algorithm_auth) { if (alg_auth) { alg_auth &= ca_list[j]->algorithm_auth; if (!alg_auth) { found = 0; break; } } else alg_auth = ca_list[j]->algorithm_auth; } if (ca_list[j]->algorithm_enc) { if (alg_enc) { alg_enc &= ca_list[j]->algorithm_enc; if (!alg_enc) { found = 0; break; } } else alg_enc = ca_list[j]->algorithm_enc; } if (ca_list[j]->algorithm_mac) { if (alg_mac) { alg_mac &= ca_list[j]->algorithm_mac; if (!alg_mac) { found = 0; break; } } else alg_mac = ca_list[j]->algorithm_mac; } if (ca_list[j]->algo_strength & SSL_STRONG_MASK) { if (algo_strength & SSL_STRONG_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~SSL_STRONG_MASK; if (!(algo_strength & SSL_STRONG_MASK)) { found = 0; break; } } else algo_strength = ca_list[j]->algo_strength & SSL_STRONG_MASK; } if (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) { if (algo_strength & SSL_DEFAULT_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) | ~SSL_DEFAULT_MASK; if (!(algo_strength & SSL_DEFAULT_MASK)) { found = 0; break; } } else algo_strength |= ca_list[j]->algo_strength & SSL_DEFAULT_MASK; } if (ca_list[j]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->min_tls) { if (min_tls != 0 && min_tls != ca_list[j]->min_tls) { found = 0; break; } else { min_tls = ca_list[j]->min_tls; } } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && strncmp(buf, "STRENGTH", 8) == 0) ok = ssl_cipher_strength_sort(head_p, tail_p); else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { int level = buf[9] - '0'; if (level < 0 || level > 5) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } else { c->sec_level = level; ok = 1; } } else SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); if (ok == 0) retval = 0; while ((*l != '\0') && !ITEM_SEP(*l)) l++; } else if (found) { ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return (retval); } test/sslapitest.c:305: 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:305:10: Call 303. 304. /* We also want to ensure that we use RSA-based key exchange. */ 305. rc = SSL_CTX_set_cipher_list(cctx, "RSA"); ^ 306. if (rc == 0) { 307. printf("Unable to restrict to RSA key exchange.\n"); ssl/ssl_lib.c:2098:1: Parameter `*str` 2096. 2097. /** specify the ciphers to be used by default by the SSL_CTX */ 2098. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2099. { 2100. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2102:10: Call 2100. STACK_OF(SSL_CIPHER) *sk; 2101. 2102. sk = ssl_create_cipher_list(ctx->method, &ctx->cipher_list, ^ 2103. &ctx->cipher_list_by_id, str, ctx->cert); 2104. /* ssl/ssl_ciph.c:1297:1: Parameter `*rule_str` 1295. #endif 1296. 1297. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER) 1298. **cipher_list, STACK_OF(SSL_CIPHER) 1299. **cipher_list_by_id, ssl/ssl_ciph.c:1315:10: Call 1313. return NULL; 1314. #ifndef OPENSSL_NO_EC 1315. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1316. return NULL; 1317. #endif ssl/ssl_ciph.c:1243:1: Parameter `**prule_str` 1241. 1242. #ifndef OPENSSL_NO_EC 1243. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1244. const char **prule_str) 1245. { ssl/ssl_ciph.c:1468:5: Assignment 1466. */ 1467. ok = 1; 1468. rule_p = rule_str; ^ 1469. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1470. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1478:14: Call 1476. 1477. if (ok && (strlen(rule_p) > 0)) 1478. ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); ^ 1479. 1480. OPENSSL_free(ca_list); /* Not needed anymore */ ssl/ssl_ciph.c:987:1: <Length trace> 985. } 986. 987. > static int ssl_cipher_process_rulestr(const char *rule_str, 988. CIPHER_ORDER **head_p, 989. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:987:1: Parameter `*rule_str` 985. } 986. 987. > static int ssl_cipher_process_rulestr(const char *rule_str, 988. CIPHER_ORDER **head_p, 989. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:1000:5: Assignment 998. 999. retval = 1; 1000. l = rule_str; ^ 1001. for (;;) { 1002. ch = *l; ssl/ssl_ciph.c:1036:13: Assignment 1034. for (;;) { 1035. ch = *l; 1036. buf = l; ^ 1037. buflen = 0; 1038. #ifndef CHARSET_EBCDIC ssl/ssl_ciph.c:1206:29: Array access: Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 4 by call to `SSL_CTX_set_cipher_list` 1204. ok = ssl_cipher_strength_sort(head_p, tail_p); 1205. else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { 1206. int level = buf[9] - '0'; ^ 1207. if (level < 0 || level > 5) { 1208. SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
https://github.com/openssl/openssl/blob/68a55f3b451060c747986aeffa322d32c770dd62/ssl/ssl_ciph.c/#L1206
d2a_code_trace_data_45532
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:3080: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `HMAC_CTX_new()` at line 3069, column 12 is not reachable after line 3080, column 13. Showing all 38 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 false 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:3079:13: Taking true branch 3077. if (rv < 0) 3078. return -1; 3079. if (rv == 0) ^ 3080. return 2; 3081. if (rv == 2) ssl/t1_lib.c:3080:13: 3078. return -1; 3079. if (rv == 0) 3080. > return 2; 3081. if (rv == 2) 3082. renew_ticket = 1;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/t1_lib.c/#L3080
d2a_code_trace_data_45533
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1098: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1098:42: 1096. int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; 1097. 1098. if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; ^ 1099. CHECK_MV(mx,my) 1100. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1098
d2a_code_trace_data_45534
int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus " "succeeded\n"); return 0; } BN_set_word(c, 16); if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { fprintf(stderr, "BN_mod_exp_mont_consttime with even modulus " "succeeded\n"); return 0; } BN_bntest_rand(c, 30, 0, 1); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (!BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) return (00); 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, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_exp(e, a, b, ctx); BN_sub(e, e, d); BN_div(a, b, e, c, ctx); if (!BN_is_zero(b)) { fprintf(stderr, "Modulo exponentiation test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:1057: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1047, column 9 is not reachable after line 1057, column 17. Showing all 143 steps of the trace test/bntest.c:1042:1: start of procedure test_mod_exp_mont_consttime() 1040. } 1041. 1042. > int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx) 1043. { 1044. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:1047:5: 1045. int i; 1046. 1047. > a = BN_new(); 1048. b = BN_new(); 1049. 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:1048:5: 1046. 1047. a = BN_new(); 1048. > b = BN_new(); 1049. c = BN_new(); 1050. 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:1049:5: 1047. a = BN_new(); 1048. b = BN_new(); 1049. > c = BN_new(); 1050. d = BN_new(); 1051. 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:1050:5: 1048. b = BN_new(); 1049. c = BN_new(); 1050. > d = BN_new(); 1051. e = BN_new(); 1052. 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:1051:5: 1049. c = BN_new(); 1050. d = BN_new(); 1051. > e = BN_new(); 1052. 1053. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1053:5: 1051. e = BN_new(); 1052. 1053. > BN_one(a); 1054. BN_one(b); 1055. BN_zero(c); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:1054:5: 1052. 1053. BN_one(a); 1054. > BN_one(b); 1055. BN_zero(c); 1056. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:1055:5: 1053. BN_one(a); 1054. BN_one(b); 1055. > BN_zero(c); 1056. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { 1057. fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus " crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:1056:9: Taking true branch 1054. BN_one(b); 1055. BN_zero(c); 1056. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { ^ 1057. fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus " 1058. "succeeded\n"); test/bntest.c:1057:9: 1055. BN_zero(c); 1056. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) { 1057. > fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus " 1058. "succeeded\n"); 1059. return 0;
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1057
d2a_code_trace_data_45535
enum 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, i, j; unsigned int len; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); peer = s->session->peer; pkey = X509_get_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; } if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { len = 64; } else { 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 } 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; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; 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 TLS 1.2 with 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; } 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; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, data, len, pkey->pkey.rsa); if (i < 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j = DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, data, len, pkey->pkey.dsa); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_EC if (pkey->type == EVP_PKEY_EC) { j = ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, data, len, pkey->pkey.ec); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL); EVP_PKEY_verify_init(pctx); if (len != 64) { fprintf(stderr, "GOST signature length is %d", len); } for (idx = 0; idx < 64; idx++) { signature[63 - idx] = data[idx]; } j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md, 32); EVP_PKEY_CTX_free(pctx); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret = MSG_PROCESS_CONTINUE_PROCESSING; if (0) { f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); statem_set_error(s); } BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return ret; } ssl/statem/statem_srvr.c:3032: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 3017 could be null and is dereferenced at line 3032, column 40. Showing all 23 steps of the trace ssl/statem/statem_srvr.c:3004:1: start of procedure tls_process_cert_verify() 3002. } 3003. 3004. > enum MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 3005. { 3006. EVP_PKEY *pkey = NULL; ssl/statem/statem_srvr.c:3006:5: 3004. enum MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 3005. { 3006. > EVP_PKEY *pkey = NULL; 3007. unsigned char *sig, *data; 3008. int al, ret = MSG_PROCESS_ERROR; ssl/statem/statem_srvr.c:3008:5: 3006. EVP_PKEY *pkey = NULL; 3007. unsigned char *sig, *data; 3008. > int al, ret = MSG_PROCESS_ERROR; 3009. int type = 0, i, j; 3010. unsigned int len; ssl/statem/statem_srvr.c:3009:5: 3007. unsigned char *sig, *data; 3008. int al, ret = MSG_PROCESS_ERROR; 3009. > int type = 0, i, j; 3010. unsigned int len; 3011. X509 *peer; ssl/statem/statem_srvr.c:3012:5: 3010. unsigned int len; 3011. X509 *peer; 3012. > const EVP_MD *md = NULL; 3013. EVP_MD_CTX mctx; 3014. EVP_MD_CTX_init(&mctx); ssl/statem/statem_srvr.c:3014:5: 3012. const EVP_MD *md = NULL; 3013. EVP_MD_CTX mctx; 3014. > EVP_MD_CTX_init(&mctx); 3015. 3016. peer = s->session->peer; crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx, 0, sizeof(*ctx)); crypto/evp/digest.c:122:5: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx, 0, sizeof(*ctx)); 123. } 124. crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx, 0, sizeof(*ctx)); 123. > } 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/statem/statem_srvr.c:3016:5: 3014. EVP_MD_CTX_init(&mctx); 3015. 3016. > peer = s->session->peer; 3017. pkey = X509_get_pubkey(peer); 3018. type = X509_certificate_type(peer, pkey); ssl/statem/statem_srvr.c:3017:5: 3015. 3016. peer = s->session->peer; 3017. > pkey = X509_get_pubkey(peer); 3018. type = X509_certificate_type(peer, pkey); 3019. crypto/x509/x509_cmp.c:305:1: start of procedure X509_get_pubkey() 303. } 304. 305. > EVP_PKEY *X509_get_pubkey(X509 *x) 306. { 307. if (x == NULL) crypto/x509/x509_cmp.c:307:9: Taking true branch 305. EVP_PKEY *X509_get_pubkey(X509 *x) 306. { 307. if (x == NULL) ^ 308. return (NULL); 309. return (X509_PUBKEY_get(x->cert_info.key)); crypto/x509/x509_cmp.c:308:9: 306. { 307. if (x == NULL) 308. > return (NULL); 309. return (X509_PUBKEY_get(x->cert_info.key)); 310. } crypto/x509/x509_cmp.c:310:1: return from a call to X509_get_pubkey 308. return (NULL); 309. return (X509_PUBKEY_get(x->cert_info.key)); 310. > } 311. 312. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/statem/statem_srvr.c:3018:5: Skipping X509_certificate_type(): empty list of specs 3016. peer = s->session->peer; 3017. pkey = X509_get_pubkey(peer); 3018. type = X509_certificate_type(peer, pkey); ^ 3019. 3020. if (!(type & EVP_PKT_SIGN)) { ssl/statem/statem_srvr.c:3020:11: Taking false branch 3018. type = X509_certificate_type(peer, pkey); 3019. 3020. if (!(type & EVP_PKT_SIGN)) { ^ 3021. SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, 3022. SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/statem/statem_srvr.c:3032:9: 3030. * length field 3031. */ 3032. > if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { 3033. len = 64; 3034. } else { ssl/packet_locl.h:89:1: start of procedure PACKET_remaining() 87. * Returns the number of bytes remaining to be read in the PACKET 88. */ 89. > static inline size_t PACKET_remaining(const PACKET *pkt) 90. { 91. return pkt->remaining; ssl/packet_locl.h:91:5: 89. static inline size_t PACKET_remaining(const PACKET *pkt) 90. { 91. > return pkt->remaining; 92. } 93. ssl/packet_locl.h:92:1: return from a call to PACKET_remaining 90. { 91. return pkt->remaining; 92. > } 93. 94. /* ssl/statem/statem_srvr.c:3032:9: Taking true branch 3030. * length field 3031. */ 3032. if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { ^ 3033. len = 64; 3034. } else { ssl/statem/statem_srvr.c:3032:40: 3030. * length field 3031. */ 3032. > if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { 3033. len = 64; 3034. } else {
https://github.com/openssl/openssl/blob/f3b9257f8239e06cc30cea47558d37fc540853ee/ssl/statem/statem_srvr.c/#L3032
d2a_code_trace_data_45536
void ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates) { SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates, ff_formats_ref, formats); } libavfilter/formats.c:380: error: Memory Leak memory dynamically allocated by call to `ff_formats_ref()` at line 380, column 5 is not reachable after line 380, column 5. libavfilter/formats.c:377:1: start of procedure ff_set_common_samplerates() 375. } 376. 377. void ff_set_common_samplerates(AVFilterContext *ctx, ^ 378. AVFilterFormats *samplerates) 379. { libavfilter/formats.c:380:5: Loop condition is true. Entering loop body 378. AVFilterFormats *samplerates) 379. { 380. SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates, ^ 381. ff_formats_ref, formats); 382. } libavfilter/formats.c:380:5: Taking true branch 378. AVFilterFormats *samplerates) 379. { 380. SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates, ^ 381. ff_formats_ref, formats); 382. } libavfilter/formats.c:276:1: start of procedure ff_formats_ref() 274. } 275. 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) ^ 277. { 278. FORMATS_REF(f, ref); libavfilter/formats.c:278:5: 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) 277. { 278. FORMATS_REF(f, ref); ^ 279. } 280. libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:9: Taking false branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:136:5: 134. return _aligned_realloc(ptr, size, 32); 135. #else 136. return realloc(ptr, size); ^ 137. #endif 138. } libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavfilter/formats.c:278:5: Taking false branch 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) 277. { 278. FORMATS_REF(f, ref); ^ 279. } 280. libavfilter/formats.c:278:5: Loop condition is false. Leaving loop 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) 277. { 278. FORMATS_REF(f, ref); ^ 279. } 280. libavfilter/formats.c:279:1: return from a call to ff_formats_ref 277. { 278. FORMATS_REF(f, ref); 279. } ^ 280. 281. #define FIND_REF_INDEX(ref, idx) \ libavfilter/formats.c:380:5: Loop condition is true. Entering loop body 378. AVFilterFormats *samplerates) 379. { 380. SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates, ^ 381. ff_formats_ref, formats); 382. } libavfilter/formats.c:380:5: Taking true branch 378. AVFilterFormats *samplerates) 379. { 380. SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates, ^ 381. ff_formats_ref, formats); 382. } libavfilter/formats.c:276:1: start of procedure ff_formats_ref() 274. } 275. 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) ^ 277. { 278. FORMATS_REF(f, ref); libavfilter/formats.c:278:5: 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) 277. { 278. FORMATS_REF(f, ref); ^ 279. } 280. libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:9: Taking true branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:125:9: 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) 125. return NULL; ^ 126. 127. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavfilter/formats.c:278:5: Taking true branch 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) 277. { 278. FORMATS_REF(f, ref); ^ 279. } 280. libavfilter/formats.c:279:1: return from a call to ff_formats_ref 277. { 278. FORMATS_REF(f, ref); 279. } ^ 280. 281. #define FIND_REF_INDEX(ref, idx) \
https://github.com/libav/libav/blob/83847cc8fa97e0fc637a0962bafb837acdb6eacc/libavfilter/formats.c/#L380
d2a_code_trace_data_45537
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/core/ngx_resolver.c:1449: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/core/ngx_resolver.c:1440:9: Unknown value from: strcmp 1438. } 1439. 1440. if (ngx_strcmp(&buf[i], "\7in-addr\4arpa") != 0) { ^ 1441. goto invalid_in_addr_arpa; 1442. } src/core/ngx_resolver.c:1449:9: Call 1447. 1448. if (rn == NULL || rn->query == NULL) { 1449. ngx_log_error(r->log_level, r->log, 0, ^ 1450. "unexpected response for %ud.%ud.%ud.%ud", 1451. (addr >> 24) & 0xff, (addr >> 16) & 0xff, 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_45538
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:223: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `witness`. Showing all 22 steps of the trace 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 `a->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); 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 `w->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 `a->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 `a->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: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 `m->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:137:1: Parameter `num->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/bn/bn_div.c:204:11: Call 202. sdiv->neg = 0; 203. norm_shift += BN_BITS2; 204. if (!(BN_lshift(snum, num, norm_shift))) ^ 205. goto err; 206. snum->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 `witness` 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_45539
void ssl3_cbc_digest_record( const EVP_MD_CTX *ctx, unsigned char* md_out, size_t* md_out_size, const unsigned char header[13], const unsigned char *data, size_t data_plus_mac_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, unsigned mac_secret_length, char is_sslv3) { union { double align; unsigned char c[sizeof(LARGEST_DIGEST_CTX)]; } md_state; void (*md_final_raw)(void *ctx, unsigned char *md_out); void (*md_transform)(void *ctx, const unsigned char *block); unsigned md_size, md_block_size = 64; unsigned sslv3_pad_length = 40, header_length, variance_blocks, len, max_mac_bytes, num_blocks, num_starting_blocks, k, mac_end_offset, c, index_a, index_b; unsigned int bits; unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES]; unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE]; unsigned char first_block[MAX_HASH_BLOCK_SIZE]; unsigned char mac_out[EVP_MAX_MD_SIZE]; unsigned i, j, md_out_size_u; EVP_MD_CTX md_ctx; unsigned md_length_size = 8; char length_is_big_endian = 1; OPENSSL_assert(data_plus_mac_plus_padding_size < 1024*1024); switch (EVP_MD_CTX_type(ctx)) { case NID_md5: MD5_Init((MD5_CTX*)md_state.c); md_final_raw = tls1_md5_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; md_size = 16; sslv3_pad_length = 48; length_is_big_endian = 0; break; case NID_sha1: SHA1_Init((SHA_CTX*)md_state.c); md_final_raw = tls1_sha1_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA1_Transform; md_size = 20; break; #ifndef OPENSSL_NO_SHA256 case NID_sha224: SHA224_Init((SHA256_CTX*)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA256_Transform; md_size = 224/8; break; case NID_sha256: SHA256_Init((SHA256_CTX*)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA256_Transform; md_size = 32; break; #endif #ifndef OPENSSL_NO_SHA512 case NID_sha384: SHA384_Init((SHA512_CTX*)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA512_Transform; md_size = 384/8; md_block_size = 128; md_length_size = 16; break; case NID_sha512: SHA512_Init((SHA512_CTX*)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA512_Transform; md_size = 64; md_block_size = 128; md_length_size = 16; break; #endif default: OPENSSL_assert(0); if (md_out_size) *md_out_size = -1; return; } OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES); OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); header_length = 13; if (is_sslv3) { header_length = mac_secret_length + sslv3_pad_length + 8 + 1 + 2 ; } variance_blocks = is_sslv3 ? 2 : 6; len = data_plus_mac_plus_padding_size + header_length; max_mac_bytes = len - md_size - 1; num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size; num_starting_blocks = 0; k = 0; mac_end_offset = data_plus_mac_size + header_length - md_size; c = mac_end_offset % md_block_size; index_a = mac_end_offset / md_block_size; index_b = (mac_end_offset + md_length_size) / md_block_size; if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) { num_starting_blocks = num_blocks - variance_blocks; k = md_block_size*num_starting_blocks; } bits = 8*mac_end_offset; if (!is_sslv3) { bits += 8*md_block_size; memset(hmac_pad, 0, md_block_size); OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad)); memcpy(hmac_pad, mac_secret, mac_secret_length); for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x36; md_transform(md_state.c, hmac_pad); } if (length_is_big_endian) { memset(length_bytes,0,md_length_size-4); length_bytes[md_length_size-4] = (unsigned char)(bits>>24); length_bytes[md_length_size-3] = (unsigned char)(bits>>16); length_bytes[md_length_size-2] = (unsigned char)(bits>>8); length_bytes[md_length_size-1] = (unsigned char)bits; } else { memset(length_bytes,0,md_length_size); length_bytes[md_length_size-5] = (unsigned char)(bits>>24); length_bytes[md_length_size-6] = (unsigned char)(bits>>16); length_bytes[md_length_size-7] = (unsigned char)(bits>>8); length_bytes[md_length_size-8] = (unsigned char)bits; } if (k > 0) { if (is_sslv3) { unsigned overhang = header_length-md_block_size; md_transform(md_state.c, header); memcpy(first_block, header + md_block_size, overhang); memcpy(first_block + overhang, data, md_block_size-overhang); md_transform(md_state.c, first_block); for (i = 1; i < k/md_block_size - 1; i++) md_transform(md_state.c, data + md_block_size*i - overhang); } else { memcpy(first_block, header, 13); memcpy(first_block+13, data, md_block_size-13); md_transform(md_state.c, first_block); for (i = 1; i < k/md_block_size; i++) md_transform(md_state.c, data + md_block_size*i - 13); } } memset(mac_out, 0, sizeof(mac_out)); for (i = num_starting_blocks; i <= num_starting_blocks+variance_blocks; i++) { unsigned char block[MAX_HASH_BLOCK_SIZE]; unsigned char is_block_a = constant_time_eq_8(i, index_a); unsigned char is_block_b = constant_time_eq_8(i, index_b); for (j = 0; j < md_block_size; j++) { unsigned char b = 0, is_past_c, is_past_cp1; if (k < header_length) b = header[k]; else if (k < data_plus_mac_plus_padding_size + header_length) b = data[k-header_length]; k++; is_past_c = is_block_a & constant_time_ge(j, c); is_past_cp1 = is_block_a & constant_time_ge(j, c+1); b = (b&~is_past_c) | (0x80&is_past_c); b = b&~is_past_cp1; b &= ~is_block_b | is_block_a; if (j >= md_block_size - md_length_size) { b = (b&~is_block_b) | (is_block_b&length_bytes[j-(md_block_size-md_length_size)]); } block[j] = b; } md_transform(md_state.c, block); md_final_raw(md_state.c, block); for (j = 0; j < md_size; j++) mac_out[j] |= block[j]&is_block_b; } EVP_MD_CTX_init(&md_ctx); EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL ); if (is_sslv3) { memset(hmac_pad, 0x5c, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_secret, mac_secret_length); EVP_DigestUpdate(&md_ctx, hmac_pad, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } else { for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x6a; EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } EVP_DigestFinal(&md_ctx, md_out, &md_out_size_u); if (md_out_size) *md_out_size = md_out_size_u; EVP_MD_CTX_cleanup(&md_ctx); } ssl/s3_enc.c:768: error: INTEGER_OVERFLOW_L2 ([13, +oo] - [16, 64]):unsigned32 by call to `ssl3_cbc_digest_record`. Showing all 9 steps of the trace ssl/s3_enc.c:705:1: Parameter `ssl->s3->rrec.type` 703. } 704. 705. > int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) 706. { 707. SSL3_RECORD *rec; ssl/s3_enc.c:738:2: Assignment 736. 737. /* kludge: ssl3_cbc_remove_padding passes padding length in rec->type */ 738. orig_len = rec->length+md_size+((unsigned int)rec->type>>8); ^ 739. rec->type &= 0xff; 740. ssl/s3_enc.c:768:3: Call 766. header[j++] = rec->length & 0xff; 767. 768. ssl3_cbc_digest_record( ^ 769. hash, 770. md, &md_size, ssl/s3_cbc.c:436:1: <LHS trace> 434. * a padding byte and MAC. (If the padding was invalid, it might contain the 435. * padding too. ) */ 436. > void ssl3_cbc_digest_record( 437. const EVP_MD_CTX *ctx, 438. unsigned char* md_out, ssl/s3_cbc.c:436:1: Parameter `data_plus_mac_plus_padding_size` 434. * a padding byte and MAC. (If the padding was invalid, it might contain the 435. * padding too. ) */ 436. > void ssl3_cbc_digest_record( 437. const EVP_MD_CTX *ctx, 438. unsigned char* md_out, ssl/s3_cbc.c:566:2: Assignment 564. * bytes of `header' before the start of the data (TLS) or 71/75 bytes 565. * (SSLv3) */ 566. len = data_plus_mac_plus_padding_size + header_length; ^ 567. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including 568. * |header|, assuming that there's no padding. */ ssl/s3_cbc.c:479:4: <RHS trace> 477. md_final_raw = tls1_md5_final_raw; 478. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 479. md_size = 16; ^ 480. sslv3_pad_length = 48; 481. length_is_big_endian = 0; ssl/s3_cbc.c:479:4: Assignment 477. md_final_raw = tls1_md5_final_raw; 478. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 479. md_size = 16; ^ 480. sslv3_pad_length = 48; 481. length_is_big_endian = 0; ssl/s3_cbc.c:569:2: Binary operation: ([13, +oo] - [16, 64]):unsigned32 by call to `ssl3_cbc_digest_record` 567. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including 568. * |header|, assuming that there's no padding. */ 569. max_mac_bytes = len - md_size - 1; ^ 570. /* num_blocks is the maximum number of hash blocks. */ 571. num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size;
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/ssl/s3_cbc.c/#L569
d2a_code_trace_data_45540
static int createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) { unsigned char *sect_buff = NULL; unsigned char *new_buff = NULL; static uint32 prev_sectsize = 0; sect_buff = *sect_buff_ptr; if (!sect_buff) { sect_buff = (unsigned char *)_TIFFmalloc(sectsize); *sect_buff_ptr = sect_buff; _TIFFmemset(sect_buff, 0, sectsize); } else { if (prev_sectsize < sectsize) { new_buff = _TIFFrealloc(sect_buff, sectsize); if (!new_buff) { free (sect_buff); sect_buff = (unsigned char *)_TIFFmalloc(sectsize); } else sect_buff = new_buff; _TIFFmemset(sect_buff, 0, sectsize); } } if (!sect_buff) { TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); return (-1); } prev_sectsize = sectsize; *sect_buff_ptr = sect_buff; return (0); } tools/tiffcrop.c:7335: error: Null Dereference pointer `sect_buff` last assigned on line 7333 could be null and is dereferenced by call to `_TIFFmemset()` at line 7335, column 5. tools/tiffcrop.c:7322:1: start of procedure createImageSection() 7320. 7321. /* Create a buffer to write one section at a time */ 7322. static int ^ 7323. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) 7324. { tools/tiffcrop.c:7325:3: 7323. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) 7324. { 7325. unsigned char *sect_buff = NULL; ^ 7326. unsigned char *new_buff = NULL; 7327. static uint32 prev_sectsize = 0; tools/tiffcrop.c:7326:3: 7324. { 7325. unsigned char *sect_buff = NULL; 7326. unsigned char *new_buff = NULL; ^ 7327. static uint32 prev_sectsize = 0; 7328. tools/tiffcrop.c:7327:3: 7325. unsigned char *sect_buff = NULL; 7326. unsigned char *new_buff = NULL; 7327. static uint32 prev_sectsize = 0; ^ 7328. 7329. sect_buff = *sect_buff_ptr; tools/tiffcrop.c:7329:3: 7327. static uint32 prev_sectsize = 0; 7328. 7329. sect_buff = *sect_buff_ptr; ^ 7330. 7331. if (!sect_buff) tools/tiffcrop.c:7331:8: Taking true branch 7329. sect_buff = *sect_buff_ptr; 7330. 7331. if (!sect_buff) ^ 7332. { 7333. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); tools/tiffcrop.c:7333:5: 7331. if (!sect_buff) 7332. { 7333. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); ^ 7334. *sect_buff_ptr = sect_buff; 7335. _TIFFmemset(sect_buff, 0, sectsize); 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) tools/tiffcrop.c:7334:5: 7332. { 7333. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); 7334. *sect_buff_ptr = sect_buff; ^ 7335. _TIFFmemset(sect_buff, 0, sectsize); 7336. } tools/tiffcrop.c:7335:5: 7333. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); 7334. *sect_buff_ptr = sect_buff; 7335. _TIFFmemset(sect_buff, 0, sectsize); ^ 7336. } 7337. else libtiff/tif_unix.c:339:1: start of procedure _TIFFmemset() 337. } 338. 339. void ^ 340. _TIFFmemset(void* p, int v, tmsize_t c) 341. { libtiff/tif_unix.c:342:2: 340. _TIFFmemset(void* p, int v, tmsize_t c) 341. { 342. memset(p, v, (size_t) c); ^ 343. } 344. libtiff/tif_unix.c:343:1: return from a call to _TIFFmemset 341. { 342. memset(p, v, (size_t) c); 343. } ^ 344. 345. void
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/tools/tiffcrop.c/#L7335
d2a_code_trace_data_45541
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; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); av_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); av_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); av_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); av_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); } if (use_audio) { new_audio_stream(oc); } if (use_subtitle) { new_subtitle_stream(oc); } oc->timestamp = rec_timestamp; for(; metadata_count>0; metadata_count--){ av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key, metadata[metadata_count-1].value, 0); } av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); } 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); av_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"); av_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); av_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); av_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); av_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); } ffmpeg.c:3664: error: Null Dereference pointer `file_oformat` last assigned on line 3653 could be null and is dereferenced at line 3664, column 17. ffmpeg.c:3628:1: start of procedure opt_output_file() 3626. } 3627. 3628. static void opt_output_file(const char *filename) ^ 3629. { 3630. AVFormatContext *oc; ffmpeg.c:3633:5: 3631. int err, use_video, use_audio, use_subtitle; 3632. int input_has_video, input_has_audio, input_has_subtitle; 3633. AVFormatParameters params, *ap = &params; ^ 3634. AVOutputFormat *file_oformat; 3635. ffmpeg.c:3636:10: Taking false branch 3634. AVOutputFormat *file_oformat; 3635. 3636. if (!strcmp(filename, "-")) ^ 3637. filename = "pipe:"; 3638. ffmpeg.c:3639:5: 3637. filename = "pipe:"; 3638. 3639. oc = avformat_alloc_context(); ^ 3640. if (!oc) { 3641. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:81:1: start of procedure avformat_alloc_context() 79. } 80. 81. AVFormatContext *avformat_alloc_context(void) ^ 82. { 83. AVFormatContext *ic; libavformat/options.c:84:5: 82. { 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); ^ 85. if (!ic) return ic; 86. 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:85:10: Taking false branch 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); 85. if (!ic) return ic; ^ 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; libavformat/options.c:86:5: Skipping avformat_get_context_defaults(): empty list of specs 84. ic = av_malloc(sizeof(AVFormatContext)); 85. if (!ic) return ic; 86. avformat_get_context_defaults(ic); ^ 87. ic->av_class = &av_format_context_class; 88. return ic; libavformat/options.c:87:5: 85. if (!ic) return ic; 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; ^ 88. return ic; 89. } libavformat/options.c:88:5: 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; 88. return ic; ^ 89. } 90. libavformat/options.c:89:1: return from a call to avformat_alloc_context 87. ic->av_class = &av_format_context_class; 88. return ic; 89. } ^ 90. 91. #if LIBAVFORMAT_VERSION_MAJOR < 53 ffmpeg.c:3640:10: Taking false branch 3638. 3639. oc = avformat_alloc_context(); 3640. if (!oc) { ^ 3641. print_error(filename, AVERROR(ENOMEM)); 3642. av_exit(1); ffmpeg.c:3645:9: Taking false branch 3643. } 3644. 3645. if (last_asked_format) { ^ 3646. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3647. if (!file_oformat) { ffmpeg.c:3653:9: Skipping av_guess_format(): empty list of specs 3651. last_asked_format = NULL; 3652. } else { 3653. file_oformat = av_guess_format(NULL, filename, NULL); ^ 3654. if (!file_oformat) { 3655. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3654:14: Taking true branch 3652. } else { 3653. file_oformat = av_guess_format(NULL, filename, NULL); 3654. if (!file_oformat) { ^ 3655. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3656. filename); ffmpeg.c:3655:13: 3653. file_oformat = av_guess_format(NULL, filename, NULL); 3654. if (!file_oformat) { 3655. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3656. filename); 3657. av_exit(1); ffmpeg.c:3657:13: Skipping av_exit(): empty list of specs 3655. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3656. filename); 3657. av_exit(1); ^ 3658. } 3659. } ffmpeg.c:3661:5: 3659. } 3660. 3661. oc->oformat = file_oformat; ^ 3662. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3663. ffmpeg.c:3662:5: 3660. 3661. oc->oformat = file_oformat; 3662. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3663. 3664. 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:3664:10: 3662. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3663. 3664. if (!strcmp(file_oformat->name, "ffm") && ^ 3665. av_strstart(filename, "http:", NULL)) { 3666. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/27241cbffe180fc92f9f519c6ea7957fc4b3b0c9/ffmpeg.c/#L3664
d2a_code_trace_data_45542
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr) { register const MPA_INT *w, *w2, *p; int j; OUT_INT *samples2; #if CONFIG_FLOAT float sum, sum2; #elif FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif memcpy(synth_buf + 512, synth_buf, 32 * sizeof(*synth_buf)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(MACS, sum, w, p); p = synth_buf + 48; SUM8(MLSS, sum, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, MACS, sum2, MLSS, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(MLSS, sum, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; } libavcodec/mpc.c:54: error: Buffer Overrun L2 Offset: [496+min(0, `c->synth_buf_offset[*]`), 497+max(511, `c->synth_buf_offset[*]`)] (⇐ [48+min(0, `c->synth_buf_offset[*]`), 49+max(511, `c->synth_buf_offset[*]`)] + 448) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:45:1: Parameter `c->synth_buf[*]` 43. * Process decoded Musepack data and produce PCM 44. */ 45. static void mpc_synth(MPCContext *c, int16_t *out) ^ 46. { 47. int dither_state = 0; libavcodec/mpc.c:54:13: Call 52. samples_ptr = samples + ch; 53. for(i = 0; i < SAMPLES_PER_BAND; i++) { 54. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 55. ff_mpa_synth_window, &dither_state, 56. samples_ptr, 2, libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr` 703. /* XXX: optimize by avoiding ring buffer usage */ 704. #if !CONFIG_FLOAT 705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 706. MPA_INT *window, int *dither_state, 707. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:718:5: Assignment 716. 717. offset = *synth_buf_offset; 718. synth_buf = synth_buf_ptr + offset; ^ 719. 720. #if FRAC_BITS <= 15 libavcodec/mpegaudiodec.c:731:5: Call 729. #endif 730. 731. apply_window_mp3_c(synth_buf, window, dither_state, samples, incr); ^ 732. 733. offset = (offset - 32) & 511; libavcodec/mpegaudiodec.c:646:1: <Length trace> 644. } 645. 646. static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, ^ 647. int *dither_state, OUT_INT *samples, int incr) 648. { libavcodec/mpegaudiodec.c:646:1: Parameter `*synth_buf` 644. } 645. 646. static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, ^ 647. int *dither_state, OUT_INT *samples, int incr) 648. { libavcodec/mpegaudiodec.c:670:5: Assignment 668. p = synth_buf + 16; 669. SUM8(MACS, sum, w, p); 670. p = synth_buf + 48; ^ 671. SUM8(MLSS, sum, w + 32, p); 672. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:671:5: Array access: Offset: [496+min(0, c->synth_buf_offset[*]), 497+max(511, c->synth_buf_offset[*])] (⇐ [48+min(0, c->synth_buf_offset[*]), 49+max(511, c->synth_buf_offset[*])] + 448) Size: 2 by call to `ff_mpa_synth_filter` 669. SUM8(MACS, sum, w, p); 670. p = synth_buf + 48; 671. SUM8(MLSS, sum, w + 32, p); ^ 672. *samples = round_sample(&sum); 673. samples += incr;
https://github.com/libav/libav/blob/63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd/libavcodec/mpegaudiodec.c/#L671
d2a_code_trace_data_45543
int test_gf2m_mod(BIO *bp) { BIGNUM *a, *b[2], *c, *d, *e; int i, j, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 1024, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod(c, a, b[j]); BN_GF2m_add(d, a, c); BN_GF2m_mod(e, d, b[j]); if (!BN_is_zero(e)) { fprintf(stderr, "GF(2^m) modulo test failed!\n"); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); return ret; } test/bntest.c:1291: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1266, column 9 is not reachable after line 1291, column 5. Showing all 155 steps of the trace test/bntest.c:1259:1: start of procedure test_gf2m_mod() 1257. } 1258. 1259. > int test_gf2m_mod(BIO *bp) 1260. { 1261. BIGNUM *a, *b[2], *c, *d, *e; test/bntest.c:1262:5: 1260. { 1261. BIGNUM *a, *b[2], *c, *d, *e; 1262. > int i, j, ret = 0; 1263. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1264. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1263:5: 1261. BIGNUM *a, *b[2], *c, *d, *e; 1262. int i, j, ret = 0; 1263. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1264. int p1[] = { 193, 15, 0, -1 }; 1265. test/bntest.c:1264:5: 1262. int i, j, ret = 0; 1263. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1264. > int p1[] = { 193, 15, 0, -1 }; 1265. 1266. a = BN_new(); test/bntest.c:1266:5: 1264. int p1[] = { 193, 15, 0, -1 }; 1265. 1266. > a = BN_new(); 1267. b[0] = BN_new(); 1268. b[1] = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1267:5: 1265. 1266. a = BN_new(); 1267. > b[0] = BN_new(); 1268. b[1] = BN_new(); 1269. 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:1268:5: 1266. a = BN_new(); 1267. b[0] = BN_new(); 1268. > b[1] = BN_new(); 1269. c = BN_new(); 1270. 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:1269:5: 1267. b[0] = BN_new(); 1268. b[1] = BN_new(); 1269. > c = BN_new(); 1270. d = BN_new(); 1271. 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:1270:5: 1268. b[1] = BN_new(); 1269. c = BN_new(); 1270. > d = BN_new(); 1271. e = BN_new(); 1272. 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:1271:5: 1269. c = BN_new(); 1270. d = BN_new(); 1271. > e = BN_new(); 1272. 1273. BN_GF2m_arr2poly(p0, b[0]); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1273:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1271. e = BN_new(); 1272. 1273. BN_GF2m_arr2poly(p0, b[0]); ^ 1274. BN_GF2m_arr2poly(p1, b[1]); 1275. test/bntest.c:1274:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1272. 1273. BN_GF2m_arr2poly(p0, b[0]); 1274. BN_GF2m_arr2poly(p1, b[1]); ^ 1275. 1276. for (i = 0; i < num0; i++) { test/bntest.c:1276:10: 1274. BN_GF2m_arr2poly(p1, b[1]); 1275. 1276. > for (i = 0; i < num0; i++) { 1277. BN_bntest_rand(a, 1024, 0, 0); 1278. for (j = 0; j < 2; j++) { test/bntest.c:1276:17: Loop condition is false. Leaving loop 1274. BN_GF2m_arr2poly(p1, b[1]); 1275. 1276. for (i = 0; i < num0; i++) { ^ 1277. BN_bntest_rand(a, 1024, 0, 0); 1278. for (j = 0; j < 2; j++) { test/bntest.c:1289:5: 1287. } 1288. } 1289. > ret = 1; 1290. err: 1291. BN_free(a); test/bntest.c:1290:2: 1288. } 1289. ret = 1; 1290. > err: 1291. BN_free(a); 1292. BN_free(b[0]); test/bntest.c:1291:5: 1289. ret = 1; 1290. err: 1291. > BN_free(a); 1292. BN_free(b[0]); 1293. BN_free(b[1]); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1291
d2a_code_trace_data_45544
int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) { PROPERTY_DEFN_ELEM elem, *old, *p = NULL; size_t len; if (prop == NULL) return 1; if (pl == NULL) { elem.prop = prop; lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem); return 1; } len = strlen(prop); p = OPENSSL_malloc(sizeof(*p) + len); if (p != NULL) { p->prop = p->body; p->defn = pl; memcpy(p->body, prop, len + 1); old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); if (old != NULL) { property_defn_free(old); return 1; } if (!lh_PROPERTY_DEFN_ELEM_error(property_defns)) return 1; } OPENSSL_free(p); return 0; } test/property_test.c:299: error: BUFFER_OVERRUN_L3 Offset added: [1, 37] Size: [0, +oo] by call to `ossl_method_store_add`. Showing all 10 steps of the trace test/property_test.c:265:9: Array declaration 263. char *impl; 264. } impls[] = { 265. { 1, "fast=no, colour=green", "a" }, ^ 266. { 1, "fast, colour=blue", "b" }, 267. { 1, "", "-" }, test/property_test.c:299:14: Call 297. 298. for (i = 0; i < OSSL_NELEM(impls); i++) 299. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop, ^ 300. impls[i].impl, NULL))) { 301. TEST_note("iteration %zd", i + 1); crypto/property/property.c:186:1: Parameter `*properties` 184. } 185. 186. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 187. int nid, const char *properties, 188. void *method, void (*method_destruct)(void *)) crypto/property/property.c:217:9: Call 215. if ((impl->properties = ossl_parse_property(properties)) == NULL) 216. goto err; 217. ossl_prop_defn_set(properties, impl->properties); ^ 218. } 219. crypto/property/defn_cache.c:76:1: <Offset trace> 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:76:1: Parameter `prop->strlen` 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:89:5: Assignment 87. return 1; 88. } 89. len = strlen(prop); ^ 90. p = OPENSSL_malloc(sizeof(*p) + len); 91. if (p != NULL) { crypto/property/defn_cache.c:76:1: <Length trace> 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:76:1: Parameter `*prop` 74. } 75. 76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl) 77. { 78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL; crypto/property/defn_cache.c:94:9: Array access: Offset added: [1, 37] Size: [0, +oo] by call to `ossl_method_store_add` 92. p->prop = p->body; 93. p->defn = pl; 94. memcpy(p->body, prop, len + 1); ^ 95. old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); 96. if (old != NULL) {
https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/property/defn_cache.c/#L94
d2a_code_trace_data_45545
static void JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) { if ((uint32)skiplength<=data->bufferbytesleft) { data->buffercurrentbyte+=skiplength; data->bufferbytesleft-=skiplength; } else { uint16 m; m=skiplength-data->bufferbytesleft; if (m<=data->filebytesleft) { data->bufferbytesleft=0; data->fileoffset+=m; data->filebytesleft-=m; data->filepositioned=0; } else { data->bufferbytesleft=0; data->filebytesleft=0; } } } libtiff/tif_jpeg.c:817: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `JPEGFixupTagsSubsamplingSkip`. libtiff/tif_jpeg.c:812:6: Call 810. if (n!=8+data->tif->tif_dir.td_samplesperpixel*3) 811. return(0); 812. JPEGFixupTagsSubsamplingSkip(data,7); ^ 813. if (!JPEGFixupTagsSubsamplingReadByte(data,&p)) 814. return(0); libtiff/tif_jpeg.c:912:4: Assignment 910. if (m<=data->filebytesleft) 911. { 912. data->bufferbytesleft=0; ^ 913. data->fileoffset+=m; 914. data->filebytesleft-=m; libtiff/tif_jpeg.c:813:11: Call 811. return(0); 812. JPEGFixupTagsSubsamplingSkip(data,7); 813. if (!JPEGFixupTagsSubsamplingReadByte(data,&p)) ^ 814. return(0); 815. ph=(p>>4); libtiff/tif_jpeg.c:855:1: Parameter `data->bufferbytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:817:6: Call 815. ph=(p>>4); 816. pv=(p&15); 817. JPEGFixupTagsSubsamplingSkip(data,1); ^ 818. for (o=1; o<data->tif->tif_dir.td_samplesperpixel; o++) 819. { libtiff/tif_jpeg.c:898:1: <LHS trace> 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: Parameter `skiplength` 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: <RHS trace> 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: Parameter `skiplength` 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:904:3: Binary operation: ([0, +oo] - 1):unsigned32 by call to `JPEGFixupTagsSubsamplingSkip` 902. { 903. data->buffercurrentbyte+=skiplength; 904. data->bufferbytesleft-=skiplength; ^ 905. } 906. else
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L904
d2a_code_trace_data_45546
static int check_name_constraints(X509_STORE_CTX *ctx) { X509 *x; int i, j, rv; for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) { x = sk_X509_value(ctx->chain, i); if (i && (x->ex_flags & EXFLAG_SI)) continue; for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) { NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; if (nc) { rv = NAME_CONSTRAINTS_check(x, nc); if (rv != X509_V_OK) { ctx->error = rv; ctx->error_depth = i; ctx->current_cert = x; if (!ctx->verify_cb(0,ctx)) return 0; } } } } return 1; } crypto/x509/x509_vfy.c:712: error: NULL_DEREFERENCE pointer `x` last assigned on line 710 could be null and is dereferenced at line 712, column 13. Showing all 66 steps of the trace crypto/x509/x509_vfy.c:703:1: start of procedure check_name_constraints() 701. } 702. 703. > static int check_name_constraints(X509_STORE_CTX *ctx) 704. { 705. X509 *x; crypto/x509/x509_vfy.c:708:11: Condition is true 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) ^ 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:708:7: 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. > for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/stack/stack.c:331:1: start of procedure sk_num() 329. } 330. 331. > int sk_num(const _STACK *st) 332. { 333. if(st == NULL) return -1; crypto/stack/stack.c:333:5: Taking false branch 331. int sk_num(const _STACK *st) 332. { 333. if(st == NULL) return -1; ^ 334. return st->num; 335. } crypto/stack/stack.c:334:2: 332. { 333. if(st == NULL) return -1; 334. > return st->num; 335. } 336. crypto/stack/stack.c:335:1: return from a call to sk_num 333. if(st == NULL) return -1; 334. return st->num; 335. > } 336. 337. void *sk_value(const _STACK *st, int i) crypto/x509/x509_vfy.c:708:40: Loop condition is true. Entering loop body 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) ^ 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:710:7: Condition is true 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. x = sk_X509_value(ctx->chain, i); ^ 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) crypto/x509/x509_vfy.c:710:3: 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. > x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) crypto/stack/stack.c:337:1: start of procedure sk_value() 335. } 336. 337. > void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:339:6: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:13: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:24: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:340:2: 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. > return st->data[i]; 341. } 342. crypto/stack/stack.c:341:1: return from a call to sk_value 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. > } 342. 343. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:712:7: Taking true branch 710. x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) ^ 713. continue; 714. /* Check against constraints for all certificates higher in crypto/x509/x509_vfy.c:712:13: Taking true branch 710. x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) ^ 713. continue; 714. /* Check against constraints for all certificates higher in crypto/x509/x509_vfy.c:708:48: 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. > for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:708:40: Loop condition is true. Entering loop body 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) ^ 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:710:7: Condition is true 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. x = sk_X509_value(ctx->chain, i); ^ 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) crypto/x509/x509_vfy.c:710:3: 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. > x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) crypto/stack/stack.c:337:1: start of procedure sk_value() 335. } 336. 337. > void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:339:6: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:13: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:24: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:340:2: 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. > return st->data[i]; 341. } 342. crypto/stack/stack.c:341:1: return from a call to sk_value 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. > } 342. 343. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:712:7: Taking true branch 710. x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) ^ 713. continue; 714. /* Check against constraints for all certificates higher in crypto/x509/x509_vfy.c:712:13: Taking false branch 710. x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) ^ 713. continue; 714. /* Check against constraints for all certificates higher in crypto/x509/x509_vfy.c:719:12: Condition is true 717. * assumed it expects them to be obeyed. 718. */ 719. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) ^ 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; crypto/x509/x509_vfy.c:719:8: 717. * assumed it expects them to be obeyed. 718. */ 719. > for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; crypto/stack/stack.c:331:1: start of procedure sk_num() 329. } 330. 331. > int sk_num(const _STACK *st) 332. { 333. if(st == NULL) return -1; crypto/stack/stack.c:333:5: Taking false branch 331. int sk_num(const _STACK *st) 332. { 333. if(st == NULL) return -1; ^ 334. return st->num; 335. } crypto/stack/stack.c:334:2: 332. { 333. if(st == NULL) return -1; 334. > return st->num; 335. } 336. crypto/stack/stack.c:335:1: return from a call to sk_num 333. if(st == NULL) return -1; 334. return st->num; 335. > } 336. 337. void *sk_value(const _STACK *st, int i) crypto/x509/x509_vfy.c:719:41: Loop condition is true. Entering loop body 717. * assumed it expects them to be obeyed. 718. */ 719. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) ^ 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; crypto/x509/x509_vfy.c:721:27: Condition is true 719. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; ^ 722. if (nc) 723. { crypto/x509/x509_vfy.c:721:4: 719. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) 720. { 721. > NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; 722. if (nc) 723. { crypto/stack/stack.c:337:1: start of procedure sk_value() 335. } 336. 337. > void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:339:6: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:13: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:24: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:340:2: 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. > return st->data[i]; 341. } 342. crypto/stack/stack.c:341:1: return from a call to sk_value 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. > } 342. 343. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:722:8: Taking true branch 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; 722. if (nc) ^ 723. { 724. rv = NAME_CONSTRAINTS_check(x, nc); crypto/x509/x509_vfy.c:724:5: Skipping NAME_CONSTRAINTS_check(): empty list of specs 722. if (nc) 723. { 724. rv = NAME_CONSTRAINTS_check(x, nc); ^ 725. if (rv != X509_V_OK) 726. { crypto/x509/x509_vfy.c:725:9: Taking true branch 723. { 724. rv = NAME_CONSTRAINTS_check(x, nc); 725. if (rv != X509_V_OK) ^ 726. { 727. ctx->error = rv; crypto/x509/x509_vfy.c:727:6: 725. if (rv != X509_V_OK) 726. { 727. > ctx->error = rv; 728. ctx->error_depth = i; 729. ctx->current_cert = x; crypto/x509/x509_vfy.c:728:6: 726. { 727. ctx->error = rv; 728. > ctx->error_depth = i; 729. ctx->current_cert = x; 730. if (!ctx->verify_cb(0,ctx)) crypto/x509/x509_vfy.c:729:6: 727. ctx->error = rv; 728. ctx->error_depth = i; 729. > ctx->current_cert = x; 730. if (!ctx->verify_cb(0,ctx)) 731. return 0; crypto/x509/x509_vfy.c:730:11: Taking false branch 728. ctx->error_depth = i; 729. ctx->current_cert = x; 730. if (!ctx->verify_cb(0,ctx)) ^ 731. return 0; 732. } crypto/x509/x509_vfy.c:719:48: 717. * assumed it expects them to be obeyed. 718. */ 719. > for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; crypto/x509/x509_vfy.c:719:41: Loop condition is false. Leaving loop 717. * assumed it expects them to be obeyed. 718. */ 719. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) ^ 720. { 721. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; crypto/x509/x509_vfy.c:708:48: 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. > for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:708:40: Loop condition is true. Entering loop body 706. int i, j, rv; 707. /* Check name constraints for all certificates */ 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) ^ 709. { 710. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:710:7: Condition is true 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. x = sk_X509_value(ctx->chain, i); ^ 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) crypto/x509/x509_vfy.c:710:3: 708. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) 709. { 710. > x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) crypto/stack/stack.c:337:1: start of procedure sk_value() 335. } 336. 337. > void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:339:6: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:13: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:24: Taking true branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:39: 337. void *sk_value(const _STACK *st, int i) 338. { 339. > if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. } crypto/stack/stack.c:341:1: return from a call to sk_value 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. > } 342. 343. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:712:7: Taking true branch 710. x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. if (i && (x->ex_flags & EXFLAG_SI)) ^ 713. continue; 714. /* Check against constraints for all certificates higher in crypto/x509/x509_vfy.c:712:13: 710. x = sk_X509_value(ctx->chain, i); 711. /* Ignore self issued certs unless last in chain */ 712. > if (i && (x->ex_flags & EXFLAG_SI)) 713. continue; 714. /* Check against constraints for all certificates higher in
https://github.com/openssl/openssl/blob/750487899ad2b794078ed998b513a4a14f60f2cc/crypto/x509/x509_vfy.c/#L712
d2a_code_trace_data_45547
static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; unsigned int k; unsigned int s[8]; unsigned int sx[8]; unsigned int sub_blocks, log2_sub_blocks, sb_length; unsigned int start = 0; unsigned int opt_order; int sb; int32_t *quant_cof = bd->quant_cof; int32_t *current_res; *bd->const_block = 0; *bd->opt_order = 1; bd->js_blocks = get_bits1(gb); opt_order = *bd->opt_order; if (!sconf->bgmc && !sconf->sb_part) { log2_sub_blocks = 0; } else { if (sconf->bgmc && sconf->sb_part) log2_sub_blocks = get_bits(gb, 2); else log2_sub_blocks = 2 * get_bits1(gb); } sub_blocks = 1 << log2_sub_blocks; if (bd->block_length & (sub_blocks - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); return -1; } sb_length = bd->block_length >> log2_sub_blocks; if (sconf->bgmc) { s[0] = get_bits(gb, 8 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 2); for (k = 0; k < sub_blocks; k++) { sx[k] = s[k] & 0x0F; s [k] >>= 4; } } else { s[0] = get_bits(gb, 4 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 0); } if (get_bits1(gb)) *bd->shift_lsbs = get_bits(gb, 4) + 1; *bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || *bd->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, 2, sconf->max_order + 1)); *bd->opt_order = get_bits(gb, opt_order_length); } else { *bd->opt_order = sconf->max_order; } opt_order = *bd->opt_order; if (opt_order) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; for (k = 2; k < opt_order; k++) quant_cof[k] = get_bits(gb, 7); } else { int k_max; add_base = 1; k_max = FFMIN(opt_order, 20); for (k = 0; k < k_max; k++) { int rice_param = parcor_rice_table[sconf->coef_table][k][1]; int offset = parcor_rice_table[sconf->coef_table][k][0]; quant_cof[k] = decode_rice(gb, rice_param) + offset; } k_max = FFMIN(opt_order, 127); for (; k < k_max; k++) quant_cof[k] = decode_rice(gb, 2) + (k & 1); for (; k < opt_order; k++) quant_cof[k] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; } for (k = 2; k < opt_order; k++) quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13); } } if (sconf->long_term_prediction) { *bd->use_ltp = get_bits1(gb); if (*bd->use_ltp) { int r, c; bd->ltp_gain[0] = decode_rice(gb, 1) << 3; bd->ltp_gain[1] = decode_rice(gb, 2) << 3; r = get_unary(gb, 0, 4); c = get_bits(gb, 2); bd->ltp_gain[2] = ltp_gain_values[r][c]; bd->ltp_gain[3] = decode_rice(gb, 2) << 3; bd->ltp_gain[4] = decode_rice(gb, 1) << 3; *bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length); *bd->ltp_lag += FFMAX(4, opt_order + 1); } } if (bd->ra_block) { if (opt_order) bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (opt_order > 1) bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max)); if (opt_order > 2) bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max)); start = FFMIN(opt_order, 3); } if (sconf->bgmc) { int delta[8]; unsigned int k [8]; unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); unsigned int i = start; unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { k [sb] = s[sb] > b ? s[sb] - b : 0; delta[sb] = 5 - s[sb] + k[sb]; ff_bgmc_decode(gb, sb_length, current_res, delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status); current_res += sb_length; } ff_bgmc_decode_end(gb); i = start; current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]]; unsigned int cur_k = k[sb]; unsigned int cur_s = s[sb]; for (; i < sb_length; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (sx[sb] > 2) + (sx[sb] > 10)) << (5 - delta[sb]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); } } *current_res++ = res; } } } else { current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, start = 0) for (; start < sb_length; start++) *current_res++ = decode_rice(gb, s[sb]); } if (!sconf->mc_coding || ctx->js_switch) align_get_bits(gb); return 0; } libavcodec/alsdec.c:662: error: Integer Overflow L2 ([0, `bd->block_length`] - 1):unsigned32. libavcodec/alsdec.c:593:1: <LHS trace> 591. /** Read the block data for a non-constant block 592. */ 593. static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 594. { 595. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:593:1: Parameter `bd->block_length` 591. /** Read the block data for a non-constant block 592. */ 593. static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 594. { 595. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:662:49: Binary operation: ([0, bd->block_length] - 1):unsigned32 660. if (!sconf->rlslms) { 661. if (sconf->adapt_order) { 662. int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, ^ 663. 2, sconf->max_order + 1)); 664. *bd->opt_order = get_bits(gb, opt_order_length);
https://github.com/libav/libav/blob/3cf8db9447a6c77550033acea84e30be2af7ad2c/libavcodec/alsdec.c/#L662
d2a_code_trace_data_45548
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) { int j, len; const char *s, *ss, *p; if (dir == NULL || !*dir) { X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); return 0; } s = dir; p = s; do { if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { BY_DIR_ENTRY *ent; ss = s; s = p + 1; len = (int)(p - ss); if (len == 0) continue; for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); if (strlen(ent->dir) == (size_t)len && strncmp(ent->dir, ss, (unsigned int)len) == 0) break; } if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) continue; if (ctx->dirs == NULL) { ctx->dirs = sk_BY_DIR_ENTRY_new_null(); if (!ctx->dirs) { X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); return 0; } } ent = OPENSSL_malloc(sizeof(*ent)); if (ent == NULL) return 0; ent->dir_type = type; ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); ent->dir = OPENSSL_malloc((unsigned int)len + 1); if (ent->dir == NULL || ent->hashes == NULL) { by_dir_entry_free(ent); return 0; } strncpy(ent->dir, ss, (unsigned int)len); ent->dir[len] = '\0'; if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { by_dir_entry_free(ent); return 0; } } } while (*p++ != '\0'); return 1; } crypto/x509/by_dir.c:215: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 229, column 19 is not reachable after line 215, column 23. Showing all 183 steps of the trace crypto/x509/by_dir.c:194:1: start of procedure add_cert_dir() 192. } 193. 194. > static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) 195. { 196. int j, len; crypto/x509/by_dir.c:199:9: Taking false branch 197. const char *s, *ss, *p; 198. 199. if (dir == NULL || !*dir) { ^ 200. X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); 201. return 0; crypto/x509/by_dir.c:199:25: Taking false branch 197. const char *s, *ss, *p; 198. 199. if (dir == NULL || !*dir) { ^ 200. X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); 201. return 0; crypto/x509/by_dir.c:204:5: 202. } 203. 204. > s = dir; 205. p = s; 206. do { crypto/x509/by_dir.c:205:5: 203. 204. s = dir; 205. > p = s; 206. do { 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { crypto/x509/by_dir.c:207:14: Taking true branch 205. p = s; 206. do { 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { ^ 208. BY_DIR_ENTRY *ent; 209. ss = s; crypto/x509/by_dir.c:209:13: 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { 208. BY_DIR_ENTRY *ent; 209. > ss = s; 210. s = p + 1; 211. len = (int)(p - ss); crypto/x509/by_dir.c:210:13: 208. BY_DIR_ENTRY *ent; 209. ss = s; 210. > s = p + 1; 211. len = (int)(p - ss); 212. if (len == 0) crypto/x509/by_dir.c:211:13: 209. ss = s; 210. s = p + 1; 211. > len = (int)(p - ss); 212. if (len == 0) 213. continue; crypto/x509/by_dir.c:212:17: Taking false branch 210. s = p + 1; 211. len = (int)(p - ss); 212. if (len == 0) ^ 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { crypto/x509/by_dir.c:214:18: 212. if (len == 0) 213. continue; 214. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/by_dir.c:214:25: 212. if (len == 0) 213. continue; 214. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_num() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking true branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:320:9: 318. { 319. if (st == NULL) 320. > return -1; 321. return st->num; 322. } crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_num 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:214:25: Loop condition is false. Leaving loop 212. if (len == 0) 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ^ 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/by_dir.c:220:17: 218. break; 219. } 220. > if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) 221. continue; 222. if (ctx->dirs == NULL) { crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_num() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking true branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:320:9: 318. { 319. if (st == NULL) 320. > return -1; 321. return st->num; 322. } crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_num 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:220:17: Taking false branch 218. break; 219. } 220. if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) ^ 221. continue; 222. if (ctx->dirs == NULL) { crypto/x509/by_dir.c:222:17: Taking true branch 220. if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) 221. continue; 222. if (ctx->dirs == NULL) { ^ 223. ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 224. if (!ctx->dirs) { crypto/x509/by_dir.c:223:17: 221. continue; 222. if (ctx->dirs == NULL) { 223. > ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 224. if (!ctx->dirs) { 225. X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_new_null() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_new_null 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:224:22: Taking false branch 222. if (ctx->dirs == NULL) { 223. ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 224. if (!ctx->dirs) { ^ 225. X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); 226. return 0; crypto/x509/by_dir.c:229:13: 227. } 228. } 229. > ent = OPENSSL_malloc(sizeof(*ent)); 230. if (ent == NULL) 231. return 0; 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/x509/by_dir.c:230:17: Taking false branch 228. } 229. ent = OPENSSL_malloc(sizeof(*ent)); 230. if (ent == NULL) ^ 231. return 0; 232. ent->dir_type = type; crypto/x509/by_dir.c:232:13: 230. if (ent == NULL) 231. return 0; 232. > ent->dir_type = type; 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); crypto/x509/by_dir.c:233:13: 231. return 0; 232. ent->dir_type = type; 233. > ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_HASH_new() 117. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. > DEFINE_STACK_OF(BY_DIR_HASH) 120. DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_HASH_new 117. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. > DEFINE_STACK_OF(BY_DIR_HASH) 120. DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/by_dir.c:234:13: 232. ent->dir_type = type; 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. > ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { 236. by_dir_entry_free(ent); 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/x509/by_dir.c:235:17: Taking false branch 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { ^ 236. by_dir_entry_free(ent); 237. return 0; crypto/x509/by_dir.c:235:37: Taking false branch 233. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 234. ent->dir = OPENSSL_malloc((unsigned int)len + 1); 235. if (ent->dir == NULL || ent->hashes == NULL) { ^ 236. by_dir_entry_free(ent); 237. return 0; crypto/x509/by_dir.c:239:13: 237. return 0; 238. } 239. > strncpy(ent->dir, ss, (unsigned int)len); 240. ent->dir[len] = '\0'; 241. if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { crypto/x509/by_dir.c:240:13: 238. } 239. strncpy(ent->dir, ss, (unsigned int)len); 240. > ent->dir[len] = '\0'; 241. if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { 242. by_dir_entry_free(ent); crypto/x509/by_dir.c:241:18: 239. strncpy(ent->dir, ss, (unsigned int)len); 240. ent->dir[len] = '\0'; 241. > if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { 242. by_dir_entry_free(ent); 243. return 0; crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_push() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:259:1: start of procedure sk_push() 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:5: 259. int sk_push(_STACK *st, void *data) 260. { 261. > return (sk_insert(st, data, st->num)); 262. } 263. crypto/stack/stack.c:167:1: start of procedure sk_insert() 165. } 166. 167. > int sk_insert(_STACK *st, void *data, int loc) 168. { 169. char **s; crypto/stack/stack.c:171:9: Taking false branch 169. char **s; 170. 171. if (st == NULL) ^ 172. return 0; 173. if (st->num_alloc <= st->num + 1) { crypto/stack/stack.c:173:9: Taking false branch 171. if (st == NULL) 172. return 0; 173. if (st->num_alloc <= st->num + 1) { ^ 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); crypto/stack/stack.c:181:10: Taking true branch 179. st->num_alloc *= 2; 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) ^ 182. st->data[st->num] = data; 183. else { crypto/stack/stack.c:182:9: 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) 182. > st->data[st->num] = data; 183. else { 184. memmove(&(st->data[loc + 1]), crypto/stack/stack.c:188:5: 186. st->data[loc] = data; 187. } 188. > st->num++; 189. st->sorted = 0; 190. return (st->num); crypto/stack/stack.c:189:5: 187. } 188. st->num++; 189. > st->sorted = 0; 190. return (st->num); 191. } crypto/stack/stack.c:190:5: 188. st->num++; 189. st->sorted = 0; 190. > return (st->num); 191. } 192. crypto/stack/stack.c:191:1: return from a call to sk_insert 189. st->sorted = 0; 190. return (st->num); 191. > } 192. 193. void *sk_delete_ptr(_STACK *st, void *p) crypto/stack/stack.c:262:1: return from a call to sk_push 260. { 261. return (sk_insert(st, data, st->num)); 262. > } 263. 264. int sk_unshift(_STACK *st, void *data) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_push 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:241:18: Taking false branch 239. strncpy(ent->dir, ss, (unsigned int)len); 240. ent->dir[len] = '\0'; 241. if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { ^ 242. by_dir_entry_free(ent); 243. return 0; crypto/x509/by_dir.c:246:14: Loop condition is true. Entering loop body 244. } 245. } 246. } while (*p++ != '\0'); ^ 247. return 1; 248. } crypto/x509/by_dir.c:207:14: Taking false branch 205. p = s; 206. do { 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { ^ 208. BY_DIR_ENTRY *ent; 209. ss = s; crypto/x509/by_dir.c:207:45: Taking true branch 205. p = s; 206. do { 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { ^ 208. BY_DIR_ENTRY *ent; 209. ss = s; crypto/x509/by_dir.c:209:13: 207. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { 208. BY_DIR_ENTRY *ent; 209. > ss = s; 210. s = p + 1; 211. len = (int)(p - ss); crypto/x509/by_dir.c:210:13: 208. BY_DIR_ENTRY *ent; 209. ss = s; 210. > s = p + 1; 211. len = (int)(p - ss); 212. if (len == 0) crypto/x509/by_dir.c:211:13: 209. ss = s; 210. s = p + 1; 211. > len = (int)(p - ss); 212. if (len == 0) 213. continue; crypto/x509/by_dir.c:212:17: Taking false branch 210. s = p + 1; 211. len = (int)(p - ss); 212. if (len == 0) ^ 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { crypto/x509/by_dir.c:214:18: 212. if (len == 0) 213. continue; 214. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/by_dir.c:214:25: 212. if (len == 0) 213. continue; 214. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_num() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking false branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:321:5: 319. if (st == NULL) 320. return -1; 321. > return st->num; 322. } 323. crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_num 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:214:25: Loop condition is true. Entering loop body 212. if (len == 0) 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ^ 215. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && crypto/x509/by_dir.c:215:17: 213. continue; 214. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 215. > ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 216. if (strlen(ent->dir) == (size_t)len && 217. strncmp(ent->dir, ss, (unsigned int)len) == 0) crypto/x509/x509_lcl.h:120:1: start of procedure sk_BY_DIR_ENTRY_value() 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:324:1: start of procedure sk_value() 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:326:10: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:17: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:28: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:328:5: 326. if (!st || (i < 0) || (i >= st->num)) 327. return NULL; 328. > return st->data[i]; 329. } 330. crypto/stack/stack.c:329:1: return from a call to sk_value 327. return NULL; 328. return st->data[i]; 329. > } 330. 331. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_lcl.h:120:1: return from a call to sk_BY_DIR_ENTRY_value 118. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 119. DEFINE_STACK_OF(BY_DIR_HASH) 120. > DEFINE_STACK_OF(BY_DIR_ENTRY) 121. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 122. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509/by_dir.c/#L215
d2a_code_trace_data_45549
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } avconv.c:4324: error: Null Dereference pointer `today` last assigned on line 4322 could be null and is dereferenced at line 4324, column 69. avconv.c:4318:1: start of procedure opt_vstats() 4316. } 4317. 4318. static int opt_vstats(const char *opt, const char *arg) ^ 4319. { 4320. char filename[40]; avconv.c:4321:5: 4319. { 4320. char filename[40]; 4321. time_t today2 = time(NULL); ^ 4322. struct tm *today = localtime(&today2); 4323. avconv.c:4322:5: 4320. char filename[40]; 4321. time_t today2 = time(NULL); 4322. struct tm *today = localtime(&today2); ^ 4323. 4324. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv.c:4324:5: 4322. struct tm *today = localtime(&today2); 4323. 4324. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4325. today->tm_sec); 4326. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/81749f30cd84b35f774d7d1bbe6bf3f96e2362c8/avconv.c/#L4324
d2a_code_trace_data_45550
static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) { NSVContext *nsv = s->priv_data; AVIOContext *pb = s->pb; unsigned int av_unused file_size; unsigned int size; int64_t duration; int strings_size; int table_entries; int table_entries_used; av_dlog(s, "%s()\n", __FUNCTION__); nsv->state = NSV_UNSYNC; size = avio_rl32(pb); if (size < 28) return -1; nsv->NSVf_end = size; file_size = (uint32_t)avio_rl32(pb); av_dlog(s, "NSV NSVf chunk_size %u\n", size); av_dlog(s, "NSV NSVf file_size %u\n", file_size); nsv->duration = duration = avio_rl32(pb); av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration); strings_size = avio_rl32(pb); table_entries = avio_rl32(pb); table_entries_used = avio_rl32(pb); av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", strings_size, table_entries, table_entries_used); if (pb->eof_reached) return -1; av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb)); if (strings_size > 0) { char *strings; char *p, *endp; char *token, *value; char quote; p = strings = av_mallocz(strings_size + 1); endp = strings + strings_size; avio_read(pb, strings, strings_size); while (p < endp) { while (*p == ' ') p++; if (p >= endp-2) break; token = p; p = strchr(p, '='); if (!p || p >= endp-2) break; *p++ = '\0'; quote = *p++; value = p; p = strchr(p, quote); if (!p || p >= endp) break; *p++ = '\0'; av_dlog(s, "NSV NSVf INFO: %s='%s'\n", token, value); av_metadata_set2(&s->metadata, token, value, 0); } av_free(strings); } if (pb->eof_reached) return -1; av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb)); if (table_entries_used > 0) { int i; nsv->index_entries = table_entries_used; if((unsigned)table_entries_used >= UINT_MAX / sizeof(uint32_t)) return -1; nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t)); for(i=0;i<table_entries_used;i++) nsv->nsvs_file_offset[i] = avio_rl32(pb) + size; if(table_entries > table_entries_used && avio_rl32(pb) == MKTAG('T','O','C','2')) { nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t)); for(i=0;i<table_entries_used;i++) { nsv->nsvs_timestamps[i] = avio_rl32(pb); } } } av_dlog(s, "NSV got index; filepos %"PRId64"\n", avio_tell(pb)); #ifdef DEBUG_DUMP_INDEX #define V(v) ((v<0x20 || v > 127)?'.':v) av_dlog(s, "NSV %d INDEX ENTRIES:\n", table_entries); av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries); for (i = 0; i < table_entries; i++) { unsigned char b[8]; avio_seek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); avio_read(pb, b, 8); av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" "%c%c%c%c%c%c%c%c\n", nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i], b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ); } #undef V #endif avio_seek(pb, nsv->base_offset + size, SEEK_SET); if (pb->eof_reached) return -1; nsv->state = NSV_HAS_READ_NSVF; return 0; } libavformat/nsvdec.c:315: error: Null Dereference pointer `p` last assigned on line 311 could be null and is dereferenced at line 315, column 20. libavformat/nsvdec.c:266:1: start of procedure nsv_parse_NSVf_header() 264. } 265. 266. static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) ^ 267. { 268. NSVContext *nsv = s->priv_data; libavformat/nsvdec.c:268:5: 266. static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) 267. { 268. NSVContext *nsv = s->priv_data; ^ 269. AVIOContext *pb = s->pb; 270. unsigned int av_unused file_size; libavformat/nsvdec.c:269:5: 267. { 268. NSVContext *nsv = s->priv_data; 269. AVIOContext *pb = s->pb; ^ 270. unsigned int av_unused file_size; 271. unsigned int size; libavformat/nsvdec.c:279:5: 277. av_dlog(s, "%s()\n", __FUNCTION__); 278. 279. nsv->state = NSV_UNSYNC; /* in case we fail */ ^ 280. 281. size = avio_rl32(pb); libavformat/nsvdec.c:281:5: 279. nsv->state = NSV_UNSYNC; /* in case we fail */ 280. 281. size = avio_rl32(pb); ^ 282. if (size < 28) 283. return -1; libavformat/aviobuf.c:706:1: start of procedure avio_rl32() 704. } 705. 706. unsigned int avio_rl32(AVIOContext *s) ^ 707. { 708. unsigned int val; libavformat/aviobuf.c:709:5: 707. { 708. unsigned int val; 709. val = avio_rl16(s); ^ 710. val |= avio_rl16(s) << 16; 711. return val; libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:710:5: 708. unsigned int val; 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; ^ 711. return val; 712. } libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:711:5: 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; 711. return val; ^ 712. } 713. libavformat/aviobuf.c:712:1: return from a call to avio_rl32 710. val |= avio_rl16(s) << 16; 711. return val; 712. } ^ 713. 714. uint64_t avio_rl64(AVIOContext *s) libavformat/nsvdec.c:282:9: Taking false branch 280. 281. size = avio_rl32(pb); 282. if (size < 28) ^ 283. return -1; 284. nsv->NSVf_end = size; libavformat/nsvdec.c:284:5: 282. if (size < 28) 283. return -1; 284. nsv->NSVf_end = size; ^ 285. 286. //s->file_size = (uint32_t)avio_rl32(pb); libavformat/nsvdec.c:287:5: 285. 286. //s->file_size = (uint32_t)avio_rl32(pb); 287. file_size = (uint32_t)avio_rl32(pb); ^ 288. av_dlog(s, "NSV NSVf chunk_size %u\n", size); 289. av_dlog(s, "NSV NSVf file_size %u\n", file_size); libavformat/aviobuf.c:706:1: start of procedure avio_rl32() 704. } 705. 706. unsigned int avio_rl32(AVIOContext *s) ^ 707. { 708. unsigned int val; libavformat/aviobuf.c:709:5: 707. { 708. unsigned int val; 709. val = avio_rl16(s); ^ 710. val |= avio_rl16(s) << 16; 711. return val; libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:710:5: 708. unsigned int val; 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; ^ 711. return val; 712. } libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:711:5: 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; 711. return val; ^ 712. } 713. libavformat/aviobuf.c:712:1: return from a call to avio_rl32 710. val |= avio_rl16(s) << 16; 711. return val; 712. } ^ 713. 714. uint64_t avio_rl64(AVIOContext *s) libavformat/nsvdec.c:291:5: 289. av_dlog(s, "NSV NSVf file_size %u\n", file_size); 290. 291. nsv->duration = duration = avio_rl32(pb); /* in ms */ ^ 292. av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration); 293. // XXX: store it in AVStreams libavformat/aviobuf.c:706:1: start of procedure avio_rl32() 704. } 705. 706. unsigned int avio_rl32(AVIOContext *s) ^ 707. { 708. unsigned int val; libavformat/aviobuf.c:709:5: 707. { 708. unsigned int val; 709. val = avio_rl16(s); ^ 710. val |= avio_rl16(s) << 16; 711. return val; libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:710:5: 708. unsigned int val; 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; ^ 711. return val; 712. } libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:711:5: 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; 711. return val; ^ 712. } 713. libavformat/aviobuf.c:712:1: return from a call to avio_rl32 710. val |= avio_rl16(s) << 16; 711. return val; 712. } ^ 713. 714. uint64_t avio_rl64(AVIOContext *s) libavformat/nsvdec.c:295:5: 293. // XXX: store it in AVStreams 294. 295. strings_size = avio_rl32(pb); ^ 296. table_entries = avio_rl32(pb); 297. table_entries_used = avio_rl32(pb); libavformat/aviobuf.c:706:1: start of procedure avio_rl32() 704. } 705. 706. unsigned int avio_rl32(AVIOContext *s) ^ 707. { 708. unsigned int val; libavformat/aviobuf.c:709:5: 707. { 708. unsigned int val; 709. val = avio_rl16(s); ^ 710. val |= avio_rl16(s) << 16; 711. return val; libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:710:5: 708. unsigned int val; 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; ^ 711. return val; 712. } libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:711:5: 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; 711. return val; ^ 712. } 713. libavformat/aviobuf.c:712:1: return from a call to avio_rl32 710. val |= avio_rl16(s) << 16; 711. return val; 712. } ^ 713. 714. uint64_t avio_rl64(AVIOContext *s) libavformat/nsvdec.c:296:5: 294. 295. strings_size = avio_rl32(pb); 296. table_entries = avio_rl32(pb); ^ 297. table_entries_used = avio_rl32(pb); 298. av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", libavformat/aviobuf.c:706:1: start of procedure avio_rl32() 704. } 705. 706. unsigned int avio_rl32(AVIOContext *s) ^ 707. { 708. unsigned int val; libavformat/aviobuf.c:709:5: 707. { 708. unsigned int val; 709. val = avio_rl16(s); ^ 710. val |= avio_rl16(s) << 16; 711. return val; libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:710:5: 708. unsigned int val; 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; ^ 711. return val; 712. } libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:711:5: 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; 711. return val; ^ 712. } 713. libavformat/aviobuf.c:712:1: return from a call to avio_rl32 710. val |= avio_rl16(s) << 16; 711. return val; 712. } ^ 713. 714. uint64_t avio_rl64(AVIOContext *s) libavformat/nsvdec.c:297:5: 295. strings_size = avio_rl32(pb); 296. table_entries = avio_rl32(pb); 297. table_entries_used = avio_rl32(pb); ^ 298. av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", 299. strings_size, table_entries, table_entries_used); libavformat/aviobuf.c:706:1: start of procedure avio_rl32() 704. } 705. 706. unsigned int avio_rl32(AVIOContext *s) ^ 707. { 708. unsigned int val; libavformat/aviobuf.c:709:5: 707. { 708. unsigned int val; 709. val = avio_rl16(s); ^ 710. val |= avio_rl16(s) << 16; 711. return val; libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:710:5: 708. unsigned int val; 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; ^ 711. return val; 712. } libavformat/aviobuf.c:690:1: start of procedure avio_rl16() 688. } 689. 690. unsigned int avio_rl16(AVIOContext *s) ^ 691. { 692. unsigned int val; libavformat/aviobuf.c:693:5: 691. { 692. unsigned int val; 693. val = avio_r8(s); ^ 694. val |= avio_r8(s) << 8; 695. return val; libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:694:5: 692. unsigned int val; 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; ^ 695. return val; 696. } libavformat/aviobuf.c:600:1: start of procedure avio_r8() 598. 599. /* XXX: put an inline version */ 600. int avio_r8(AVIOContext *s) ^ 601. { 602. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:602:9: Taking false branch 600. int avio_r8(AVIOContext *s) 601. { 602. if (s->buf_ptr >= s->buf_end) ^ 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:604:9: Taking true branch 602. if (s->buf_ptr >= s->buf_end) 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) ^ 605. return *s->buf_ptr++; 606. return 0; libavformat/aviobuf.c:605:9: 603. fill_buffer(s); 604. if (s->buf_ptr < s->buf_end) 605. return *s->buf_ptr++; ^ 606. return 0; 607. } libavformat/aviobuf.c:607:1: return from a call to avio_r8 605. return *s->buf_ptr++; 606. return 0; 607. } ^ 608. 609. #if FF_API_OLD_AVIO libavformat/aviobuf.c:695:5: 693. val = avio_r8(s); 694. val |= avio_r8(s) << 8; 695. return val; ^ 696. } 697. libavformat/aviobuf.c:696:1: return from a call to avio_rl16 694. val |= avio_r8(s) << 8; 695. return val; 696. } ^ 697. 698. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:711:5: 709. val = avio_rl16(s); 710. val |= avio_rl16(s) << 16; 711. return val; ^ 712. } 713. libavformat/aviobuf.c:712:1: return from a call to avio_rl32 710. val |= avio_rl16(s) << 16; 711. return val; 712. } ^ 713. 714. uint64_t avio_rl64(AVIOContext *s) libavformat/nsvdec.c:300:9: Taking false branch 298. av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", 299. strings_size, table_entries, table_entries_used); 300. if (pb->eof_reached) ^ 301. return -1; 302. libavformat/nsvdec.c:305:9: Taking true branch 303. av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb)); 304. 305. if (strings_size > 0) { ^ 306. char *strings; /* last byte will be '\0' to play safe with str*() */ 307. char *p, *endp; libavformat/nsvdec.c:311:9: 309. char quote; 310. 311. p = strings = av_mallocz(strings_size + 1); ^ 312. endp = strings + strings_size; 313. avio_read(pb, strings, strings_size); libavutil/mem.c:154:1: start of procedure av_mallocz() 152. } 153. 154. void *av_mallocz(size_t size) ^ 155. { 156. void *ptr = av_malloc(size); libavutil/mem.c:156:5: 154. void *av_mallocz(size_t size) 155. { 156. void *ptr = av_malloc(size); ^ 157. if (ptr) 158. memset(ptr, 0, size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:157:9: Taking false branch 155. { 156. void *ptr = av_malloc(size); 157. if (ptr) ^ 158. memset(ptr, 0, size); 159. return ptr; libavutil/mem.c:159:5: 157. if (ptr) 158. memset(ptr, 0, size); 159. return ptr; ^ 160. } 161. libavutil/mem.c:160:1: return from a call to av_mallocz 158. memset(ptr, 0, size); 159. return ptr; 160. } ^ 161. 162. char *av_strdup(const char *s) libavformat/nsvdec.c:312:9: 310. 311. p = strings = av_mallocz(strings_size + 1); 312. endp = strings + strings_size; ^ 313. avio_read(pb, strings, strings_size); 314. while (p < endp) { libavformat/nsvdec.c:313:9: Skipping avio_read(): empty list of specs 311. p = strings = av_mallocz(strings_size + 1); 312. endp = strings + strings_size; 313. avio_read(pb, strings, strings_size); ^ 314. while (p < endp) { 315. while (*p == ' ') libavformat/nsvdec.c:314:16: Loop condition is true. Entering loop body 312. endp = strings + strings_size; 313. avio_read(pb, strings, strings_size); 314. while (p < endp) { ^ 315. while (*p == ' ') 316. p++; /* strip out spaces */ libavformat/nsvdec.c:315:20: 313. avio_read(pb, strings, strings_size); 314. while (p < endp) { 315. while (*p == ' ') ^ 316. p++; /* strip out spaces */ 317. if (p >= endp-2)
https://github.com/libav/libav/blob/1674bd2abe877b857f1be12b152e4ec496307963/libavformat/nsvdec.c/#L315
d2a_code_trace_data_45551
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; int codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); exit(1); } avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; if(thread_count>1) avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avctx_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avctx_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = CODEC_TYPE_VIDEO; } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO); if (video_codec_name) codec_id = find_codec_or_die(video_codec_name, CODEC_TYPE_VIDEO, 1); video_enc->codec_id = codec_id; codec = avcodec_find_encoder(codec_id); for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(avctx_opts[CODEC_TYPE_VIDEO], opt_names[i], &opt, buf, sizeof(buf)); if(str && (opt->flags & AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) av_set_string(video_enc, opt_names[i], str); } video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; if(codec && codec->supported_framerates){ const AVRational *p= codec->supported_framerates; const AVRational *best=NULL; AVRational best_error= (AVRational){INT_MAX, 1}; for(; p->den!=0; p++){ AVRational error= av_sub_q(fps, *p); if(error.num <0) error.num *= -1; if(av_cmp_q(error, best_error) < 0){ best_error= error; best= p; } } video_enc->time_base.den= best->num; video_enc->time_base.num= best->den; } video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; if(codec && codec->pix_fmts){ const enum PixelFormat *p= codec->pix_fmts; for(; *p!=-1; p++){ if(*p == video_enc->pix_fmt) break; } if(*p == -1) video_enc->pix_fmt = codec->pix_fmts[0]; } if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; video_enc->max_qdiff = video_qdiff; video_enc->thread_count = thread_count; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; video_enc->strict_std_compliance = strict; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; } ffmpeg.c:3123: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `new_video_stream`. ffmpeg.c:3123:5: Call 3121. } 3122. oc = output_files[nb_output_files - 1]; 3123. new_video_stream(oc); ^ 3124. } 3125. ffmpeg.c:2838:1: <LHS trace> 2836. } 2837. 2838. static void new_video_stream(AVFormatContext *oc) ^ 2839. { 2840. AVStream *st; ffmpeg.c:2838:1: Parameter `oc->nb_streams` 2836. } 2837. 2838. static void new_video_stream(AVFormatContext *oc) ^ 2839. { 2840. AVStream *st; ffmpeg.c:2844:10: Call 2842. int codec_id; 2843. 2844. st = av_new_stream(oc, oc->nb_streams); ^ 2845. if (!st) { 2846. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2160:1: Parameter `s->nb_streams` 2158. } 2159. 2160. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2161. { 2162. AVStream *st; ffmpeg.c:2850:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `new_video_stream` 2848. } 2849. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); 2850. bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; ^ 2851. video_bitstream_filters= NULL; 2852.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffmpeg.c/#L2850
d2a_code_trace_data_45552
static int sdp_read_header(AVFormatContext *s) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; if (!ff_network_init()) return AVERROR(EIO); content = av_malloc(SDP_MAX_SIZE); size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; err = ff_sdp_parse(s, content); av_free(content); if (err) goto fail; for (i = 0; i < rt->nb_rtsp_streams; i++) { char namebuf[50]; rtsp_st = rt->rtsp_streams[i]; getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl, rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0); if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: ff_rtsp_close_streams(s); ff_network_close(); return err; } libavformat/rtsp.c:1875: error: Null Dereference pointer `content` last assigned on line 1869 could be null and is dereferenced at line 1875, column 5. libavformat/rtsp.c:1856:1: start of procedure sdp_read_header() 1854. } 1855. 1856. static int sdp_read_header(AVFormatContext *s) ^ 1857. { 1858. RTSPState *rt = s->priv_data; libavformat/rtsp.c:1858:5: 1856. static int sdp_read_header(AVFormatContext *s) 1857. { 1858. RTSPState *rt = s->priv_data; ^ 1859. RTSPStream *rtsp_st; 1860. int size, i, err; libavformat/rtsp.c:1864:10: 1862. char url[1024]; 1863. 1864. if (!ff_network_init()) ^ 1865. return AVERROR(EIO); 1866. libavformat/network.c:124:1: start of procedure ff_network_init() 122. int ff_network_inited_globally; 123. 124. int ff_network_init(void) ^ 125. { 126. #if HAVE_WINSOCK2_H libavformat/network.c:130:10: Taking true branch 128. #endif 129. 130. if (!ff_network_inited_globally) ^ 131. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " 132. "network initialization. Please use " libavformat/network.c:131:9: Skipping av_log(): empty list of specs 129. 130. if (!ff_network_inited_globally) 131. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " ^ 132. "network initialization. Please use " 133. "avformat_network_init(), this will " libavformat/network.c:139:5: 137. return 0; 138. #endif 139. return 1; ^ 140. } 141. libavformat/network.c:140:1: return from a call to ff_network_init 138. #endif 139. return 1; 140. } ^ 141. 142. int ff_network_wait_fd(int fd, int write) libavformat/rtsp.c:1864:10: Taking false branch 1862. char url[1024]; 1863. 1864. if (!ff_network_init()) ^ 1865. return AVERROR(EIO); 1866. libavformat/rtsp.c:1869:5: 1867. /* read the whole sdp file */ 1868. /* XXX: better loading */ 1869. content = av_malloc(SDP_MAX_SIZE); ^ 1870. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1871. if (size <= 0) { libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking true branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(32,size); libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/rtsp.c:1870:5: Skipping avio_read(): empty list of specs 1868. /* XXX: better loading */ 1869. content = av_malloc(SDP_MAX_SIZE); 1870. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); ^ 1871. if (size <= 0) { 1872. av_free(content); libavformat/rtsp.c:1871:9: Taking false branch 1869. content = av_malloc(SDP_MAX_SIZE); 1870. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1871. if (size <= 0) { ^ 1872. av_free(content); 1873. return AVERROR_INVALIDDATA; libavformat/rtsp.c:1875:5: 1873. return AVERROR_INVALIDDATA; 1874. } 1875. content[size] ='\0'; ^ 1876. 1877. err = ff_sdp_parse(s, content);
https://github.com/libav/libav/blob/f1279e286b00e99f343adb51e251f036a3df6f32/libavformat/rtsp.c/#L1875
d2a_code_trace_data_45553
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_key.c:110: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked`. Showing all 45 steps of the trace crypto/dh/dh_key.c:110:16: Call 108. 109. if (dh->flags & DH_FLAG_CACHE_MONT_P) { 110. mont = BN_MONT_CTX_set_locked(&dh->method_mont_p, ^ 111. dh->lock, dh->p, ctx); 112. if (!mont) crypto/bn/bn_mont.c:428:1: Parameter `ctx->stack.depth` 426. } 427. 428. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 429. const BIGNUM *mod, BN_CTX *ctx) 430. { crypto/bn/bn_mont.c:450:10: Call 448. if (ret == NULL) 449. return NULL; 450. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 451. BN_MONT_CTX_free(ret); 452. return NULL; crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268