id stringlengths 25 25 | content stringlengths 649 72.1k | max_stars_repo_path stringlengths 91 133 |
|---|---|---|
d2a_code_trace_data_45254 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
apps/testdsa.h:237: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`.
Showing all 14 steps of the trace
apps/testdsa.h:236:16: Call
234. if ((dsa = DSA_new()) == NULL)
235. return NULL;
236. priv_key = BN_bin2bn(dsa_t.priv, dsa_t.priv_l, NULL);
^
237. pub_key = BN_bin2bn(dsa_t.pub, dsa_t.pub_l, NULL);
238. p = BN_bin2bn(dsa_t.p, dsa_t.p_l, NULL);
crypto/bn/bn_lib.c:407:1: Parameter `*ret->d`
405. }
406.
407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
408. {
409. unsigned int i, m;
apps/testdsa.h:237:15: Call
235. return NULL;
236. priv_key = BN_bin2bn(dsa_t.priv, dsa_t.priv_l, NULL);
237. pub_key = BN_bin2bn(dsa_t.pub, dsa_t.pub_l, NULL);
^
238. p = BN_bin2bn(dsa_t.p, dsa_t.p_l, NULL);
239. q = BN_bin2bn(dsa_t.q, dsa_t.q_l, NULL);
crypto/bn/bn_lib.c:407:1: Parameter `*ret->d`
405. }
406.
407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
408. {
409. unsigned int i, m;
crypto/bn/bn_lib.c:429:9: Call
427. i = ((n - 1) / BN_BYTES) + 1;
428. m = ((n - 1) % (BN_BYTES));
429. if (bn_wexpand(ret, (int)i) == NULL) {
^
430. BN_free(bn);
431. return NULL;
crypto/bn/bn_lib.c:948:1: Parameter `*a->d`
946. }
947.
948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:950:37: Call
948. BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
951. }
952.
crypto/bn/bn_lib.c:284:1: Parameter `*b->d`
282. */
283.
284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
285. {
286. bn_check_top(b);
crypto/bn/bn_lib.c:289:23: Call
287.
288. if (words > b->dmax) {
289. BN_ULONG *a = bn_expand_internal(b, words);
^
290. if (!a)
291. return NULL;
crypto/bn/bn_lib.c:246:1: <Offset trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `*b->d`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`
269. assert(b->top <= words);
270. if (b->top > 0)
271. memcpy(a, b->d, sizeof(*a) * b->top);
^
272.
273. return a;
| https://github.com/openssl/openssl/blob/2234212c3dde887e0b7fa08277d035cd132e2cce/crypto/bn/bn_lib.c/#L271 |
d2a_code_trace_data_45255 | 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_upstream.c:1207: error: Buffer Overrun L2
Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`.
src/http/ngx_http_upstream.c:1207:13: Unknown value from: __errno_location
1205. if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
1206. if (ngx_tcp_push(c->fd) == NGX_ERROR) {
1207. ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
^
1208. ngx_tcp_push_n " failed");
1209. ngx_http_upstream_finalize_request(r, u,
src/http/ngx_http_upstream.c:1207:13: Call
1205. if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
1206. if (ngx_tcp_push(c->fd) == NGX_ERROR) {
1207. ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
^
1208. ngx_tcp_push_n " failed");
1209. ngx_http_upstream_finalize_request(r, u,
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_45256 | int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
if (allocbytes != NULL)
*allocbytes = WPACKET_get_curr(pkt);
return 1;
}
ssl/statem/extensions_clnt.c:122: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`.
Showing all 12 steps of the trace
ssl/statem/extensions_clnt.c:121:10: Call
119. s->max_early_data = s->session->ext.max_early_data;
120.
121. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_early_data)
^
122. || !WPACKET_start_sub_packet_u16(pkt)
123. || !WPACKET_close(pkt)) {
ssl/packet.c:312:1: Parameter `pkt->buf->length`
310. }
311.
312. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
313. {
314. unsigned char *data;
ssl/statem/extensions_clnt.c:122:17: Call
120.
121. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_early_data)
122. || !WPACKET_start_sub_packet_u16(pkt)
^
123. || !WPACKET_close(pkt)) {
124. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA, ERR_R_INTERNAL_ERROR);
ssl/packet.c:275:1: Parameter `pkt->written`
273. }
274.
275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
276. {
277. WPACKET_SUB *sub;
ssl/packet.c:299:10: Call
297. }
298.
299. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
300. return 0;
301. /* 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:39:1: <LHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `pkt->buf->length`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: <RHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `len`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`
47. return 0;
48.
49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
^
50. size_t newlen;
51. size_t reflen;
| https://github.com/openssl/openssl/blob/538bea6c8184670a8d1608ef288a4e1813dcefa6/ssl/packet.c/#L49 |
d2a_code_trace_data_45257 | int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len)
{
int al,i,j,n,ret;
SSL3_RECORD *rr;
void (*cb)()=NULL;
BIO *bio;
if (s->s3->rbuf.buf == NULL)
if (!ssl3_setup_buffers(s))
return(-1);
if ((type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type)
{
SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_INTERNAL_ERROR);
return -1;
}
if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0))
{
unsigned char *src = s->s3->handshake_fragment;
unsigned char *dst = buf;
n = 0;
while ((len > 0) && (s->s3->handshake_fragment_len > 0))
{
*dst++ = *src++;
len--; s->s3->handshake_fragment_len--;
n++;
}
for (i = 0; i < s->s3->handshake_fragment_len; i++)
s->s3->handshake_fragment[i] = *src++;
ssl3_finish_mac(s, buf, n);
return n;
}
if (!s->in_handshake && SSL_in_init(s))
{
i=s->handshake_func(s);
if (i < 0) return(i);
if (i == 0)
{
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);
return(-1);
}
}
start:
s->rwstate=SSL_NOTHING;
rr = &(s->s3->rrec);
if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY))
{
ret=ssl3_get_record(s);
if (ret <= 0) return(ret);
}
if (s->s3->change_cipher_spec
&& (rr->type != SSL3_RT_HANDSHAKE))
{
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED);
goto err;
}
if (s->shutdown & SSL_RECEIVED_SHUTDOWN)
{
rr->length=0;
s->rwstate=SSL_NOTHING;
return(0);
}
if (type == rr->type)
{
if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) &&
(s->enc_read_ctx == NULL))
{
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE);
goto f_err;
}
if (len <= 0) return(len);
if ((unsigned int)len > rr->length)
n=rr->length;
else
n=len;
memcpy(buf,&(rr->data[rr->off]),(unsigned int)n);
rr->length-=n;
rr->off+=n;
if (rr->length == 0)
{
s->rstate=SSL_ST_READ_HEADER;
rr->off=0;
}
if (type == SSL3_RT_HANDSHAKE)
ssl3_finish_mac(s,buf,n);
return(n);
}
{
int dest_maxlen = 0;
unsigned char *dest;
int *dest_len;
if (rr->type == SSL3_RT_HANDSHAKE)
{
dest_maxlen = sizeof s->s3->handshake_fragment;
dest = s->s3->handshake_fragment;
dest_len = &s->s3->handshake_fragment_len;
}
else if (rr->type == SSL3_RT_ALERT)
{
dest_maxlen = sizeof s->s3->alert_fragment;
dest = s->s3->alert_fragment;
dest_len = &s->s3->alert_fragment_len;
}
if (dest_maxlen > 0)
{
n = dest_maxlen - *dest_len;
if (rr->length < n)
n = rr->length;
while (n-- > 0)
{
dest[(*dest_len)++] = rr->data[rr->off++];
rr->length--;
}
if (*dest_len < dest_maxlen)
goto start;
}
}
if ((!s->server) &&
(s->s3->handshake_fragment_len >= 4) &&
(s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) &&
(s->session != NULL) && (s->session->cipher != NULL))
{
s->s3->handshake_fragment_len = 0;
if ((s->s3->handshake_fragment[1] != 0) ||
(s->s3->handshake_fragment[2] != 0) ||
(s->s3->handshake_fragment[3] != 0))
{
al=SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST);
goto err;
}
if (SSL_is_init_finished(s) &&
!(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) &&
!s->s3->renegotiate)
{
ssl3_renegotiate(s);
if (ssl3_renegotiate_check(s))
{
n=s->handshake_func(s);
if (n < 0) return(n);
if (n == 0)
{
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);
return(-1);
}
}
}
goto start;
}
if (s->s3->alert_fragment_len >= 2)
{
i = s->s3->alert_fragment[0];
n = s->s3->alert_fragment[1];
s->s3->alert_fragment_len = 0;
if (s->info_callback != NULL)
cb=s->info_callback;
else if (s->ctx->info_callback != NULL)
cb=s->ctx->info_callback;
if (cb != NULL)
{
j=(i<<8)|n;
cb(s,SSL_CB_READ_ALERT,j);
}
if (i == 1)
{
s->s3->warn_alert=n;
if (n == SSL_AD_CLOSE_NOTIFY)
{
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
return(0);
}
}
else if (i == 2)
{
char tmp[16];
s->rwstate=SSL_NOTHING;
s->s3->fatal_alert=n;
SSLerr(SSL_F_SSL3_READ_BYTES,
SSL_AD_REASON_OFFSET+n);
sprintf(tmp,"%d",n);
ERR_add_error_data(2,"SSL alert number ",tmp);
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
SSL_CTX_remove_session(s->ctx,s->session);
return(0);
}
else
{
al=SSL_AD_ILLEGAL_PARAMETER;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE);
goto f_err;
}
goto start;
}
if (s->shutdown & SSL_SENT_SHUTDOWN)
{
s->rwstate=SSL_NOTHING;
rr->length=0;
return(0);
}
if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC)
{
if ( (rr->length != 1) || (rr->off != 0) ||
(rr->data[0] != SSL3_MT_CCS))
{
i=SSL_AD_ILLEGAL_PARAMETER;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC);
goto err;
}
rr->length=0;
s->s3->change_cipher_spec=1;
if (!do_change_cipher_spec(s))
goto err;
else
goto start;
}
if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake)
{
if (((s->state&SSL_ST_MASK) == SSL_ST_OK) &&
!(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS))
{
s->state=SSL_ST_BEFORE|(s->server)
?SSL_ST_ACCEPT
:SSL_ST_CONNECT;
s->new_session=1;
}
n=s->handshake_func(s);
if (n < 0) return(n);
if (n == 0)
{
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);
return(-1);
}
s->rwstate=SSL_READING;
bio=SSL_get_rbio(s);
BIO_clear_retry_flags(bio);
BIO_set_retry_read(bio);
return(-1);
}
switch (rr->type)
{
default:
#ifndef NO_TLS
if (s->version == TLS1_VERSION)
{
goto start;
}
#endif
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD);
goto f_err;
case SSL3_RT_CHANGE_CIPHER_SPEC:
case SSL3_RT_ALERT:
case SSL3_RT_HANDSHAKE:
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_INTERNAL_ERROR);
goto f_err;
case SSL3_RT_APPLICATION_DATA:
if (s->s3->in_read_app_data &&
(s->s3->total_renegotiations != 0) &&
((
(s->state & SSL_ST_CONNECT) &&
(s->state >= SSL3_ST_CW_CLNT_HELLO_A) &&
(s->state <= SSL3_ST_CR_SRVR_HELLO_A)
) || (
(s->state & SSL_ST_ACCEPT) &&
(s->state <= SSL3_ST_SW_HELLO_REQ_A) &&
(s->state >= SSL3_ST_SR_CLNT_HELLO_A)
)
))
{
s->s3->in_read_app_data=0;
return(-1);
}
else
{
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD);
goto f_err;
}
}
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
err:
return(-1);
}
ssl/s3_pkt.c:856: error: UNINITIALIZED_VALUE
The value read from *dest_len was never initialized.
Showing all 1 steps of the trace
ssl/s3_pkt.c:856:4:
854. if (dest_maxlen > 0)
855. {
856. > n = dest_maxlen - *dest_len; /* available space in 'dest' */
857. if (rr->length < n)
858. n = rr->length; /* available bytes */
| https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/ssl/s3_pkt.c/#L856 |
d2a_code_trace_data_45258 | 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:1162: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1162:9:
1160. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
1161. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
1162. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
^
1163. }else{
1164. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1162 |
d2a_code_trace_data_45259 | 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];
}
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;
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);
return NGX_OK;
}
src/http/ngx_http_upstream.c:3362: error: Buffer Overrun L3
Offset: [-1, +oo] Size: [1, +oo] by call to `ngx_http_add_variable`.
src/http/ngx_http_upstream.c:3362:15: Call
3360.
3361. for (v = ngx_http_upstream_vars; v->name.len; v++) {
3362. var = ngx_http_add_variable(cf, &v->name, v->flags);
^
3363. if (var == NULL) {
3364. return NGX_ERROR;
src/http/ngx_http_variables.c:257:1: Parameter `name->len`
255.
256.
257. ngx_http_variable_t *
^
258. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)
259. {
src/http/ngx_http_upstream.c:3362:15: Call
3360.
3361. for (v = ngx_http_upstream_vars; v->name.len; v++) {
3362. var = ngx_http_add_variable(cf, &v->name, v->flags);
^
3363. if (var == NULL) {
3364. return NGX_ERROR;
src/http/ngx_http_variables.c:257:1: Parameter `name->len`
255.
256.
257. ngx_http_variable_t *
^
258. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)
259. {
src/http/ngx_http_variables.c:292:5: Assignment
290. }
291.
292. v->name.len = name->len;
^
293. v->name.data = ngx_pnalloc(cf->pool, name->len);
294. if (v->name.data == NULL) {
src/http/ngx_http_variables.c:306:10: Call
304. v->index = 0;
305.
306. rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0);
^
307.
308. if (rc == NGX_ERROR) {
src/core/ngx_hash.c:713:1: <Offset trace>
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/core/ngx_hash.c:713:1: Parameter `key->len`
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/core/ngx_hash.c:713:1: <Length trace>
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/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/core/ngx_hash.c:760:17: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `ngx_http_add_variable`
758. }
759.
760. if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
^
761. skip = 0;
762. last -= 2;
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_hash.c/#L760 |
d2a_code_trace_data_45260 | 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: [304+min(0, `c->synth_buf_offset[*]`), 305+max(511, `c->synth_buf_offset[*]`)] (⇐ [48+min(0, `c->synth_buf_offset[*]`), 49+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:898:5: Assignment
896. p = synth_buf + 16;
897. SUM8(sum, +=, w, p);
898. p = synth_buf + 48;
^
899. SUM8(sum, -=, w + 32, p);
900. *samples = round_sample(&sum);
libavcodec/mpegaudiodec.c:899:5: Array access: Offset: [304+min(0, c->synth_buf_offset[*]), 305+max(511, c->synth_buf_offset[*])] (⇐ [48+min(0, c->synth_buf_offset[*]), 49+max(511, c->synth_buf_offset[*])] + 256) Size: 2 by call to `ff_mpa_synth_filter`
897. SUM8(sum, +=, w, p);
898. p = synth_buf + 48;
899. SUM8(sum, -=, w + 32, p);
^
900. *samples = round_sample(&sum);
901. samples += incr;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L899 |
d2a_code_trace_data_45261 | static size_t kat_nonce(RAND_DRBG *drbg, unsigned char **pout,
int entropy, size_t min_len, size_t max_len)
{
TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
t->noncecnt++;
*pout = (unsigned char *)t->nonce;
return t->noncelen;
}
test/drbgtest.c:160: error: NULL_DEREFERENCE
pointer `t` last assigned on line 158 could be null and is dereferenced at line 160, column 5.
Showing all 10 steps of the trace
test/drbgtest.c:155:1: start of procedure kat_nonce()
153. }
154.
155. > static size_t kat_nonce(RAND_DRBG *drbg, unsigned char **pout,
156. int entropy, size_t min_len, size_t max_len)
157. {
test/drbgtest.c:158:5:
156. int entropy, size_t min_len, size_t max_len)
157. {
158. > TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
159.
160. t->noncecnt++;
crypto/rand/drbg_lib.c:1108:1: start of procedure RAND_DRBG_get_ex_data()
1106. }
1107.
1108. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
1109. {
1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx);
crypto/rand/drbg_lib.c:1110:5:
1108. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
1109. {
1110. > return CRYPTO_get_ex_data(&drbg->ex_data, idx);
1111. }
1112.
crypto/ex_data.c:458:1: start of procedure CRYPTO_get_ex_data()
456. * particular index in the class used by this variable
457. */
458. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
459. {
460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:460:9: Taking true branch
458. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
459. {
460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
461. return NULL;
462. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:461:9:
459. {
460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
461. > return NULL;
462. return sk_void_value(ad->sk, idx);
463. }
crypto/ex_data.c:463:1: return from a call to CRYPTO_get_ex_data
461. return NULL;
462. return sk_void_value(ad->sk, idx);
463. > }
464.
465. OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad)
crypto/rand/drbg_lib.c:1111:1: return from a call to RAND_DRBG_get_ex_data
1109. {
1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx);
1111. > }
1112.
1113.
test/drbgtest.c:160:5:
158. TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
159.
160. > t->noncecnt++;
161. *pout = (unsigned char *)t->nonce;
162. return t->noncelen;
| https://github.com/openssl/openssl/blob/6b3d0423528b049d04b299a8588a32d5c1224717/test/drbgtest.c/#L160 |
d2a_code_trace_data_45262 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max)
{
const unsigned char *p = *pp;
unsigned long ret = 0;
int i;
if (max-- < 1)
return 0;
if (*p == 0x80) {
*inf = 1;
p++;
} else {
*inf = 0;
i = *p & 0x7f;
if (*p++ & 0x80) {
if (max < i + 1)
return 0;
while (i > 0 && *p == 0) {
p++;
i--;
}
if (i > (int)sizeof(long))
return 0;
while (i > 0) {
ret <<= 8;
ret |= *p++;
i--;
}
if (ret > LONG_MAX)
return 0;
} else
ret = i;
}
*pp = p;
*rl = (long)ret;
return 1;
}
crypto/pem/pem_pkey.c:216: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, +oo] by call to `d2i_DHxparams`.
Showing all 29 steps of the trace
crypto/pem/pem_pkey.c:211:10: Call
209. DH *ret = NULL;
210.
211. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_DHPARAMS, bp, cb, u))
^
212. return NULL;
213. p = data;
crypto/pem/pem_lib.c:280:1: Parameter `**pdata`
278. }
279.
280. > int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,
281. const char *name, BIO *bp, pem_password_cb *cb,
282. void *u) {
crypto/pem/pem_lib.c:283:12: Call
281. const char *name, BIO *bp, pem_password_cb *cb,
282. void *u) {
283. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u,
^
284. PEM_FLAG_EAY_COMPATIBLE);
285. }
crypto/pem/pem_lib.c:237:1: Parameter `**pdata`
235. }
236.
237. > static int pem_bytes_read_bio_flags(unsigned char **pdata, long *plen,
238. char **pnm, const char *name, BIO *bp,
239. pem_password_cb *cb, void *u,
crypto/pem/pem_pkey.c:213:5: Assignment
211. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_DHPARAMS, bp, cb, u))
212. return NULL;
213. p = data;
^
214.
215. if (strcmp(nm, PEM_STRING_DHXPARAMS) == 0)
crypto/pem/pem_pkey.c:216:15: Call
214.
215. if (strcmp(nm, PEM_STRING_DHXPARAMS) == 0)
216. ret = d2i_DHxparams(x, &p, len);
^
217. else
218. ret = d2i_DHparams(x, &p, len);
crypto/dh/dh_asn1.c:81:1: Parameter `**pp`
79. /* Application public function: read in X9.42 DH parameters into DH structure */
80.
81. > DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length)
82. {
83. int_dhx942_dh *dhx = NULL;
crypto/dh/dh_asn1.c:88:11: Call
86. if (dh == NULL)
87. return NULL;
88. dhx = d2i_int_dhx(NULL, pp, length);
^
89. if (dhx == NULL) {
90. DH_free(dh);
crypto/dh/dh_asn1.c:77:1: Parameter `**in`
75. int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp);
76.
77. > IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(int_dhx942_dh, DHxparams, int_dhx)
78.
79. /* Application public function: read in X9.42 DH parameters into DH structure */
crypto/dh/dh_asn1.c:77:1: Call
75. int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp);
76.
77. > IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(int_dhx942_dh, DHxparams, int_dhx)
78.
79. /* Application public function: read in X9.42 DH parameters into DH structure */
crypto/asn1/tasn_dec.c:95:1: Parameter `**in`
93. */
94.
95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
96. const unsigned char **in, long len,
97. const ASN1_ITEM *it)
crypto/asn1/tasn_dec.c:104:9: Call
102. pval = &ptmpval;
103. asn1_tlc_clear_nc(&c);
104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
^
105. return *pval;
106. return NULL;
crypto/asn1/tasn_dec.c:109:1: Parameter `**in`
107. }
108.
109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
110. const ASN1_ITEM *it,
111. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:114:10: Call
112. {
113. int rv;
114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx);
^
115. if (rv <= 0)
116. ASN1_item_ex_free(pval, it);
crypto/asn1/tasn_dec.c:125:1: Parameter `**in`
123. */
124.
125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
126. long len, const ASN1_ITEM *it,
127. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:169:9: Assignment
167.
168. case ASN1_ITYPE_MSTRING:
169. p = *in;
^
170. /* Just read in tag and class */
171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
crypto/asn1/tasn_dec.c:171:15: Call
169. p = *in;
170. /* Just read in tag and class */
171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
^
172. &p, len, -1, 0, 1, ctx);
173. if (!ret) {
crypto/asn1/tasn_dec.c:1060:1: Parameter `**in`
1058. */
1059.
1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
1061. char *inf, char *cst,
1062. const unsigned char **in, long len,
crypto/asn1/tasn_dec.c:1069:5: Assignment
1067. long plen;
1068. const unsigned char *p, *q;
1069. p = *in;
^
1070. q = p;
1071.
crypto/asn1/tasn_dec.c:1079:13: Call
1077. p += ctx->hdrlen;
1078. } else {
1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
^
1080. if (ctx) {
1081. ctx->ret = i;
crypto/asn1/asn1_lib.c:44:1: Parameter `**pp`
42. }
43.
44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
45. int *pclass, long omax)
46. {
crypto/asn1/asn1_lib.c:49:5: Assignment
47. int i, ret;
48. long l;
49. const unsigned char *p = *pp;
^
50. int tag, xclass, inf;
51. long max = omax;
crypto/asn1/asn1_lib.c:78:9: Assignment
76. } else {
77. tag = i;
78. p++;
^
79. if (--max == 0)
80. goto err;
crypto/asn1/asn1_lib.c:84:10: Call
82. *ptag = tag;
83. *pclass = xclass;
84. if (!asn1_get_length(&p, &inf, plength, max))
^
85. goto err;
86.
crypto/asn1/asn1_lib.c:112:1: <Length trace>
110. * are stored most significant digit first.
111. */
112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
113. long max)
114. {
crypto/asn1/asn1_lib.c:112:1: Parameter `**pp`
110. * are stored most significant digit first.
111. */
112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
113. long max)
114. {
crypto/asn1/asn1_lib.c:115:5: Assignment
113. long max)
114. {
115. const unsigned char *p = *pp;
^
116. unsigned long ret = 0;
117. int i;
crypto/asn1/asn1_lib.c:127:14: Assignment
125. *inf = 0;
126. i = *p & 0x7f;
127. if (*p++ & 0x80) {
^
128. if (max < i + 1)
129. return 0;
crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `d2i_DHxparams`
129. return 0;
130. /* Skip leading zeroes */
131. while (i > 0 && *p == 0) {
^
132. p++;
133. i--;
| https://github.com/openssl/openssl/blob/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/asn1/asn1_lib.c/#L131 |
d2a_code_trace_data_45263 | static void gcm_init_4bit(u128 Htable[16], u64 H[2])
{
u128 V;
#if defined(OPENSSL_SMALL_FOOTPRINT)
int i;
#endif
#define REDUCE(V) do { \
if (sizeof(size_t)==8) { \
u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \
V.lo = (V.hi<<63)|(V.lo>>1); \
V.hi = (V.hi>>1 )^T; \
} \
else { \
u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \
V.lo = (V.hi<<63)|(V.lo>>1); \
V.hi = (V.hi>>1 )^((u64)T<<32); \
} \
} while(0)
Htable[0].hi = 0;
Htable[0].lo = 0;
V.hi = H[0];
V.lo = H[1];
#if defined(OPENSSL_SMALL_FOOTPRINT)
for (Htable[8]=V, i=4; i>0; i>>=1) {
REDUCE(V);
Htable[i] = V;
}
for (i=2; i<16; i<<=1) {
u128 *Hi = Htable+i;
int j;
for (V=*Hi, j=1; j<i; ++j) {
Hi[j].hi = V.hi^Htable[j].hi;
Hi[j].lo = V.lo^Htable[j].lo;
}
}
#else
Htable[8] = V;
REDUCE(V);
Htable[4] = V;
REDUCE(V);
Htable[2] = V;
REDUCE(V);
Htable[1] = V;
Htable[3].hi = V.hi^Htable[2].hi, Htable[3].lo = V.lo^Htable[2].lo;
V=Htable[4];
Htable[5].hi = V.hi^Htable[1].hi, Htable[5].lo = V.lo^Htable[1].lo;
Htable[6].hi = V.hi^Htable[2].hi, Htable[6].lo = V.lo^Htable[2].lo;
Htable[7].hi = V.hi^Htable[3].hi, Htable[7].lo = V.lo^Htable[3].lo;
V=Htable[8];
Htable[9].hi = V.hi^Htable[1].hi, Htable[9].lo = V.lo^Htable[1].lo;
Htable[10].hi = V.hi^Htable[2].hi, Htable[10].lo = V.lo^Htable[2].lo;
Htable[11].hi = V.hi^Htable[3].hi, Htable[11].lo = V.lo^Htable[3].lo;
Htable[12].hi = V.hi^Htable[4].hi, Htable[12].lo = V.lo^Htable[4].lo;
Htable[13].hi = V.hi^Htable[5].hi, Htable[13].lo = V.lo^Htable[5].lo;
Htable[14].hi = V.hi^Htable[6].hi, Htable[14].lo = V.lo^Htable[6].lo;
Htable[15].hi = V.hi^Htable[7].hi, Htable[15].lo = V.lo^Htable[7].lo;
#endif
#if defined(GHASH_ASM) && (defined(__arm__) || defined(__arm))
{
int j;
const union { long one; char little; } is_endian = {1};
if (is_endian.little)
for (j=0;j<16;++j) {
V = Htable[j];
Htable[j].hi = V.lo;
Htable[j].lo = V.hi;
}
else
for (j=0;j<16;++j) {
V = Htable[j];
Htable[j].hi = V.lo<<32|V.lo>>32;
Htable[j].lo = V.hi<<32|V.hi>>32;
}
}
#endif
#undef REDUCE
}
crypto/modes/gcm128.c:596: error: INTEGER_OVERFLOW_L2
(0 - [0, 1]):unsigned64 by call to `gcm_init_4bit`.
Showing all 5 steps of the trace
crypto/modes/gcm128.c:596:2: Call
594. gcm_init_8bit(ctx->Htable,ctx->H.u);
595. #elif TABLE_BITS==4
596. gcm_init_4bit(ctx->Htable,ctx->H.u);
^
597. #endif
598. }
crypto/modes/gcm128.c:235:1: <RHS trace>
233. #elif TABLE_BITS==4
234.
235. > static void gcm_init_4bit(u128 Htable[16], u64 H[2])
236. {
237. u128 V;
crypto/modes/gcm128.c:235:1: Parameter `*H`
233. #elif TABLE_BITS==4
234.
235. > static void gcm_init_4bit(u128 Htable[16], u64 H[2])
236. {
237. u128 V;
crypto/modes/gcm128.c:257:2: Assignment
255. Htable[0].lo = 0;
256. V.hi = H[0];
257. V.lo = H[1];
^
258.
259. #if defined(OPENSSL_SMALL_FOOTPRINT)
crypto/modes/gcm128.c:275:2: Binary operation: (0 - [0, 1]):unsigned64 by call to `gcm_init_4bit`
273. #else
274. Htable[8] = V;
275. REDUCE(V);
^
276. Htable[4] = V;
277. REDUCE(V);
| https://github.com/openssl/openssl/blob/ea7239cf15b7eeb8555db5b7801e6da7406566ea/crypto/modes/gcm128.c/#L275 |
d2a_code_trace_data_45264 | int ssl3_cbc_remove_padding(SSL3_RECORD *rec,
size_t block_size, size_t mac_size)
{
size_t padding_length;
size_t good;
const size_t overhead = 1 + mac_size;
if (overhead > rec->length)
return 0;
padding_length = rec->data[rec->length - 1];
good = constant_time_ge_s(rec->length, padding_length + overhead);
good &= constant_time_ge_s(block_size, padding_length + 1);
rec->length -= good & (padding_length + 1);
return constant_time_select_int_s(good, 1, -1);
}
ssl/record/ssl3_record.c:649: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `*inrecs->data` + 1]):unsigned64 by call to `ssl3_cbc_remove_padding`.
Showing all 8 steps of the trace
ssl/record/ssl3_record.c:578:1: Parameter `*inrecs->data`
576. * occurred.
577. */
578. > int ssl3_enc(SSL *s, SSL3_RECORD *inrecs, size_t n_recs, int send)
579. {
580. SSL3_RECORD *rec;
ssl/record/ssl3_record.c:649:20: Call
647. }
648. if ((bs != 1) && !send)
649. return ssl3_cbc_remove_padding(rec, bs, mac_size);
^
650. }
651. return (1);
ssl/record/ssl3_record.c:1111:1: <LHS trace>
1109. * -1: otherwise.
1110. */
1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec,
1112. size_t block_size, size_t mac_size)
1113. {
ssl/record/ssl3_record.c:1111:1: Parameter `rec->length`
1109. * -1: otherwise.
1110. */
1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec,
1112. size_t block_size, size_t mac_size)
1113. {
ssl/record/ssl3_record.c:1111:1: <RHS trace>
1109. * -1: otherwise.
1110. */
1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec,
1112. size_t block_size, size_t mac_size)
1113. {
ssl/record/ssl3_record.c:1111:1: Parameter `*rec->data`
1109. * -1: otherwise.
1110. */
1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec,
1112. size_t block_size, size_t mac_size)
1113. {
ssl/record/ssl3_record.c:1124:5: Assignment
1122. return 0;
1123.
1124. padding_length = rec->data[rec->length - 1];
^
1125. good = constant_time_ge_s(rec->length, padding_length + overhead);
1126. /* SSLv3 requires that the padding is minimal. */
ssl/record/ssl3_record.c:1128:5: Binary operation: ([0, +oo] - [0, *inrecs->data + 1]):unsigned64 by call to `ssl3_cbc_remove_padding`
1126. /* SSLv3 requires that the padding is minimal. */
1127. good &= constant_time_ge_s(block_size, padding_length + 1);
1128. rec->length -= good & (padding_length + 1);
^
1129. return constant_time_select_int_s(good, 1, -1);
1130. }
| https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1128 |
d2a_code_trace_data_45265 | static void
cpStripToTile(uint8* out, uint8* in,
uint32 rows, uint32 cols, int outskew, int inskew)
{
while (rows-- > 0) {
uint32 j = cols;
while (j-- > 0)
*out++ = *in++;
out += outskew;
in += inskew;
}
}
tools/tiffcp.c:1071: error: Integer Overflow L2
([0, `rows`] - 1):unsigned32.
tools/tiffcp.c:1067:1: <LHS trace>
1065. }
1066.
1067. static void
^
1068. cpStripToTile(uint8* out, uint8* in,
1069. uint32 rows, uint32 cols, int outskew, int inskew)
tools/tiffcp.c:1067:1: Parameter `rows`
1065. }
1066.
1067. static void
^
1068. cpStripToTile(uint8* out, uint8* in,
1069. uint32 rows, uint32 cols, int outskew, int inskew)
tools/tiffcp.c:1071:9: Binary operation: ([0, rows] - 1):unsigned32
1069. uint32 rows, uint32 cols, int outskew, int inskew)
1070. {
1071. while (rows-- > 0) {
^
1072. uint32 j = cols;
1073. while (j-- > 0)
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiffcp.c/#L1071 |
d2a_code_trace_data_45266 | void CRYPTO_free(void *str)
{
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0);
free(str);
CRYPTO_mem_debug_free(str, 1);
} else {
free(str);
}
#else
free(str);
#endif
}
crypto/pkcs12/p12_crt.c:288: error: USE_AFTER_FREE
call to `sk_PKCS7_free()` eventually accesses memory that was invalidated by call to `free()` on line 281 indirectly during the call to `sk_PKCS7_push()`.
Showing all 22 steps of the trace
crypto/pkcs12/p12_crt.c:260:19: invalidation part of the trace starts here
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:260:19: passed as argument to `sk_PKCS7_new_null`
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:260:19: return from call to `sk_PKCS7_new_null`
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:260:9: assigned
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:281:10: when calling `sk_PKCS7_push` here
279. goto err;
280.
281. if (!sk_PKCS7_push(*psafes, p7))
^
282. goto err;
283.
include/openssl/pkcs7.h:200:1: parameter `sk` of sk_PKCS7_push
198. } PKCS7;
199.
200. > DEFINE_STACK_OF(PKCS7)
201.
202. # define PKCS7_OP_SET_DETACHED_SIGNATURE 1
include/openssl/pkcs7.h:200:1: when calling `sk_push` here
198. } PKCS7;
199.
200. > DEFINE_STACK_OF(PKCS7)
201.
202. # define PKCS7_OP_SET_DETACHED_SIGNATURE 1
crypto/stack/stack.c:259:1: parameter `st` of 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:13: when calling `sk_insert` here
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: parameter `st` of sk_insert
165. }
166.
167. > int sk_insert(_STACK *st, void *data, int loc)
168. {
169. char **s;
crypto/stack/stack.c:174:13: when calling `CRYPTO_realloc` here
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);
176. if (s == NULL)
crypto/mem.c:166:1: parameter `str` of CRYPTO_realloc
164. }
165.
166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
crypto/mem.c:172:9: when calling `CRYPTO_free` here
170.
171. if (num == 0) {
172. CRYPTO_free(str);
^
173. return NULL;
174. }
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: was invalidated by call to `free()`
243. }
244. #else
245. free(str);
^
246. #endif
247. }
crypto/pkcs12/p12_crt.c:260:19: use-after-lifetime part of the trace starts here
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:260:19: passed as argument to `sk_PKCS7_new_null`
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:260:19: return from call to `sk_PKCS7_new_null`
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:260:9: assigned
258.
259. if (!*psafes) {
260. *psafes = sk_PKCS7_new_null();
^
261. if (!*psafes)
262. return 0;
crypto/pkcs12/p12_crt.c:288:9: when calling `sk_PKCS7_free` here
286. err:
287. if (free_safes) {
288. sk_PKCS7_free(*psafes);
^
289. *psafes = NULL;
290. }
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: invalid access occurs here
243. }
244. #else
245. free(str);
^
246. #endif
247. }
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245 |
d2a_code_trace_data_45267 | static unsigned constant_time_ge(unsigned a, unsigned b)
{
a -= b;
return DUPLICATE_MSB_TO_ALL(~a);
}
ssl/d1_pkt.c:314: error: INTEGER_OVERFLOW_L2
([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record`.
Showing all 11 steps of the trace
ssl/d1_pkt.c:298:1: Parameter `s->s3->rrec.length`
296. &((s)->d1->processed_rcds))
297.
298. > static int
299. dtls1_process_buffered_records(SSL *s)
300. {
ssl/d1_pkt.c:314:20: Call
312. {
313. dtls1_get_unprocessed_record(s);
314. if ( ! dtls1_process_record(s))
^
315. return(0);
316. dtls1_buffer_record(s, &(s->d1->processed_rcds),
ssl/d1_pkt.c:375:1: Parameter `s->s3->rrec.length`
373. #endif
374.
375. > static int
376. dtls1_process_record(SSL *s)
377. {
ssl/d1_pkt.c:468:4: Call
466. * */
467. mac = mac_tmp;
468. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size);
^
469. rr->length -= mac_size;
470. }
ssl/s3_cbc.c:251:1: Parameter `md_size`
249. #define CBC_MAC_ROTATE_IN_PLACE
250.
251. > void ssl3_cbc_copy_mac(unsigned char* out,
252. const SSL3_RECORD *rec,
253. unsigned md_size)
ssl/s3_cbc.c:297:29: Call
295. {
296. unsigned char mac_started = constant_time_ge(i, mac_start);
297. unsigned char mac_ended = constant_time_ge(i, mac_end);
^
298. unsigned char b = rec->data[i];
299. rotated_mac[j++] |= b & mac_started & ~mac_ended;
ssl/s3_cbc.c:87:1: <LHS trace>
85.
86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */
87. > static unsigned constant_time_ge(unsigned a, unsigned b)
88. {
89. a -= b;
ssl/s3_cbc.c:87:1: Parameter `a`
85.
86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */
87. > static unsigned constant_time_ge(unsigned a, unsigned b)
88. {
89. a -= b;
ssl/s3_cbc.c:87:1: <RHS trace>
85.
86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */
87. > static unsigned constant_time_ge(unsigned a, unsigned b)
88. {
89. a -= b;
ssl/s3_cbc.c:87:1: Parameter `b`
85.
86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */
87. > static unsigned constant_time_ge(unsigned a, unsigned b)
88. {
89. a -= b;
ssl/s3_cbc.c:89:2: Binary operation: ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record`
87. static unsigned constant_time_ge(unsigned a, unsigned b)
88. {
89. a -= b;
^
90. return DUPLICATE_MSB_TO_ALL(~a);
91. }
| https://github.com/openssl/openssl/blob/f93a41877d8d7a287debb7c63d7b646abaaf269c/ssl/s3_cbc.c/#L89 |
d2a_code_trace_data_45268 | int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
if (!ossl_assert(pkt->subs != NULL && len != 0))
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
if (allocbytes != NULL)
*allocbytes = WPACKET_get_curr(pkt);
return 1;
}
ssl/statem/extensions_srvr.c:1096: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 12 steps of the trace
ssl/statem/extensions_srvr.c:1095:10: Call
1093. return EXT_RETURN_NOT_SENT;
1094.
1095. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret)
^
1096. || !WPACKET_put_bytes_u16(pkt, 0)) {
1097. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_EMS, ERR_R_INTERNAL_ERROR);
ssl/packet.c:306:1: Parameter `pkt->buf->length`
304. }
305.
306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
307. {
308. unsigned char *data;
ssl/statem/extensions_srvr.c:1096:17: Call
1094.
1095. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret)
1096. || !WPACKET_put_bytes_u16(pkt, 0)) {
^
1097. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_EMS, ERR_R_INTERNAL_ERROR);
1098. return EXT_RETURN_FAIL;
ssl/packet.c:306:1: Parameter `pkt->written`
304. }
305.
306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
307. {
308. unsigned char *data;
ssl/packet.c:312:17: Call
310. /* Internal API, so should not fail */
311. if (!ossl_assert(size <= sizeof(unsigned int))
312. || !WPACKET_allocate_bytes(pkt, size, &data)
^
313. || !put_value(data, val, size))
314. return 0;
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:39:1: <LHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `pkt->buf->length`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: <RHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `len`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:48:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__`
46. return 0;
47.
48. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
^
49. size_t newlen;
50. size_t reflen;
| https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/packet.c/#L48 |
d2a_code_trace_data_45269 | static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, long src_size)
{
int idx = 15 - src_size;
const uint8_t *s = src-idx;
uint8_t *d = dst-idx;
for (; idx<15; idx+=4) {
register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
v &= 0xff00ff;
*(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
}
}
libswscale/rgb2rgb_template.c:354: error: Integer Overflow L2
([0, 255+min(4278255360, `*src`)] + [0, 1095233372160]):signed32.
libswscale/rgb2rgb_template.c:346:1: <LHS trace>
344. }
345.
346. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, long src_size)
^
347. {
348. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:346:1: Parameter `*src`
344. }
345.
346. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, long src_size)
^
347. {
348. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:352:9: Assignment
350. uint8_t *d = dst-idx;
351. for (; idx<15; idx+=4) {
352. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
^
353. v &= 0xff00ff;
354. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
libswscale/rgb2rgb_template.c:352:9: Assignment
350. uint8_t *d = dst-idx;
351. for (; idx<15; idx+=4) {
352. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
^
353. v &= 0xff00ff;
354. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
libswscale/rgb2rgb_template.c:346:1: <RHS trace>
344. }
345.
346. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, long src_size)
^
347. {
348. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:346:1: Parameter `*src`
344. }
345.
346. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, long src_size)
^
347. {
348. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:352:9: Assignment
350. uint8_t *d = dst-idx;
351. for (; idx<15; idx+=4) {
352. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
^
353. v &= 0xff00ff;
354. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
libswscale/rgb2rgb_template.c:353:9: Assignment
351. for (; idx<15; idx+=4) {
352. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
353. v &= 0xff00ff;
^
354. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
355. }
libswscale/rgb2rgb_template.c:354:9: Binary operation: ([0, 255+min(4278255360, *src)] + [0, 1095233372160]):signed32
352. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
353. v &= 0xff00ff;
354. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
^
355. }
356. }
| https://github.com/libav/libav/blob/ef8b54fc883e2a91cbca37b50904e1a0659bb121/libswscale/rgb2rgb_template.c/#L354 |
d2a_code_trace_data_45270 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_gen.c:135: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_gcd`.
Showing all 12 steps of the trace
crypto/rsa/rsa_gen.c:98:5: Call
96. if (ctx == NULL)
97. goto err;
98. BN_CTX_start(ctx);
^
99. r0 = BN_CTX_get(ctx);
100. r1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth`
234. }
235.
236. > void BN_CTX_start(BN_CTX *ctx)
237. {
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/rsa/rsa_gen.c:135:14: Call
133. if (!BN_sub(r2, rsa->p, BN_value_one()))
134. goto err;
135. if (!BN_gcd(r1, r2, rsa->e, ctx))
^
136. goto err;
137. if (BN_is_one(r1))
crypto/bn/bn_gcd.c:117:1: Parameter `ctx->stack.depth`
115. static BIGNUM *euclid(BIGNUM *a, BIGNUM *b);
116.
117. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)
118. {
119. BIGNUM *a, *b, *t;
crypto/bn/bn_gcd.c:125:5: Call
123. bn_check_top(in_b);
124.
125. BN_CTX_start(ctx);
^
126. a = BN_CTX_get(ctx);
127. 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:151:5: Call
149. ret = 1;
150. err:
151. BN_CTX_end(ctx);
^
152. bn_check_top(r);
153. return (ret);
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_gcd`
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_45271 | static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
{
const tls_curve_info *cinfo;
if (curve[0])
return 1;
if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))
return 0;
cinfo = &nid_list[curve[1] - 1];
# ifdef OPENSSL_NO_EC2M
if (cinfo->flags & TLS_CURVE_CHAR2)
return 0;
# endif
return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);
}
ssl/statem/statem_clnt.c:1594: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: 29 by call to `tls1_check_curve`.
Showing all 9 steps of the trace
ssl/statem/statem_clnt.c:1407:1: Parameter `*pkt->curr`
1405. }
1406.
1407. > MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt)
1408. {
1409. EVP_MD_CTX *md_ctx;
ssl/statem/statem_clnt.c:1594:14: Call
1592. * invalid curve. ECParameters is 3 bytes.
1593. */
1594. if (!tls1_check_curve(s, ecparams, 3)) {
^
1595. SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_WRONG_CURVE);
1596. goto f_err;
ssl/t1_lib.c:277:1: Array declaration
275.
276. /* The default curves */
277. > static const unsigned char eccurves_default[] = {
278. 0, 29, /* X25519 (29) */
279. /* Prefer P-256 which has the fastest and most secure implementations. */
ssl/t1_lib.c:460:20: Call
458. for (i = 0; i < num_curves; i++, curves += 2) {
459. if (p[1] == curves[0] && p[2] == curves[1])
460. return tls_curve_allowed(s, p + 1, SSL_SECOP_CURVE_CHECK);
^
461. }
462. return 0;
ssl/t1_lib.c:419:1: <Offset trace>
417.
418. /* See if curve is allowed by security callback */
419. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
420. {
421. const tls_curve_info *cinfo;
ssl/t1_lib.c:419:1: Parameter `*curve`
417.
418. /* See if curve is allowed by security callback */
419. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
420. {
421. const tls_curve_info *cinfo;
ssl/t1_lib.c:237:1: <Length trace>
235. */
236.
237. > static const tls_curve_info nid_list[] = {
238. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */
239. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */
ssl/t1_lib.c:237:1: Array declaration
235. */
236.
237. > static const tls_curve_info nid_list[] = {
238. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */
239. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */
ssl/t1_lib.c:426:5: Array access: Offset: [-1, +oo] Size: 29 by call to `tls1_check_curve`
424. if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))
425. return 0;
426. cinfo = &nid_list[curve[1] - 1];
^
427. # ifdef OPENSSL_NO_EC2M
428. if (cinfo->flags & TLS_CURVE_CHAR2)
| https://github.com/openssl/openssl/blob/0421c00e56cad9bdce5c1df4d406b7fc799bf6ad/ssl/t1_lib.c/#L426 |
d2a_code_trace_data_45272 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_exp.c:733: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_mul_montgomery`.
Showing all 17 steps of the trace
crypto/bn/bn_exp.c:625:1: Parameter `ctx->stack.depth`
623. * http://www.daemonology.net/hyperthreading-considered-harmful/)
624. */
625. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
626. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
627. {
crypto/bn/bn_exp.c:659:2: Call
657. }
658.
659. BN_CTX_start(ctx);
^
660.
661. /* Allocate a montgomery context if it was not supplied by the caller.
crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth`
255. }
256.
257. > void BN_CTX_start(BN_CTX *ctx)
258. {
259. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_exp.c:733:12: Call
731. if (!BN_to_montgomery(&am,&am,mont,ctx)) goto err;
732. }
733. else if (!BN_to_montgomery(&am,a,mont,ctx)) goto err;
^
734.
735. #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
crypto/bn/bn_mont.c:131:1: Parameter `ctx->stack.depth`
129. #endif
130.
131. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
132. BN_MONT_CTX *mont, BN_CTX *ctx)
133. {
crypto/bn/bn_mont.c:152:2: Call
150. #endif
151.
152. BN_CTX_start(ctx);
^
153. tmp = BN_CTX_get(ctx);
154. if (tmp == NULL) goto err;
crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth`
255. }
256.
257. > void BN_CTX_start(BN_CTX *ctx)
258. {
259. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mont.c:159:8: Call
157. if (a == b)
158. {
159. if (!BN_sqr(tmp,a,ctx)) goto err;
^
160. }
161. else
crypto/bn/bn_sqr.c:65:1: Parameter `ctx->stack.depth`
63. /* r must not be a */
64. /* I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 */
65. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
66. {
67. int max,al;
crypto/bn/bn_sqr.c:83:2: Call
81. }
82.
83. BN_CTX_start(ctx);
^
84. rr=(a != r) ? r : BN_CTX_get(ctx);
85. tmp=BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth`
255. }
256.
257. > void BN_CTX_start(BN_CTX *ctx)
258. {
259. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_sqr.c:153:2: Call
151. bn_check_top(rr);
152. bn_check_top(tmp);
153. BN_CTX_end(ctx);
^
154. return(ret);
155. }
crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth`
270. }
271.
272. > void BN_CTX_end(BN_CTX *ctx)
273. {
274. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:279:21: Call
277. else
278. {
279. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
280. /* Does this stack frame have anything to release? */
281. if(fp < ctx->used)
crypto/bn/bn_ctx.c:353:1: <LHS trace>
351. }
352.
353. > static unsigned int BN_STACK_pop(BN_STACK *st)
354. {
355. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:353:1: Parameter `st->depth`
351. }
352.
353. > static unsigned int BN_STACK_pop(BN_STACK *st)
354. {
355. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul_montgomery`
353. static unsigned int BN_STACK_pop(BN_STACK *st)
354. {
355. return st->indexes[--(st->depth)];
^
356. }
357.
| https://github.com/openssl/openssl/blob/a9d14832fd98cb0c13b53fddea39765fb259358c/crypto/bn/bn_ctx.c/#L355 |
d2a_code_trace_data_45273 | BN_ULONG bn_sub_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl)
{
BN_ULONG c, t;
assert(cl >= 0);
c = bn_sub_words(r, a, b, cl);
if (dl == 0)
return c;
r += cl;
a += cl;
b += cl;
if (dl < 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
#endif
for (;;)
{
t = b[0];
r[0] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
t = b[1];
r[1] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
t = b[2];
r[2] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
t = b[3];
r[3] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
b += 4;
r += 4;
}
}
else
{
int save_dl = dl;
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c);
#endif
while(c)
{
t = a[0];
r[0] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
t = a[1];
r[1] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
t = a[2];
r[2] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
t = a[3];
r[3] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
save_dl = dl;
a += 4;
r += 4;
}
if (dl > 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
#endif
if (save_dl > dl)
{
switch (save_dl - dl)
{
case 1:
r[1] = a[1];
if (--dl <= 0) break;
case 2:
r[2] = a[2];
if (--dl <= 0) break;
case 3:
r[3] = a[3];
if (--dl <= 0) break;
}
a += 4;
r += 4;
}
}
if (dl > 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, copy)\n", cl, dl);
#endif
for(;;)
{
r[0] = a[0];
if (--dl <= 0) break;
r[1] = a[1];
if (--dl <= 0) break;
r[2] = a[2];
if (--dl <= 0) break;
r[3] = a[3];
if (--dl <= 0) break;
a += 4;
r += 4;
}
}
}
return c;
}
crypto/bn/bn_exp.c:733: error: INTEGER_OVERFLOW_L2
(0 - [0, max(4294967295, `*in_mont->RR.d`)]):unsigned32 by call to `BN_mod_mul_montgomery`.
Showing all 16 steps of the trace
crypto/bn/bn_exp.c:625:1: Parameter `*in_mont->RR.d`
623. * http://www.daemonology.net/hyperthreading-considered-harmful/)
624. */
625. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
626. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
627. {
crypto/bn/bn_exp.c:733:12: Call
731. if (!BN_to_montgomery(&am,&am,mont,ctx)) goto err;
732. }
733. else if (!BN_to_montgomery(&am,a,mont,ctx)) goto err;
^
734.
735. #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
crypto/bn/bn_mont.c:131:1: Parameter `*b->d`
129. #endif
130.
131. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
132. BN_MONT_CTX *mont, BN_CTX *ctx)
133. {
crypto/bn/bn_mont.c:163:8: Call
161. else
162. {
163. if (!BN_mul(tmp,a,b,ctx)) goto err;
^
164. }
165. /* reduce from aRR to aR */
crypto/bn/bn_mul.c:943:1: Parameter `*b->d`
941. #endif /* BN_RECURSION */
942.
943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
944. {
945. int ret=0;
crypto/bn/bn_mul.c:1032:5: Call
1030. if (bn_wexpand(t,k*4) == NULL) goto err;
1031. if (bn_wexpand(rr,k*4) == NULL) goto err;
1032. bn_mul_part_recursive(rr->d,a->d,b->d,
^
1033. j,al-j,bl-j,t->d);
1034. }
crypto/bn/bn_mul.c:550:1: Parameter `*b`
548. * t needs to be n*4 is size, as does r */
549. /* tnX may not be negative but less than n */
550. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
551. int tna, int tnb, BN_ULONG *t)
552. {
crypto/bn/bn_mul.c:569:5: Call
567. /* r=(a[0]-a[1])*(b[1]-b[0]) */
568. c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
569. c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
^
570. neg=0;
571. switch (c1*3+c2)
crypto/bn/bn_lib.c:807:1: Parameter `*b`
805. All lengths are the number of BN_ULONGs... */
806.
807. > int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b,
808. int cl, int dl)
809. {
crypto/bn/bn_mul.c:575:3: Call
573. case -4:
574. bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
575. bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
^
576. break;
577. case -3:
crypto/bn/bn_mul.c:80:1: <RHS trace>
78. assembler counterparts for the systems that use assembler files. */
79.
80. > BN_ULONG bn_sub_part_words(BN_ULONG *r,
81. const BN_ULONG *a, const BN_ULONG *b,
82. int cl, int dl)
crypto/bn/bn_mul.c:80:1: Parameter `*b`
78. assembler counterparts for the systems that use assembler files. */
79.
80. > BN_ULONG bn_sub_part_words(BN_ULONG *r,
81. const BN_ULONG *a, const BN_ULONG *b,
82. int cl, int dl)
crypto/bn/bn_mul.c:87:6: Call
85.
86. assert(cl >= 0);
87. c = bn_sub_words(r, a, b, cl);
^
88.
89. if (dl == 0)
crypto/bn/bn_asm.c:394:1: Parameter `*b`
392. #endif /* !BN_LLONG */
393.
394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
395. {
396. BN_ULONG t1,t2;
crypto/bn/bn_mul.c:103:4: Assignment
101. for (;;)
102. {
103. t = b[0];
^
104. r[0] = (0-t-c)&BN_MASK2;
105. if (t != 0) c=1;
crypto/bn/bn_mul.c:104:4: Binary operation: (0 - [0, max(4294967295, *in_mont->RR.d)]):unsigned32 by call to `BN_mod_mul_montgomery`
102. {
103. t = b[0];
104. r[0] = (0-t-c)&BN_MASK2;
^
105. if (t != 0) c=1;
106. if (++dl >= 0) break;
| https://github.com/openssl/openssl/blob/a9d14832fd98cb0c13b53fddea39765fb259358c/crypto/bn/bn_mul.c/#L104 |
d2a_code_trace_data_45274 | 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:1057: error: Uninitialized Value
The value read from ymin was never initialized.
libavcodec/motion_est_template.c:1057:9:
1055. }
1056. CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
1057. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
^
1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1057 |
d2a_code_trace_data_45275 | static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al)
{
#ifndef OPENSSL_NO_RSA
unsigned char *encdata = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx = NULL;
size_t enclen;
unsigned char *pms = NULL;
size_t pmslen = 0;
if (s->session->peer == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
return 0;
}
pkey = X509_get0_pubkey(s->session->peer);
if (EVP_PKEY_get0_RSA(pkey) == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
return 0;
}
pmslen = SSL_MAX_MASTER_KEY_LENGTH;
pms = OPENSSL_malloc(pmslen);
if (pms == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);
*al = SSL_AD_INTERNAL_ERROR;
return 0;
}
pms[0] = s->client_version >> 8;
pms[1] = s->client_version & 0xff;
if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
goto err;
}
if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
goto err;
}
pctx = EVP_PKEY_CTX_new(pkey, NULL);
if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0
|| EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB);
goto err;
}
if (!WPACKET_allocate_bytes(pkt, enclen, &encdata)
|| EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT);
goto err;
}
EVP_PKEY_CTX_free(pctx);
pctx = NULL;
if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
goto err;
}
if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen))
goto err;
s->s3->tmp.pms = pms;
s->s3->tmp.pmslen = pmslen;
return 1;
err:
OPENSSL_clear_free(pms, pmslen);
EVP_PKEY_CTX_free(pctx);
return 0;
#else
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
*al = SSL_AD_INTERNAL_ERROR;
return 0;
#endif
}
ssl/statem/statem_clnt.c:2848: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_malloc()` at line 2800, column 11 is not reachable after line 2848, column 5.
Showing all 72 steps of the trace
ssl/statem/statem_clnt.c:2775:1: start of procedure tls_construct_cke_rsa()
2773. }
2774.
2775. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al)
2776. {
2777. #ifndef OPENSSL_NO_RSA
ssl/statem/statem_clnt.c:2778:5:
2776. {
2777. #ifndef OPENSSL_NO_RSA
2778. > unsigned char *encdata = NULL;
2779. EVP_PKEY *pkey = NULL;
2780. EVP_PKEY_CTX *pctx = NULL;
ssl/statem/statem_clnt.c:2779:5:
2777. #ifndef OPENSSL_NO_RSA
2778. unsigned char *encdata = NULL;
2779. > EVP_PKEY *pkey = NULL;
2780. EVP_PKEY_CTX *pctx = NULL;
2781. size_t enclen;
ssl/statem/statem_clnt.c:2780:5:
2778. unsigned char *encdata = NULL;
2779. EVP_PKEY *pkey = NULL;
2780. > EVP_PKEY_CTX *pctx = NULL;
2781. size_t enclen;
2782. unsigned char *pms = NULL;
ssl/statem/statem_clnt.c:2782:5:
2780. EVP_PKEY_CTX *pctx = NULL;
2781. size_t enclen;
2782. > unsigned char *pms = NULL;
2783. size_t pmslen = 0;
2784.
ssl/statem/statem_clnt.c:2783:5:
2781. size_t enclen;
2782. unsigned char *pms = NULL;
2783. > size_t pmslen = 0;
2784.
2785. if (s->session->peer == NULL) {
ssl/statem/statem_clnt.c:2785:9: Taking false branch
2783. size_t pmslen = 0;
2784.
2785. if (s->session->peer == NULL) {
^
2786. /*
2787. * We should always have a server certificate with SSL_kRSA.
ssl/statem/statem_clnt.c:2793:5:
2791. }
2792.
2793. > pkey = X509_get0_pubkey(s->session->peer);
2794. if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2795. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
crypto/x509/x509_cmp.c:265:1: start of procedure X509_get0_pubkey()
263. }
264.
265. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
266. {
267. if (x == NULL)
crypto/x509/x509_cmp.c:267:9: Taking false branch
265. EVP_PKEY *X509_get0_pubkey(const X509 *x)
266. {
267. if (x == NULL)
^
268. return NULL;
269. return X509_PUBKEY_get0(x->cert_info.key);
crypto/x509/x509_cmp.c:269:5:
267. if (x == NULL)
268. return NULL;
269. > return X509_PUBKEY_get0(x->cert_info.key);
270. }
271.
crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0()
138. }
139.
140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. EVP_PKEY *ret = NULL;
crypto/x509/x_pubkey.c:142:5:
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. > EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
crypto/x509/x_pubkey.c:144:9: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:144:24: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:147:9: Taking true branch
145. return NULL;
146.
147. if (key->pkey != NULL)
^
148. return key->pkey;
149.
crypto/x509/x_pubkey.c:148:9:
146.
147. if (key->pkey != NULL)
148. > return key->pkey;
149.
150. /*
crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0
164.
165. return NULL;
166. > }
167.
168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
crypto/x509/x509_cmp.c:270:1: return from a call to X509_get0_pubkey
268. return NULL;
269. return X509_PUBKEY_get0(x->cert_info.key);
270. > }
271.
272. EVP_PKEY *X509_get_pubkey(X509 *x)
ssl/statem/statem_clnt.c:2794:9:
2792.
2793. pkey = X509_get0_pubkey(s->session->peer);
2794. > if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2795. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2796. return 0;
crypto/evp/p_lib.c:290:1: start of procedure EVP_PKEY_get0_RSA()
288. }
289.
290. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
291. {
292. if (pkey->type != EVP_PKEY_RSA) {
crypto/evp/p_lib.c:292:9: Taking false branch
290. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
291. {
292. if (pkey->type != EVP_PKEY_RSA) {
^
293. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
294. return NULL;
crypto/evp/p_lib.c:296:5:
294. return NULL;
295. }
296. > return pkey->pkey.rsa;
297. }
298.
crypto/evp/p_lib.c:297:1: return from a call to EVP_PKEY_get0_RSA
295. }
296. return pkey->pkey.rsa;
297. > }
298.
299. RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey)
ssl/statem/statem_clnt.c:2794:9: Taking false branch
2792.
2793. pkey = X509_get0_pubkey(s->session->peer);
2794. if (EVP_PKEY_get0_RSA(pkey) == NULL) {
^
2795. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2796. return 0;
ssl/statem/statem_clnt.c:2799:5:
2797. }
2798.
2799. > pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2800. pms = OPENSSL_malloc(pmslen);
2801. if (pms == NULL) {
ssl/statem/statem_clnt.c:2800:5:
2798.
2799. pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2800. > pms = OPENSSL_malloc(pmslen);
2801. if (pms == NULL) {
2802. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);
crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
156. #endif
157.
158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. void *ret = NULL;
crypto/mem.c:160:5:
158. void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. > void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:162:9: Taking false branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:165:9: Taking false branch
163. return malloc_impl(num, file, line);
164.
165. if (num == 0)
^
166. return NULL;
167.
crypto/mem.c:169:5:
167.
168. FAILTEST();
169. > allow_customize = 0;
170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
171. if (call_malloc_debug) {
crypto/mem.c:179:5:
177. }
178. #else
179. > osslargused(file); osslargused(line);
180. ret = malloc(num);
181. #endif
crypto/mem.c:179:24:
177. }
178. #else
179. > osslargused(file); osslargused(line);
180. ret = malloc(num);
181. #endif
crypto/mem.c:180:5:
178. #else
179. osslargused(file); osslargused(line);
180. > ret = malloc(num);
181. #endif
182.
crypto/mem.c:183:5:
181. #endif
182.
183. > return ret;
184. }
185.
crypto/mem.c:184:1: return from a call to CRYPTO_malloc
182.
183. return ret;
184. > }
185.
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
ssl/statem/statem_clnt.c:2801:9: Taking false branch
2799. pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2800. pms = OPENSSL_malloc(pmslen);
2801. if (pms == NULL) {
^
2802. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);
2803. *al = SSL_AD_INTERNAL_ERROR;
ssl/statem/statem_clnt.c:2807:5:
2805. }
2806.
2807. > pms[0] = s->client_version >> 8;
2808. pms[1] = s->client_version & 0xff;
2809. /* TODO(size_t): Convert this function */
ssl/statem/statem_clnt.c:2808:5:
2806.
2807. pms[0] = s->client_version >> 8;
2808. > pms[1] = s->client_version & 0xff;
2809. /* TODO(size_t): Convert this function */
2810. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
ssl/statem/statem_clnt.c:2810:9:
2808. pms[1] = s->client_version & 0xff;
2809. /* TODO(size_t): Convert this function */
2810. > if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
2811. goto err;
2812. }
crypto/rand/rand_lib.c:135:1: start of procedure RAND_bytes()
133. }
134.
135. > int RAND_bytes(unsigned char *buf, int num)
136. {
137. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:137:5:
135. int RAND_bytes(unsigned char *buf, int num)
136. {
137. > const RAND_METHOD *meth = RAND_get_rand_method();
138. if (meth && meth->bytes)
139. return meth->bytes(buf, num);
crypto/rand/rand_lib.c:54:1: start of procedure RAND_get_rand_method()
52. }
53.
54. > const RAND_METHOD *RAND_get_rand_method(void)
55. {
56. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:56:5:
54. const RAND_METHOD *RAND_get_rand_method(void)
55. {
56. > const RAND_METHOD *tmp_meth = NULL;
57.
58. if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
crypto/rand/rand_lib.c:58:10:
56. const RAND_METHOD *tmp_meth = NULL;
57.
58. > if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
59. return NULL;
60.
crypto/threads_pthread.c:104:1: start of procedure CRYPTO_THREAD_run_once()
102. }
103.
104. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
105. {
106. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:106:9: Taking true branch
104. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
105. {
106. if (pthread_once(once, init) != 0)
^
107. return 0;
108.
crypto/threads_pthread.c:107:9:
105. {
106. if (pthread_once(once, init) != 0)
107. > return 0;
108.
109. return 1;
crypto/threads_pthread.c:110:1: return from a call to CRYPTO_THREAD_run_once
108.
109. return 1;
110. > }
111.
112. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:58:10: Condition is false
56. const RAND_METHOD *tmp_meth = NULL;
57.
58. if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
^
59. return NULL;
60.
crypto/rand/rand_lib.c:58:10: Taking true branch
56. const RAND_METHOD *tmp_meth = NULL;
57.
58. if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
^
59. return NULL;
60.
crypto/rand/rand_lib.c:59:9:
57.
58. if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
59. > return NULL;
60.
61. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:81:1: return from a call to RAND_get_rand_method
79. CRYPTO_THREAD_unlock(rand_meth_lock);
80. return tmp_meth;
81. > }
82.
83. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:138:9: Taking false branch
136. {
137. const RAND_METHOD *meth = RAND_get_rand_method();
138. if (meth && meth->bytes)
^
139. return meth->bytes(buf, num);
140. return (-1);
crypto/rand/rand_lib.c:140:5:
138. if (meth && meth->bytes)
139. return meth->bytes(buf, num);
140. > return (-1);
141. }
142.
crypto/rand/rand_lib.c:141:1: return from a call to RAND_bytes
139. return meth->bytes(buf, num);
140. return (-1);
141. > }
142.
143. #if OPENSSL_API_COMPAT < 0x10100000L
ssl/statem/statem_clnt.c:2810:9: Taking true branch
2808. pms[1] = s->client_version & 0xff;
2809. /* TODO(size_t): Convert this function */
2810. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
^
2811. goto err;
2812. }
ssl/statem/statem_clnt.c:2847:2:
2845.
2846. return 1;
2847. > err:
2848. OPENSSL_clear_free(pms, pmslen);
2849. EVP_PKEY_CTX_free(pctx);
ssl/statem/statem_clnt.c:2848:5:
2846. return 1;
2847. err:
2848. > OPENSSL_clear_free(pms, pmslen);
2849. EVP_PKEY_CTX_free(pctx);
2850.
crypto/mem.c:273:1: start of procedure CRYPTO_clear_free()
271. }
272.
273. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
274. {
275. if (str == NULL)
crypto/mem.c:275:9: Taking false branch
273. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
274. {
275. if (str == NULL)
^
276. return;
277. if (num)
crypto/mem.c:277:9: Taking true branch
275. if (str == NULL)
276. return;
277. if (num)
^
278. OPENSSL_cleanse(str, num);
279. CRYPTO_free(str, file, line);
crypto/mem.c:278:9: Skipping OPENSSL_cleanse(): method has no implementation
276. return;
277. if (num)
278. OPENSSL_cleanse(str, num);
^
279. CRYPTO_free(str, file, line);
280. }
crypto/mem.c:279:5:
277. if (num)
278. OPENSSL_cleanse(str, num);
279. > CRYPTO_free(str, file, line);
280. }
crypto/mem.c:253:1: start of procedure CRYPTO_free()
251. }
252.
253. > void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:255:9: Taking true branch
253. void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
256. free_impl(str, file, line);
257. return;
crypto/mem.c:255:30: Taking true branch
253. void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
256. free_impl(str, file, line);
257. return;
crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
256. free_impl(str, file, line);
^
257. return;
258. }
crypto/mem.c:257:9:
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
256. free_impl(str, file, line);
257. > return;
258. }
259.
crypto/mem.c:271:1: return from a call to CRYPTO_free
269. free(str);
270. #endif
271. > }
272.
273. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
crypto/mem.c:280:1: return from a call to CRYPTO_clear_free
278. OPENSSL_cleanse(str, num);
279. CRYPTO_free(str, file, line);
280. > }
| https://github.com/openssl/openssl/blob/8ed9a26616a7101ea698c189fbbb663186676075/ssl/statem/statem_clnt.c/#L2848 |
d2a_code_trace_data_45276 | static int decode_info_header(NUTContext *nut){
AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb;
uint64_t tmp;
unsigned int stream_id_plus1, chapter_start, chapter_len, count;
int chapter_id, i;
int64_t value, end;
char name[256], str_value[1024], type_str[256];
const char *type;
end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
end += url_ftell(bc);
GET_V(stream_id_plus1, tmp <= s->nb_streams)
chapter_id = get_s(bc);
chapter_start= ff_get_v(bc);
chapter_len = ff_get_v(bc);
count = ff_get_v(bc);
for(i=0; i<count; i++){
get_str(bc, name, sizeof(name));
value= get_s(bc);
if(value == -1){
type= "UTF-8";
get_str(bc, str_value, sizeof(str_value));
}else if(value == -2){
get_str(bc, type_str, sizeof(type_str));
type= type_str;
get_str(bc, str_value, sizeof(str_value));
}else if(value == -3){
type= "s";
value= get_s(bc);
}else if(value == -4){
type= "t";
value= ff_get_v(bc);
}else if(value < -4){
type= "r";
get_s(bc);
}else{
type= "v";
}
if (stream_id_plus1 < 0 || stream_id_plus1 > s->nb_streams) {
av_log(s, AV_LOG_ERROR, "invalid stream id for info packet\n");
continue;
}
if(chapter_id==0 && !strcmp(type, "UTF-8")){
if (!strcmp(name, "Author"))
av_strlcpy(s->author , str_value, sizeof(s->author));
else if(!strcmp(name, "Title"))
av_strlcpy(s->title , str_value, sizeof(s->title));
else if(!strcmp(name, "Copyright"))
av_strlcpy(s->copyright, str_value, sizeof(s->copyright));
else if(!strcmp(name, "Description"))
av_strlcpy(s->comment , str_value, sizeof(s->comment));
else if(!strcmp(name, "Disposition"))
set_disposition_bits(s, str_value, stream_id_plus1 - 1);
}
}
if(skip_reserved(bc, end) || get_checksum(bc)){
av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
return -1;
}
return 0;
}
libavformat/nutdec.c:443: error: Integer Overflow L2
([0, `nut->avf->nb_streams`] - 1):unsigned32.
libavformat/nutdec.c:387:1: <LHS trace>
385. }
386.
387. static int decode_info_header(NUTContext *nut){
^
388. AVFormatContext *s= nut->avf;
389. ByteIOContext *bc = s->pb;
libavformat/nutdec.c:387:1: Parameter `nut->avf->nb_streams`
385. }
386.
387. static int decode_info_header(NUTContext *nut){
^
388. AVFormatContext *s= nut->avf;
389. ByteIOContext *bc = s->pb;
libavformat/nutdec.c:443:17: Binary operation: ([0, nut->avf->nb_streams] - 1):unsigned32
441. av_strlcpy(s->comment , str_value, sizeof(s->comment));
442. else if(!strcmp(name, "Disposition"))
443. set_disposition_bits(s, str_value, stream_id_plus1 - 1);
^
444. }
445. }
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/nutdec.c/#L443 |
d2a_code_trace_data_45277 | static int do_file(const char *filename, const char *fullpath, enum Hash h)
{
STACK_OF (X509_INFO) *inf;
X509_INFO *x;
X509_NAME *name = NULL;
BIO *b;
const char *ext;
unsigned char digest[EVP_MAX_MD_SIZE];
int i, type, ret = -1;
if ((ext = strrchr(filename, '.')) == NULL)
return 0;
for (i = 0; i < (int)OSSL_NELEM(extensions); i++) {
if (strcasecmp(extensions[i], ext + 1) == 0)
break;
}
if (i >= (int)OSSL_NELEM(extensions))
return -1;
if ((b = BIO_new_file(fullpath, "r")) == NULL)
return -1;
inf = PEM_X509_INFO_read_bio(b, NULL, NULL, NULL);
BIO_free(b);
if (inf == NULL)
return -1;
if (sk_X509_INFO_num(inf) != 1) {
BIO_printf(bio_err,
"%s: skipping %s,"
"it does not contain exactly one certificate or CRL\n",
opt_getprog(), filename);
goto end;
}
x = sk_X509_INFO_value(inf, 0);
if (x->x509) {
type = TYPE_CERT;
name = X509_get_subject_name(x->x509);
X509_digest(x->x509, evpmd, digest, NULL);
} else if (x->crl) {
type = TYPE_CRL;
name = X509_CRL_get_issuer(x->crl);
X509_CRL_digest(x->crl, evpmd, digest, NULL);
}
if (name) {
if ((h == HASH_NEW) || (h == HASH_BOTH))
add_entry(type, X509_NAME_hash(name), filename, digest, 1, ~0);
if ((h == HASH_OLD) || (h == HASH_BOTH))
add_entry(type, X509_NAME_hash_old(name), filename, digest, 1, ~0);
}
end:
sk_X509_INFO_pop_free(inf, X509_INFO_free);
return ret;
}
apps/rehash.c:266: error: UNINITIALIZED_VALUE
The value read from type was never initialized.
Showing all 1 steps of the trace
apps/rehash.c:266:13:
264. if (name) {
265. if ((h == HASH_NEW) || (h == HASH_BOTH))
266. > add_entry(type, X509_NAME_hash(name), filename, digest, 1, ~0);
267. if ((h == HASH_OLD) || (h == HASH_BOTH))
268. add_entry(type, X509_NAME_hash_old(name), filename, digest, 1, ~0);
| https://github.com/openssl/openssl/blob/aec27d4d5210234560deab85c97bd453535f66ae/apps/rehash.c/#L266 |
d2a_code_trace_data_45278 | int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt = 0;
int i;
int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;
char *f = NULL;
int f_len = 0;
i = tm->length;
v = (char *)tm->data;
if (i < 12)
goto err;
if (v[i - 1] == 'Z')
gmt = 1;
for (i = 0; i < 12; i++)
if ((v[i] > '9') || (v[i] < '0'))
goto err;
y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
+ (v[2] - '0') * 10 + (v[3] - '0');
M = (v[4] - '0') * 10 + (v[5] - '0');
if ((M > 12) || (M < 1))
goto err;
d = (v[6] - '0') * 10 + (v[7] - '0');
h = (v[8] - '0') * 10 + (v[9] - '0');
m = (v[10] - '0') * 10 + (v[11] - '0');
if (tm->length >= 14 &&
(v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9')) {
s = (v[12] - '0') * 10 + (v[13] - '0');
if (tm->length >= 15 && v[14] == '.') {
int l = tm->length;
f = &v[14];
f_len = 1;
while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
++f_len;
}
}
if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
mon[M - 1], d, h, m, s, f_len, f, y,
(gmt) ? " GMT" : "") <= 0)
return (0);
else
return (1);
err:
BIO_write(bp, "Bad time value", 14);
return (0);
}
apps/s_server.c:2976: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `X509_print`.
Showing all 40 steps of the trace
apps/s_server.c:2971:13: Call
2969. SSL_SESSION_print(io, SSL_get_session(con));
2970. BIO_printf(io, "---\n");
2971. print_stats(io, SSL_get_SSL_CTX(con));
^
2972. BIO_printf(io, "---\n");
2973. peer = SSL_get_peer_certificate(con);
apps/s_server.c:2117:16: Call
2115. {
2116. BIO_printf(bio, "%4ld items in the session cache\n",
2117. SSL_CTX_sess_number(ssl_ctx));
^
2118. BIO_printf(bio, "%4ld client connects (SSL_connect())\n",
2119. SSL_CTX_sess_connect(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2119:16: Call
2117. SSL_CTX_sess_number(ssl_ctx));
2118. BIO_printf(bio, "%4ld client connects (SSL_connect())\n",
2119. SSL_CTX_sess_connect(ssl_ctx));
^
2120. BIO_printf(bio, "%4ld client renegotiates (SSL_connect())\n",
2121. SSL_CTX_sess_connect_renegotiate(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2121:16: Call
2119. SSL_CTX_sess_connect(ssl_ctx));
2120. BIO_printf(bio, "%4ld client renegotiates (SSL_connect())\n",
2121. SSL_CTX_sess_connect_renegotiate(ssl_ctx));
^
2122. BIO_printf(bio, "%4ld client connects that finished\n",
2123. SSL_CTX_sess_connect_good(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2123:16: Call
2121. SSL_CTX_sess_connect_renegotiate(ssl_ctx));
2122. BIO_printf(bio, "%4ld client connects that finished\n",
2123. SSL_CTX_sess_connect_good(ssl_ctx));
^
2124. BIO_printf(bio, "%4ld server accepts (SSL_accept())\n",
2125. SSL_CTX_sess_accept(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2125:16: Call
2123. SSL_CTX_sess_connect_good(ssl_ctx));
2124. BIO_printf(bio, "%4ld server accepts (SSL_accept())\n",
2125. SSL_CTX_sess_accept(ssl_ctx));
^
2126. BIO_printf(bio, "%4ld server renegotiates (SSL_accept())\n",
2127. SSL_CTX_sess_accept_renegotiate(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2127:16: Call
2125. SSL_CTX_sess_accept(ssl_ctx));
2126. BIO_printf(bio, "%4ld server renegotiates (SSL_accept())\n",
2127. SSL_CTX_sess_accept_renegotiate(ssl_ctx));
^
2128. BIO_printf(bio, "%4ld server accepts that finished\n",
2129. SSL_CTX_sess_accept_good(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2129:16: Call
2127. SSL_CTX_sess_accept_renegotiate(ssl_ctx));
2128. BIO_printf(bio, "%4ld server accepts that finished\n",
2129. SSL_CTX_sess_accept_good(ssl_ctx));
^
2130. BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx));
2131. BIO_printf(bio, "%4ld session cache misses\n",
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2130:50: Call
2128. BIO_printf(bio, "%4ld server accepts that finished\n",
2129. SSL_CTX_sess_accept_good(ssl_ctx));
2130. BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx));
^
2131. BIO_printf(bio, "%4ld session cache misses\n",
2132. SSL_CTX_sess_misses(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2132:16: Call
2130. BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx));
2131. BIO_printf(bio, "%4ld session cache misses\n",
2132. SSL_CTX_sess_misses(ssl_ctx));
^
2133. BIO_printf(bio, "%4ld session cache timeouts\n",
2134. SSL_CTX_sess_timeouts(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2134:16: Call
2132. SSL_CTX_sess_misses(ssl_ctx));
2133. BIO_printf(bio, "%4ld session cache timeouts\n",
2134. SSL_CTX_sess_timeouts(ssl_ctx));
^
2135. BIO_printf(bio, "%4ld callback cache hits\n",
2136. SSL_CTX_sess_cb_hits(ssl_ctx));
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2136:16: Call
2134. SSL_CTX_sess_timeouts(ssl_ctx));
2135. BIO_printf(bio, "%4ld callback cache hits\n",
2136. SSL_CTX_sess_cb_hits(ssl_ctx));
^
2137. BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n",
2138. SSL_CTX_sess_cache_full(ssl_ctx),
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2138:16: Call
2136. SSL_CTX_sess_cb_hits(ssl_ctx));
2137. BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n",
2138. SSL_CTX_sess_cache_full(ssl_ctx),
^
2139. SSL_CTX_sess_get_cache_size(ssl_ctx));
2140. }
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2139:16: Call
2137. BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n",
2138. SSL_CTX_sess_cache_full(ssl_ctx),
2139. SSL_CTX_sess_get_cache_size(ssl_ctx));
^
2140. }
2141.
ssl/ssl_lib.c:1164:1: Parameter `*parg`
1162. }
1163.
1164. > long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
1165. {
1166. long l;
apps/s_server.c:2976:17: Call
2974. if (peer != NULL) {
2975. BIO_printf(io, "Client certificate\n");
2976. X509_print(io, peer);
^
2977. PEM_write_bio_X509(io, peer);
2978. } else
crypto/asn1/t_x509.c:100:1: Parameter `*x->cert_info->validity->notAfter->data`
98. #endif
99.
100. > int X509_print(BIO *bp, X509 *x)
101. {
102. return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
crypto/asn1/t_x509.c:102:12: Call
100. int X509_print(BIO *bp, X509 *x)
101. {
102. return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
^
103. }
104.
crypto/asn1/t_x509.c:105:1: Parameter `*x->cert_info->validity->notAfter->data`
103. }
104.
105. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
106. unsigned long cflag)
107. {
crypto/asn1/t_x509.c:197:14: Call
195. if (BIO_write(bp, "\n Not After : ", 25) <= 0)
196. goto err;
197. if (!ASN1_TIME_print(bp, X509_get_notAfter(x)))
^
198. goto err;
199. if (BIO_write(bp, "\n", 1) <= 0)
crypto/asn1/t_x509.c:392:1: Parameter `*tm->data`
390. }
391.
392. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
393. {
394. if (tm->type == V_ASN1_UTCTIME)
crypto/asn1/t_x509.c:397:16: Call
395. return ASN1_UTCTIME_print(bp, tm);
396. if (tm->type == V_ASN1_GENERALIZEDTIME)
397. return ASN1_GENERALIZEDTIME_print(bp, tm);
^
398. BIO_write(bp, "Bad time value", 14);
399. return (0);
crypto/asn1/t_x509.c:407:1: <Offset trace>
405. };
406.
407. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
408. {
409. char *v;
crypto/asn1/t_x509.c:407:1: Parameter `*tm->data`
405. };
406.
407. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
408. {
409. char *v;
crypto/asn1/t_x509.c:428:5: Assignment
426. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
427. + (v[2] - '0') * 10 + (v[3] - '0');
428. M = (v[4] - '0') * 10 + (v[5] - '0');
^
429. if ((M > 12) || (M < 1))
430. goto err;
crypto/asn1/t_x509.c:402:1: <Length trace>
400. }
401.
402. > static const char *mon[12] = {
403. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
404. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/t_x509.c:402:1: Array declaration
400. }
401.
402. > static const char *mon[12] = {
403. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
404. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/t_x509.c:449:20: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print`
447.
448. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
449. mon[M - 1], d, h, m, s, f_len, f, y,
^
450. (gmt) ? " GMT" : "") <= 0)
451. return (0);
| https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/asn1/t_x509.c/#L449 |
d2a_code_trace_data_45279 | static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
{
int ret=0;
ASN1_INTEGER *bs=NULL;
X509_STORE_CTX xsc;
EVP_PKEY *upkey;
upkey = X509_get_pubkey(xca);
EVP_PKEY_copy_parameters(upkey,pkey);
EVP_PKEY_free(upkey);
if(!X509_STORE_CTX_init(&xsc,ctx,x,NULL))
{
BIO_printf(bio_err,"Error initialising X509 store\n");
goto end;
}
if (sno) bs = sno;
else if (!(bs = x509_load_serial(CAfile, serialfile, create)))
goto end;
X509_STORE_CTX_set_cert(&xsc,x);
if (!reqfile && !X509_verify_cert(&xsc))
goto end;
if (!X509_check_private_key(xca,pkey))
{
BIO_printf(bio_err,"CA certificate and CA private key do not match\n");
goto end;
}
if (!X509_set_issuer_name(x,X509_get_subject_name(xca))) goto end;
if (!X509_set_serialNumber(x,bs)) goto end;
if (X509_gmtime_adj(X509_get_notBefore(x),0L) == NULL)
goto end;
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
goto end;
if (clrext)
{
while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
}
if (conf)
{
X509V3_CTX ctx2;
X509_set_version(x,2);
X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);
X509V3_set_nconf(&ctx2, conf);
if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end;
}
if (!X509_sign(x,pkey,digest)) goto end;
ret=1;
end:
X509_STORE_CTX_cleanup(&xsc);
if (!ret)
ERR_print_errors(bio_err);
if (!sno) ASN1_INTEGER_free(bs);
return ret;
}
apps/x509.c:1127: error: NULL_DEREFERENCE
pointer `upkey` last assigned on line 1126 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1127, column 2.
Showing all 86 steps of the trace
apps/x509.c:1117:1: start of procedure x509_certify()
1115. }
1116.
1117. > static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
1118. X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
1119. int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
apps/x509.c:1121:2:
1119. int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
1120. {
1121. > int ret=0;
1122. ASN1_INTEGER *bs=NULL;
1123. X509_STORE_CTX xsc;
apps/x509.c:1122:2:
1120. {
1121. int ret=0;
1122. > ASN1_INTEGER *bs=NULL;
1123. X509_STORE_CTX xsc;
1124. EVP_PKEY *upkey;
apps/x509.c:1126:2:
1124. EVP_PKEY *upkey;
1125.
1126. > upkey = X509_get_pubkey(xca);
1127. EVP_PKEY_copy_parameters(upkey,pkey);
1128. EVP_PKEY_free(upkey);
crypto/x509/x509_cmp.c:358:1: start of procedure X509_get_pubkey()
356. }
357.
358. > EVP_PKEY *X509_get_pubkey(X509 *x)
359. {
360. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:360:7: Taking false branch
358. EVP_PKEY *X509_get_pubkey(X509 *x)
359. {
360. if ((x == NULL) || (x->cert_info == NULL))
^
361. return(NULL);
362. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:360:22: Taking false branch
358. EVP_PKEY *X509_get_pubkey(X509 *x)
359. {
360. if ((x == NULL) || (x->cert_info == NULL))
^
361. return(NULL);
362. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:362:2:
360. if ((x == NULL) || (x->cert_info == NULL))
361. return(NULL);
362. > return(X509_PUBKEY_get(x->cert_info->key));
363. }
364.
crypto/asn1/x_pubkey.c:226:1: start of procedure X509_PUBKEY_get()
224. }
225.
226. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
227. {
228. EVP_PKEY *ret=NULL;
crypto/asn1/x_pubkey.c:228:2:
226. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
227. {
228. > EVP_PKEY *ret=NULL;
229. long j;
230. int type;
crypto/asn1/x_pubkey.c:237:6: Taking false branch
235. #endif
236.
237. if (key == NULL) goto err;
^
238.
239. if (key->pkey != NULL)
crypto/asn1/x_pubkey.c:239:6: Taking false branch
237. if (key == NULL) goto err;
238.
239. if (key->pkey != NULL)
^
240. {
241. CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
crypto/asn1/x_pubkey.c:245:6: Taking false branch
243. }
244.
245. if (key->public_key == NULL) goto err;
^
246.
247. type=OBJ_obj2nid(key->algor->algorithm);
crypto/asn1/x_pubkey.c:247:2:
245. if (key->public_key == NULL) goto err;
246.
247. > type=OBJ_obj2nid(key->algor->algorithm);
248. if ((ret = EVP_PKEY_new()) == NULL)
249. {
crypto/objects/obj_dat.c:366:1: start of procedure OBJ_obj2nid()
364. }
365.
366. > int OBJ_obj2nid(const ASN1_OBJECT *a)
367. {
368. ASN1_OBJECT **op;
crypto/objects/obj_dat.c:371:6: Taking false branch
369. ADDED_OBJ ad,*adp;
370.
371. if (a == NULL)
^
372. return(NID_undef);
373. if (a->nid != 0)
crypto/objects/obj_dat.c:373:6: Taking false branch
371. if (a == NULL)
372. return(NID_undef);
373. if (a->nid != 0)
^
374. return(a->nid);
375.
crypto/objects/obj_dat.c:376:6: Taking true branch
374. return(a->nid);
375.
376. if (added != NULL)
^
377. {
378. ad.type=ADDED_DATA;
crypto/objects/obj_dat.c:378:3:
376. if (added != NULL)
377. {
378. > ad.type=ADDED_DATA;
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
crypto/objects/obj_dat.c:379:3:
377. {
378. ad.type=ADDED_DATA;
379. > ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
crypto/objects/obj_dat.c:380:3:
378. ad.type=ADDED_DATA;
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. > adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
382. }
crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
246. }
247.
248. > void *lh_retrieve(LHASH *lh, const void *data)
249. {
250. unsigned long hash;
crypto/lhash/lhash.c:254:2:
252. const void *ret;
253.
254. > lh->error=0;
255. rn=getrn(lh,data,&hash);
256.
crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
253.
254. lh->error=0;
255. rn=getrn(lh,data,&hash);
^
256.
257. if (*rn == NULL)
crypto/lhash/lhash.c:257:6: Taking false branch
255. rn=getrn(lh,data,&hash);
256.
257. if (*rn == NULL)
^
258. {
259. lh->num_retrieve_miss++;
crypto/lhash/lhash.c:264:3:
262. else
263. {
264. > ret= (*rn)->data;
265. lh->num_retrieve++;
266. }
crypto/lhash/lhash.c:265:3:
263. {
264. ret= (*rn)->data;
265. > lh->num_retrieve++;
266. }
267. return((void *)ret);
crypto/lhash/lhash.c:267:2:
265. lh->num_retrieve++;
266. }
267. > return((void *)ret);
268. }
269.
crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
266. }
267. return((void *)ret);
268. }
^
269.
270. static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
crypto/objects/obj_dat.c:381:7: Taking true branch
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
^
382. }
383. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
crypto/objects/obj_dat.c:381:20:
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. > if (adp != NULL) return (adp->obj->nid);
382. }
383. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
crypto/objects/obj_dat.c:388:2: return from a call to OBJ_obj2nid
386. return(NID_undef);
387. return((*op)->nid);
388. }
^
389.
390. /* Convert an object name into an ASN1_OBJECT
crypto/asn1/x_pubkey.c:248:6:
246.
247. type=OBJ_obj2nid(key->algor->algorithm);
248. > if ((ret = EVP_PKEY_new()) == NULL)
249. {
250. X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
crypto/evp/p_lib.c:301:1: start of procedure EVP_PKEY_new()
299. }
300.
301. > EVP_PKEY *EVP_PKEY_new(void)
302. {
303. EVP_PKEY *ret;
crypto/evp/p_lib.c:305:2:
303. EVP_PKEY *ret;
304.
305. > ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
306. if (ret == NULL)
307. {
crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
289. }
290.
291. > void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. void *ret = NULL;
crypto/mem.c:293:2:
291. void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. > void *ret = NULL;
294. extern unsigned char cleanse_ctr;
295.
crypto/mem.c:296:6: Taking false branch
294. extern unsigned char cleanse_ctr;
295.
296. if (num <= 0) return NULL;
^
297.
298. allow_customize = 0;
crypto/mem.c:298:2:
296. if (num <= 0) return NULL;
297.
298. > allow_customize = 0;
299. if (malloc_debug_func != NULL)
300. {
crypto/mem.c:299:6: Taking true branch
297.
298. allow_customize = 0;
299. if (malloc_debug_func != NULL)
^
300. {
301. allow_customize_debug = 0;
crypto/mem.c:301:3:
299. if (malloc_debug_func != NULL)
300. {
301. > allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
300. {
301. allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
^
303. }
304. ret = malloc_ex_func(num,file,line);
crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
304. ret = malloc_ex_func(num,file,line);
^
305. #ifdef LEVITTE_DEBUG_MEM
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:308:6: Taking true branch
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
307. #endif
308. if (malloc_debug_func != NULL)
^
309. malloc_debug_func(ret, num, file, line, 1);
310.
crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
307. #endif
308. if (malloc_debug_func != NULL)
309. malloc_debug_func(ret, num, file, line, 1);
^
310.
311. /* Create a dependency on the value of 'cleanse_ctr' so our memory
crypto/mem.c:314:12: Taking false branch
312. * sanitisation function can't be optimised out. NB: We only do
313. * this for >2Kb so the overhead doesn't bother us. */
314. if(ret && (num > 2048))
^
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
crypto/mem.c:317:2:
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
317. > return ret;
318. }
319.
crypto/mem.c:318:2: return from a call to CRYPTO_malloc
316.
317. return ret;
318. }
^
319.
320. void *CRYPTO_realloc(void *str, int num, const char *file, int line)
crypto/evp/p_lib.c:306:6: Taking true branch
304.
305. ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
306. if (ret == NULL)
^
307. {
308. EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
crypto/evp/p_lib.c:308:3:
306. if (ret == NULL)
307. {
308. > EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
309. return(NULL);
310. }
crypto/err/err.c:664:1: start of procedure ERR_put_error()
662. /********************************************************/
663.
664. > void ERR_put_error(int lib, int func, int reason, const char *file,
665. int line)
666. {
crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
686. }
687. #endif
688. es=ERR_get_state();
^
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:690:2:
688. es=ERR_get_state();
689.
690. > es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:691:6: Taking false branch
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
^
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
crypto/err/err.c:693:2:
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. > es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
crypto/err/err.c:694:2:
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
694. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
crypto/err/err.c:695:2:
693. es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. > es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
crypto/err/err.c:696:2:
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. > es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Taking false branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Loop condition is false. Leaving loop
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:698:2: return from a call to ERR_put_error
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
^
699.
700. void ERR_clear_error(void)
crypto/evp/p_lib.c:309:3:
307. {
308. EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
309. > return(NULL);
310. }
311. ret->type=EVP_PKEY_NONE;
crypto/evp/p_lib.c:317:2: return from a call to EVP_PKEY_new
315. ret->save_parameters=1;
316. return(ret);
317. }
^
318.
319. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
crypto/asn1/x_pubkey.c:248:6: Taking true branch
246.
247. type=OBJ_obj2nid(key->algor->algorithm);
248. if ((ret = EVP_PKEY_new()) == NULL)
^
249. {
250. X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
crypto/asn1/x_pubkey.c:250:3:
248. if ((ret = EVP_PKEY_new()) == NULL)
249. {
250. > X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
251. goto err;
252. }
crypto/err/err.c:664:1: start of procedure ERR_put_error()
662. /********************************************************/
663.
664. > void ERR_put_error(int lib, int func, int reason, const char *file,
665. int line)
666. {
crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
686. }
687. #endif
688. es=ERR_get_state();
^
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:690:2:
688. es=ERR_get_state();
689.
690. > es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:691:6: Taking false branch
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
^
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
crypto/err/err.c:693:2:
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. > es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
crypto/err/err.c:694:2:
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
694. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
crypto/err/err.c:695:2:
693. es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. > es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
crypto/err/err.c:696:2:
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. > es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Taking false branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Loop condition is false. Leaving loop
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:698:2: return from a call to ERR_put_error
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
^
699.
700. void ERR_clear_error(void)
crypto/asn1/x_pubkey.c:337:1:
335. CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
336. return(ret);
337. > err:
338. if (ret != NULL)
339. EVP_PKEY_free(ret);
crypto/asn1/x_pubkey.c:338:6: Taking false branch
336. return(ret);
337. err:
338. if (ret != NULL)
^
339. EVP_PKEY_free(ret);
340. return(NULL);
crypto/asn1/x_pubkey.c:340:2:
338. if (ret != NULL)
339. EVP_PKEY_free(ret);
340. > return(NULL);
341. }
342.
crypto/asn1/x_pubkey.c:341:2: return from a call to X509_PUBKEY_get
339. EVP_PKEY_free(ret);
340. return(NULL);
341. }
^
342.
343. /* Now two pseudo ASN1 routines that take an EVP_PKEY structure
crypto/x509/x509_cmp.c:363:2: return from a call to X509_get_pubkey
361. return(NULL);
362. return(X509_PUBKEY_get(x->cert_info->key));
363. }
^
364.
365. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
apps/x509.c:1127:2:
1125.
1126. upkey = X509_get_pubkey(xca);
1127. > EVP_PKEY_copy_parameters(upkey,pkey);
1128. EVP_PKEY_free(upkey);
1129.
crypto/evp/p_lib.c:156:1: start of procedure EVP_PKEY_copy_parameters()
154. }
155.
156. > int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
157. {
158. if (to->type != from->type)
crypto/evp/p_lib.c:158:6:
156. int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
157. {
158. > if (to->type != from->type)
159. {
160. EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_DIFFERENT_KEY_TYPES);
| https://github.com/openssl/openssl/blob/00dd8f6d6e703dadab3c50af84ed55ffff598ddc/apps/x509.c/#L1127 |
d2a_code_trace_data_45280 | int index_index(CA_DB *db)
{
if (!TXT_DB_create_index(db->db, DB_serial, NULL,
LHASH_HASH_FN(index_serial),
LHASH_COMP_FN(index_serial))) {
BIO_printf(bio_err,
"error creating serial number index:(%ld,%ld,%ld)\n",
db->db->error, db->db->arg1, db->db->arg2);
return 0;
}
if (db->attributes.unique_subject
&& !TXT_DB_create_index(db->db, DB_name, index_name_qual,
LHASH_HASH_FN(index_name),
LHASH_COMP_FN(index_name))) {
BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\n",
db->db->error, db->db->arg1, db->db->arg2);
return 0;
}
return 1;
}
apps/apps.c:1622: error: MEMORY_LEAK
memory dynamically allocated by call to `TXT_DB_create_index()` at line 1612, column 10 is not reachable after line 1622, column 13.
Showing all 141 steps of the trace
apps/apps.c:1610:1: start of procedure index_index()
1608. }
1609.
1610. > int index_index(CA_DB *db)
1611. {
1612. if (!TXT_DB_create_index(db->db, DB_serial, NULL,
apps/apps.c:1612:10:
1610. int index_index(CA_DB *db)
1611. {
1612. > if (!TXT_DB_create_index(db->db, DB_serial, NULL,
1613. LHASH_HASH_FN(index_serial),
1614. LHASH_COMP_FN(index_serial))) {
crypto/txt_db/txt_db.c:196:1: start of procedure TXT_DB_create_index()
194. }
195.
196. > int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
197. LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
198. {
crypto/txt_db/txt_db.c:203:9: Taking false branch
201. int i, n;
202.
203. if (field >= db->num_fields) {
^
204. db->error = DB_ERROR_INDEX_OUT_OF_RANGE;
205. return (0);
crypto/txt_db/txt_db.c:208:9:
206. }
207. /* FIXME: we lose type checking at this point */
208. > if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
209. db->error = DB_ERROR_MALLOC;
210. return (0);
crypto/lhash/lhash.c:113:1: start of procedure lh_new()
111. static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash);
112.
113. > _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
114. {
115. _LHASH *ret;
crypto/lhash/lhash.c:117:9:
115. _LHASH *ret;
116.
117. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
118. goto err0;
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * 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/lhash/lhash.c:117:9: Taking false branch
115. _LHASH *ret;
116.
117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
^
118. goto err0;
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
crypto/lhash/lhash.c:119:9:
117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
118. goto err0;
119. > if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : 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/lhash/lhash.c:119:9: Taking false branch
117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
118. goto err0;
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
^
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
crypto/lhash/lhash.c:121:19: Condition is false
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
^
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
crypto/lhash/lhash.c:121:18:
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
crypto/lhash/lhash.c:121:5:
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
crypto/lhash/lhash.c:122:19: Condition is false
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
^
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
crypto/lhash/lhash.c:122:18:
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
crypto/lhash/lhash.c:122:5:
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
crypto/lhash/lhash.c:123:5:
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. > ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
125. ret->pmax = MIN_NODES / 2;
crypto/lhash/lhash.c:124:5:
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
124. > ret->num_alloc_nodes = MIN_NODES;
125. ret->pmax = MIN_NODES / 2;
126. ret->up_load = UP_LOAD;
crypto/lhash/lhash.c:125:5:
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
125. > ret->pmax = MIN_NODES / 2;
126. ret->up_load = UP_LOAD;
127. ret->down_load = DOWN_LOAD;
crypto/lhash/lhash.c:126:5:
124. ret->num_alloc_nodes = MIN_NODES;
125. ret->pmax = MIN_NODES / 2;
126. > ret->up_load = UP_LOAD;
127. ret->down_load = DOWN_LOAD;
128. return (ret);
crypto/lhash/lhash.c:127:5:
125. ret->pmax = MIN_NODES / 2;
126. ret->up_load = UP_LOAD;
127. > ret->down_load = DOWN_LOAD;
128. return (ret);
129.
crypto/lhash/lhash.c:128:5:
126. ret->up_load = UP_LOAD;
127. ret->down_load = DOWN_LOAD;
128. > return (ret);
129.
130. err1:
crypto/lhash/lhash.c:134:1: return from a call to lh_new
132. err0:
133. return (NULL);
134. > }
135.
136. void lh_free(_LHASH *lh)
crypto/txt_db/txt_db.c:208:9: Taking false branch
206. }
207. /* FIXME: we lose type checking at this point */
208. if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
^
209. db->error = DB_ERROR_MALLOC;
210. return (0);
crypto/txt_db/txt_db.c:212:5:
210. return (0);
211. }
212. > n = sk_OPENSSL_PSTRING_num(db->data);
213. for (i = 0; i < n; i++) {
214. r = sk_OPENSSL_PSTRING_value(db->data, i);
include/openssl/txt_db.h:80:1: start of procedure sk_OPENSSL_PSTRING_num()
78.
79. typedef OPENSSL_STRING *OPENSSL_PSTRING;
80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
81.
82. typedef struct txt_db_st {
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)
include/openssl/txt_db.h:80:1: return from a call to sk_OPENSSL_PSTRING_num
78.
79. typedef OPENSSL_STRING *OPENSSL_PSTRING;
80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
81.
82. typedef struct txt_db_st {
crypto/txt_db/txt_db.c:213:10:
211. }
212. n = sk_OPENSSL_PSTRING_num(db->data);
213. > for (i = 0; i < n; i++) {
214. r = sk_OPENSSL_PSTRING_value(db->data, i);
215. if ((qual != NULL) && (qual(r) == 0))
crypto/txt_db/txt_db.c:213:17: Loop condition is false. Leaving loop
211. }
212. n = sk_OPENSSL_PSTRING_num(db->data);
213. for (i = 0; i < n; i++) {
^
214. r = sk_OPENSSL_PSTRING_value(db->data, i);
215. if ((qual != NULL) && (qual(r) == 0))
crypto/txt_db/txt_db.c:225:5:
223. }
224. }
225. > lh_OPENSSL_STRING_free(db->index[field]);
226. db->index[field] = idx;
227. db->qual[field] = qual;
include/openssl/lhash.h:270:1: start of procedure lh_OPENSSL_STRING_free()
268. lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
269.
270. > DEFINE_LHASH_OF(OPENSSL_STRING);
271. DEFINE_LHASH_OF(OPENSSL_CSTRING);
272.
include/openssl/lhash.h:270:1: return from a call to lh_OPENSSL_STRING_free
268. lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
269.
270. > DEFINE_LHASH_OF(OPENSSL_STRING);
271. DEFINE_LHASH_OF(OPENSSL_CSTRING);
272.
crypto/txt_db/txt_db.c:226:5:
224. }
225. lh_OPENSSL_STRING_free(db->index[field]);
226. > db->index[field] = idx;
227. db->qual[field] = qual;
228. return (1);
crypto/txt_db/txt_db.c:227:5:
225. lh_OPENSSL_STRING_free(db->index[field]);
226. db->index[field] = idx;
227. > db->qual[field] = qual;
228. return (1);
229. }
crypto/txt_db/txt_db.c:228:5:
226. db->index[field] = idx;
227. db->qual[field] = qual;
228. > return (1);
229. }
230.
crypto/txt_db/txt_db.c:229:1: return from a call to TXT_DB_create_index
227. db->qual[field] = qual;
228. return (1);
229. > }
230.
231. long TXT_DB_write(BIO *out, TXT_DB *db)
apps/apps.c:1612:10: Taking false branch
1610. int index_index(CA_DB *db)
1611. {
1612. if (!TXT_DB_create_index(db->db, DB_serial, NULL,
^
1613. LHASH_HASH_FN(index_serial),
1614. LHASH_COMP_FN(index_serial))) {
apps/apps.c:1621:9: Taking true branch
1619. }
1620.
1621. if (db->attributes.unique_subject
^
1622. && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
1623. LHASH_HASH_FN(index_name),
apps/apps.c:1622:13:
1620.
1621. if (db->attributes.unique_subject
1622. > && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
1623. LHASH_HASH_FN(index_name),
1624. LHASH_COMP_FN(index_name))) {
crypto/txt_db/txt_db.c:196:1: start of procedure TXT_DB_create_index()
194. }
195.
196. > int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
197. LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
198. {
crypto/txt_db/txt_db.c:203:9: Taking false branch
201. int i, n;
202.
203. if (field >= db->num_fields) {
^
204. db->error = DB_ERROR_INDEX_OUT_OF_RANGE;
205. return (0);
crypto/txt_db/txt_db.c:208:9:
206. }
207. /* FIXME: we lose type checking at this point */
208. > if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
209. db->error = DB_ERROR_MALLOC;
210. return (0);
crypto/lhash/lhash.c:113:1: start of procedure lh_new()
111. static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash);
112.
113. > _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
114. {
115. _LHASH *ret;
crypto/lhash/lhash.c:117:9:
115. _LHASH *ret;
116.
117. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
118. goto err0;
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * 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/lhash/lhash.c:117:9: Taking false branch
115. _LHASH *ret;
116.
117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
^
118. goto err0;
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
crypto/lhash/lhash.c:119:9:
117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
118. goto err0;
119. > if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : 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/lhash/lhash.c:119:9: Taking false branch
117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
118. goto err0;
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
^
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
crypto/lhash/lhash.c:121:19: Condition is false
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
^
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
crypto/lhash/lhash.c:121:18:
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
crypto/lhash/lhash.c:121:5:
119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
120. goto err1;
121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
crypto/lhash/lhash.c:122:19: Condition is false
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
^
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
crypto/lhash/lhash.c:122:18:
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
crypto/lhash/lhash.c:122:5:
120. goto err1;
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
crypto/lhash/lhash.c:123:5:
121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. > ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
125. ret->pmax = MIN_NODES / 2;
crypto/lhash/lhash.c:124:5:
122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
123. ret->num_nodes = MIN_NODES / 2;
124. > ret->num_alloc_nodes = MIN_NODES;
125. ret->pmax = MIN_NODES / 2;
126. ret->up_load = UP_LOAD;
crypto/lhash/lhash.c:125:5:
123. ret->num_nodes = MIN_NODES / 2;
124. ret->num_alloc_nodes = MIN_NODES;
125. > ret->pmax = MIN_NODES / 2;
126. ret->up_load = UP_LOAD;
127. ret->down_load = DOWN_LOAD;
crypto/lhash/lhash.c:126:5:
124. ret->num_alloc_nodes = MIN_NODES;
125. ret->pmax = MIN_NODES / 2;
126. > ret->up_load = UP_LOAD;
127. ret->down_load = DOWN_LOAD;
128. return (ret);
crypto/lhash/lhash.c:127:5:
125. ret->pmax = MIN_NODES / 2;
126. ret->up_load = UP_LOAD;
127. > ret->down_load = DOWN_LOAD;
128. return (ret);
129.
crypto/lhash/lhash.c:128:5:
126. ret->up_load = UP_LOAD;
127. ret->down_load = DOWN_LOAD;
128. > return (ret);
129.
130. err1:
crypto/lhash/lhash.c:134:1: return from a call to lh_new
132. err0:
133. return (NULL);
134. > }
135.
136. void lh_free(_LHASH *lh)
crypto/txt_db/txt_db.c:208:9: Taking false branch
206. }
207. /* FIXME: we lose type checking at this point */
208. if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
^
209. db->error = DB_ERROR_MALLOC;
210. return (0);
crypto/txt_db/txt_db.c:212:5:
210. return (0);
211. }
212. > n = sk_OPENSSL_PSTRING_num(db->data);
213. for (i = 0; i < n; i++) {
214. r = sk_OPENSSL_PSTRING_value(db->data, i);
include/openssl/txt_db.h:80:1: start of procedure sk_OPENSSL_PSTRING_num()
78.
79. typedef OPENSSL_STRING *OPENSSL_PSTRING;
80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
81.
82. typedef struct txt_db_st {
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)
include/openssl/txt_db.h:80:1: return from a call to sk_OPENSSL_PSTRING_num
78.
79. typedef OPENSSL_STRING *OPENSSL_PSTRING;
80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
81.
82. typedef struct txt_db_st {
crypto/txt_db/txt_db.c:213:10:
211. }
212. n = sk_OPENSSL_PSTRING_num(db->data);
213. > for (i = 0; i < n; i++) {
214. r = sk_OPENSSL_PSTRING_value(db->data, i);
215. if ((qual != NULL) && (qual(r) == 0))
crypto/txt_db/txt_db.c:213:17: Loop condition is false. Leaving loop
211. }
212. n = sk_OPENSSL_PSTRING_num(db->data);
213. for (i = 0; i < n; i++) {
^
214. r = sk_OPENSSL_PSTRING_value(db->data, i);
215. if ((qual != NULL) && (qual(r) == 0))
crypto/txt_db/txt_db.c:225:5:
223. }
224. }
225. > lh_OPENSSL_STRING_free(db->index[field]);
226. db->index[field] = idx;
227. db->qual[field] = qual;
include/openssl/lhash.h:270:1: start of procedure lh_OPENSSL_STRING_free()
268. lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
269.
270. > DEFINE_LHASH_OF(OPENSSL_STRING);
271. DEFINE_LHASH_OF(OPENSSL_CSTRING);
272.
include/openssl/lhash.h:270:1: return from a call to lh_OPENSSL_STRING_free
268. lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
269.
270. > DEFINE_LHASH_OF(OPENSSL_STRING);
271. DEFINE_LHASH_OF(OPENSSL_CSTRING);
272.
crypto/txt_db/txt_db.c:226:5:
224. }
225. lh_OPENSSL_STRING_free(db->index[field]);
226. > db->index[field] = idx;
227. db->qual[field] = qual;
228. return (1);
crypto/txt_db/txt_db.c:227:5:
225. lh_OPENSSL_STRING_free(db->index[field]);
226. db->index[field] = idx;
227. > db->qual[field] = qual;
228. return (1);
229. }
crypto/txt_db/txt_db.c:228:5:
226. db->index[field] = idx;
227. db->qual[field] = qual;
228. > return (1);
229. }
230.
crypto/txt_db/txt_db.c:229:1: return from a call to TXT_DB_create_index
227. db->qual[field] = qual;
228. return (1);
229. > }
230.
231. long TXT_DB_write(BIO *out, TXT_DB *db)
| https://github.com/openssl/openssl/blob/fe05264e32327e33f0b0c091479affeecbf55e89/apps/apps.c/#L1622 |
d2a_code_trace_data_45281 | void *lh_delete(_LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
void *ret;
lh->error=0;
rn=getrn(lh,data,&hash);
if (*rn == NULL)
{
lh->num_no_delete++;
return(NULL);
}
else
{
nn= *rn;
*rn=nn->next;
ret=nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
contract(lh);
return(ret);
}
apps/s_client.c:1310: error: INTEGER_OVERFLOW_L1
(0 - 1):unsigned64 by call to `SSL_new`.
Showing all 27 steps of the trace
apps/s_client.c:1277:7: Call
1275. ssl_ctx_add_crls(ctx, crls, crl_download);
1276.
1277. if (!set_cert_key_stuff(ctx,cert,key,chain,build_chain))
^
1278. goto end;
1279.
apps/s_cb.c:264:6: Call
262. if (cert == NULL)
263. return 1;
264. if (SSL_CTX_use_certificate(ctx,cert) <= 0)
^
265. {
266. BIO_printf(bio_err,"error setting certificate\n");
ssl/ssl_rsa.c:410:9: Call
408. return(0);
409. }
410. return(ssl_set_cert(ctx->cert, x));
^
411. }
412.
ssl/ssl_rsa.c:418:7: Call
416. int i;
417.
418. pkey=X509_get_pubkey(x);
^
419. if (pkey == NULL)
420. {
crypto/x509/x509_cmp.c:304:9: Call
302. if ((x == NULL) || (x->cert_info == NULL))
303. return(NULL);
304. return(X509_PUBKEY_get(x->cert_info->key));
^
305. }
306.
crypto/asn1/x_pubkey.c:153:7: Call
151. }
152.
153. if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm)))
^
154. {
155. X509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM);
crypto/evp/p_lib.c:255:9: Call
253. int EVP_PKEY_set_type(EVP_PKEY *pkey, int type)
254. {
255. return pkey_set_type(pkey, type, NULL, -1);
^
256. }
257.
crypto/evp/p_lib.c:232:11: Call
230. ameth = EVP_PKEY_asn1_find_str(&e, str, len);
231. else
232. ameth = EVP_PKEY_asn1_find(&e, type);
^
233. #ifndef OPENSSL_NO_ENGINE
234. if (!pkey && e)
crypto/asn1/ameth_lib.c:194:7: Call
192. ENGINE *e;
193. /* type will contain the final unaliased type */
194. e = ENGINE_get_pkey_asn1_meth_engine(type);
^
195. if (e)
196. {
crypto/engine/tb_asnmth.c:118:9: Call
116. ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid)
117. {
118. return engine_table_select(&pkey_asn1_meth_table, nid);
^
119. }
120.
crypto/engine/eng_table.c:261:6: Call
259. /* Check again inside the lock otherwise we could race against cleanup
260. * operations. But don't worry about a fprintf(stderr). */
261. if(!int_table_check(table, 0)) goto end;
^
262. tmplate.nid = nid;
263. fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);
crypto/engine/eng_table.c:122:11: Call
120. if(*t) return 1;
121. if(!create) return 0;
122. if((lh = lh_ENGINE_PILE_new()) == NULL)
^
123. return 0;
124. *t = (ENGINE_TABLE *)lh;
crypto/lhash/lhash.c:133:2: Assignment
131. ret->up_load=UP_LOAD;
132. ret->down_load=DOWN_LOAD;
133. ret->num_items=0;
^
134.
135. ret->num_expands=0;
apps/s_client.c:1310:6: Call
1308. #endif
1309.
1310. con=SSL_new(ctx);
^
1311. if (sess_in)
1312. {
ssl/ssl_lib.c:275:1: Parameter `ctx->sessions->num_items`
273. }
274.
275. > SSL *SSL_new(SSL_CTX *ctx)
276. {
277. SSL *s;
ssl/ssl_lib.c:397:2: Call
395. s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1;
396.
397. SSL_clear(s);
^
398.
399. CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);
ssl/ssl_lib.c:185:1: Parameter `s->ctx->sessions->num_items`
183. };
184.
185. > int SSL_clear(SSL *s)
186. {
187.
ssl/ssl_lib.c:194:6: Call
192. }
193.
194. if (ssl_clear_bad_session(s))
^
195. {
196. SSL_SESSION_free(s->session);
ssl/ssl_sess.c:988:1: Parameter `s->ctx->sessions->num_items`
986. }
987.
988. > int ssl_clear_bad_session(SSL *s)
989. {
990. if ( (s->session != NULL) &&
ssl/ssl_sess.c:994:3: Call
992. !(SSL_in_init(s) || SSL_in_before(s)))
993. {
994. SSL_CTX_remove_session(s->ctx,s->session);
^
995. return(1);
996. }
ssl/ssl_sess.c:672:1: Parameter `ctx->sessions->num_items`
670. }
671.
672. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
673. {
674. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:674:9: Call
672. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
673. {
674. return remove_session_lock(ctx, c, 1);
^
675. }
676.
ssl/ssl_sess.c:677:1: Parameter `ctx->sessions->num_items`
675. }
676.
677. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
678. {
679. SSL_SESSION *r;
ssl/ssl_sess.c:688:6: Call
686. {
687. ret=1;
688. r=lh_SSL_SESSION_delete(ctx->sessions,c);
^
689. SSL_SESSION_list_remove(ctx,c);
690. }
crypto/lhash/lhash.c:217:1: <LHS trace>
215. }
216.
217. > void *lh_delete(_LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
215. }
216.
217. > void *lh_delete(_LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:240:2: Binary operation: (0 - 1):unsigned64 by call to `SSL_new`
238. }
239.
240. lh->num_items--;
^
241. if ((lh->num_nodes > MIN_NODES) &&
242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
| https://github.com/openssl/openssl/blob/4d2654783c099b3c718795e78c36efbeb85f8597/crypto/lhash/lhash.c/#L240 |
d2a_code_trace_data_45282 | 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);
}
crypto/x509v3/v3_alt.c:146: error: BUFFER_OVERRUN_L3
Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`.
Showing all 6 steps of the trace
crypto/x509v3/v3_alt.c:146:9: Call
144.
145. case GEN_DIRNAME:
146. X509_NAME_oneline(gen->d.dirn, oline, 256);
^
147. X509V3_add_value("DirName", oline, &ret);
148. break;
crypto/x509/x509_obj.c:66:1: <Offset trace>
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: Parameter `len`
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: <Length trace>
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: Parameter `*buf`
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:97:9: Array access: Offset added: [200, 256] 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_45283 | u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
u_char *p, zero, *last;
int d;
float f, scale;
size_t len, slen;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_uint_t width, sign, hex, max_width, frac_width, i;
ngx_str_t *v;
ngx_variable_value_t *vv;
if (max == 0) {
return buf;
}
last = buf + max;
while (*fmt && buf < last) {
if (*fmt == '%') {
i64 = 0;
ui64 = 0;
zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
width = 0;
sign = 1;
hex = 0;
max_width = 0;
frac_width = 0;
slen = (size_t) -1;
while (*fmt >= '0' && *fmt <= '9') {
width = width * 10 + *fmt++ - '0';
}
for ( ;; ) {
switch (*fmt) {
case 'u':
sign = 0;
fmt++;
continue;
case 'm':
max_width = 1;
fmt++;
continue;
case 'X':
hex = 2;
sign = 0;
fmt++;
continue;
case 'x':
hex = 1;
sign = 0;
fmt++;
continue;
case '.':
fmt++;
while (*fmt >= '0' && *fmt <= '9') {
frac_width = frac_width * 10 + *fmt++ - '0';
}
break;
case '*':
slen = va_arg(args, size_t);
fmt++;
continue;
default:
break;
}
break;
}
switch (*fmt) {
case 'V':
v = va_arg(args, ngx_str_t *);
len = v->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, v->data, len);
fmt++;
continue;
case 'v':
vv = va_arg(args, ngx_variable_value_t *);
len = vv->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, vv->data, len);
fmt++;
continue;
case 's':
p = va_arg(args, u_char *);
if (slen == (size_t) -1) {
while (*p && buf < last) {
*buf++ = *p++;
}
} else {
len = (buf + slen < last) ? slen : (size_t) (last - buf);
buf = ngx_cpymem(buf, p, len);
}
fmt++;
continue;
case 'O':
i64 = (int64_t) va_arg(args, off_t);
sign = 1;
break;
case 'P':
i64 = (int64_t) va_arg(args, ngx_pid_t);
sign = 1;
break;
case 'T':
i64 = (int64_t) va_arg(args, time_t);
sign = 1;
break;
case 'M':
ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
if ((ngx_msec_int_t) ms == -1) {
sign = 1;
i64 = -1;
} else {
sign = 0;
ui64 = (uint64_t) ms;
}
break;
case 'z':
if (sign) {
i64 = (int64_t) va_arg(args, ssize_t);
} else {
ui64 = (uint64_t) va_arg(args, size_t);
}
break;
case 'i':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_uint_t);
}
if (max_width) {
width = NGX_INT_T_LEN;
}
break;
case 'd':
if (sign) {
i64 = (int64_t) va_arg(args, int);
} else {
ui64 = (uint64_t) va_arg(args, u_int);
}
break;
case 'l':
if (sign) {
i64 = (int64_t) va_arg(args, long);
} else {
ui64 = (uint64_t) va_arg(args, u_long);
}
break;
case 'D':
if (sign) {
i64 = (int64_t) va_arg(args, int32_t);
} else {
ui64 = (uint64_t) va_arg(args, uint32_t);
}
break;
case 'L':
if (sign) {
i64 = va_arg(args, int64_t);
} else {
ui64 = va_arg(args, uint64_t);
}
break;
case 'A':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
}
if (max_width) {
width = NGX_ATOMIC_T_LEN;
}
break;
case 'f':
f = (float) va_arg(args, double);
if (f < 0) {
*buf++ = '-';
f = -f;
}
ui64 = (int64_t) f;
buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
if (frac_width) {
if (buf < last) {
*buf++ = '.';
}
scale = 1.0;
for (i = 0; i < frac_width; i++) {
scale *= 10.0;
}
ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
}
fmt++;
continue;
#if !(NGX_WIN32)
case 'r':
i64 = (int64_t) va_arg(args, rlim_t);
sign = 1;
break;
#endif
case 'p':
ui64 = (uintptr_t) va_arg(args, void *);
hex = 2;
sign = 0;
zero = '0';
width = NGX_PTR_SIZE * 2;
break;
case 'c':
d = va_arg(args, int);
*buf++ = (u_char) (d & 0xff);
fmt++;
continue;
case 'Z':
*buf++ = '\0';
fmt++;
continue;
case 'N':
#if (NGX_WIN32)
*buf++ = CR;
#endif
*buf++ = LF;
fmt++;
continue;
case '%':
*buf++ = '%';
fmt++;
continue;
default:
*buf++ = *fmt++;
continue;
}
if (sign) {
if (i64 < 0) {
*buf++ = '-';
ui64 = (uint64_t) -i64;
} else {
ui64 = (uint64_t) i64;
}
}
buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
fmt++;
} else {
*buf++ = *fmt++;
}
}
return buf;
}
src/http/ngx_http_variables.c:1421: error: Buffer Overrun L2
Offset: [0, 65535] Size: 28 by call to `ngx_sprintf`.
src/http/ngx_http_variables.c:1416:17: Call
1414. if (clcf->keepalive_header) {
1415.
1416. p = ngx_pnalloc(r->pool, sizeof("timeout=") - 1 + NGX_TIME_T_LEN);
^
1417. if (p == NULL) {
1418. return NGX_ERROR;
src/core/ngx_palloc.c:155:13: Assignment
153.
154. do {
155. m = p->d.last;
^
156.
157. if ((size_t) (p->d.end - m) >= size) {
src/core/ngx_palloc.c:160:17: Assignment
158. p->d.last = m + size;
159.
160. return m;
^
161. }
162.
src/http/ngx_http_variables.c:1416:13: Assignment
1414. if (clcf->keepalive_header) {
1415.
1416. p = ngx_pnalloc(r->pool, sizeof("timeout=") - 1 + NGX_TIME_T_LEN);
^
1417. if (p == NULL) {
1418. return NGX_ERROR;
src/http/ngx_http_variables.c:1421:22: Call
1419. }
1420.
1421. v->len = ngx_sprintf(p, "timeout=%T", clcf->keepalive_header) - p;
^
1422. v->valid = 1;
1423. v->no_cacheable = 0;
src/core/ngx_string.c:95:1: Parameter `*buf`
93.
94.
95. u_char * ngx_cdecl
^
96. ngx_sprintf(u_char *buf, const char *fmt, ...)
97. {
src/core/ngx_string.c:102:9: Call
100.
101. va_start(args, fmt);
102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args);
^
103. va_end(args);
104.
src/core/ngx_string.c:123:1: <Length trace>
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:123:1: Parameter `*buf`
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:244:25: Array access: Offset: [0, 65535] Size: 28 by call to `ngx_sprintf`
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_45284 | 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:1057: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 7]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 9 steps of the trace
ssl/t1_lib.c:1016:1: Parameter `pkt->written`
1014. }
1015.
1016. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al)
1017. {
1018. #ifndef OPENSSL_NO_EC
ssl/t1_lib.c:1057:14: Call
1055. if (s->tlsext_hostname != NULL) {
1056. /* Add TLS extension servername to the Client Hello message */
1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
^
1058. /* Sub-packet for server_name extension */
1059. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:242:1: Parameter `pkt->written`
240. }
241.
242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
243. {
244. unsigned char *data;
ssl/packet.c:250:17: Call
248.
249. if (size > sizeof(unsigned int)
250. || !WPACKET_allocate_bytes(pkt, size, &data)
^
251. || !put_value(data, val, size))
252. return 0;
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 7]):unsigned64 by call to `WPACKET_put_bytes__`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27. size_t reflen;
| https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25 |
d2a_code_trace_data_45285 | int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
int line_size;
int sample_size = av_get_bytes_per_sample(sample_fmt);
int planar = av_sample_fmt_is_planar(sample_fmt);
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
return AVERROR(EINVAL);
line_size = planar ? FFALIGN(nb_samples * sample_size, align) :
FFALIGN(nb_samples * sample_size * nb_channels, align);
if (linesize)
*linesize = line_size;
return planar ? line_size * nb_channels : line_size;
}
libavcodec/takdec.c:760: error: Integer Overflow L2
([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays`.
libavcodec/takdec.c:688:16: Call
686. bitstream_init8(bc, pkt->data, pkt->size);
687.
688. if ((ret = ff_tak_decode_frame_header(avctx, bc, &s->ti, 0)) < 0)
^
689. return ret;
690.
libavcodec/tak.c:124:1: Parameter `ti->frame_samples`
122. }
123.
124. int ff_tak_decode_frame_header(AVCodecContext *avctx, BitstreamContext *bc,
^
125. TAKStreamInfo *ti, int log_level_offset)
126. {
libavcodec/takdec.c:744:21: Assignment
742. avctx->channels = s->ti.channels;
743.
744. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples
^
745. : s->ti.frame_samples;
746.
libavcodec/takdec.c:744:5: Assignment
742. avctx->channels = s->ti.channels;
743.
744. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples
^
745. : s->ti.frame_samples;
746.
libavcodec/takdec.c:760:15: Call
758. if (!s->decode_buffer)
759. return AVERROR(ENOMEM);
760. ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
^
761. s->decode_buffer, avctx->channels,
762. s->nb_samples, AV_SAMPLE_FMT_S32P, 0);
libavutil/samplefmt.c:140:1: Parameter `nb_samples`
138. }
139.
140. int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
^
141. const uint8_t *buf, int nb_channels, int nb_samples,
142. enum AVSampleFormat sample_fmt, int align)
libavutil/samplefmt.c:147:16: Call
145.
146. planar = av_sample_fmt_is_planar(sample_fmt);
147. buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples,
^
148. sample_fmt, align);
149. if (buf_size < 0)
libavutil/samplefmt.c:108:1: <LHS trace>
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:108:1: Parameter `nb_samples`
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays`
122. return AVERROR(EINVAL);
123. align = 1;
124. nb_samples = FFALIGN(nb_samples, 32);
^
125. }
126.
| https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavutil/samplefmt.c/#L124 |
d2a_code_trace_data_45286 | 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");
av_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;
avcodec_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
}
if(video_global_header&2){
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
avcodec_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
}
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_type = CODEC_TYPE_VIDEO;
video_enc->sample_aspect_ratio =
st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
} else {
const char *p;
int i;
AVCodec *codec;
AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
if (video_codec_name) {
codec_id = find_codec_or_die(video_codec_name, CODEC_TYPE_VIDEO, 1);
codec = avcodec_find_encoder_by_name(video_codec_name);
output_codecs[nb_ocodecs] = codec;
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
codec = avcodec_find_encoder(codec_id);
}
video_enc->codec_id = codec_id;
set_context_opts(video_enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
if (codec && codec->supported_framerates && !force_fps)
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
video_enc->time_base.den = fps.num;
video_enc->time_base.num = fps.den;
video_enc->width = frame_width + 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;
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
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->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");
av_exit(1);
}
video_enc->rc_override=
av_realloc(video_enc->rc_override,
sizeof(RcOverride)*(i+1));
video_enc->rc_override[i].start_frame= start;
video_enc->rc_override[i].end_frame = end;
if(q>0){
video_enc->rc_override[i].qscale= q;
video_enc->rc_override[i].quality_factor= 1.0;
}
else{
video_enc->rc_override[i].qscale= 0;
video_enc->rc_override[i].quality_factor= -q/100.0;
}
p= strchr(p, '/');
if(p) p++;
}
video_enc->rc_override_count=i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
if (do_pass) {
if (do_pass == 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
} else {
video_enc->flags |= CODEC_FLAG_PASS2;
}
}
}
nb_ocodecs++;
video_disable = 0;
av_freep(&video_codec_name);
video_stream_copy = 0;
}
ffmpeg.c:2982: error: Null Dereference
pointer `st` last assigned on line 2977 could be null and is dereferenced at line 2982, column 35.
ffmpeg.c:2971:1: start of procedure new_video_stream()
2969. }
2970.
2971. static void new_video_stream(AVFormatContext *oc)
^
2972. {
2973. AVStream *st;
ffmpeg.c:2977:5:
2975. int codec_id;
2976.
2977. st = av_new_stream(oc, oc->nb_streams);
^
2978. if (!st) {
2979. fprintf(stderr, "Could not alloc stream\n");
libavformat/utils.c:2344:1: start of procedure av_new_stream()
2342. }
2343.
2344. AVStream *av_new_stream(AVFormatContext *s, int id)
^
2345. {
2346. AVStream *st;
libavformat/utils.c:2349:9: Taking true branch
2347. int i;
2348.
2349. if (s->nb_streams >= MAX_STREAMS)
^
2350. return NULL;
2351.
libavformat/utils.c:2350:9:
2348.
2349. if (s->nb_streams >= MAX_STREAMS)
2350. return NULL;
^
2351.
2352. st = av_mallocz(sizeof(AVStream));
libavformat/utils.c:2383:1: return from a call to av_new_stream
2381. s->streams[s->nb_streams++] = st;
2382. return st;
2383. }
^
2384.
2385. AVProgram *av_new_program(AVFormatContext *ac, int id)
ffmpeg.c:2978:10: Taking true branch
2976.
2977. st = av_new_stream(oc, oc->nb_streams);
2978. if (!st) {
^
2979. fprintf(stderr, "Could not alloc stream\n");
2980. av_exit(1);
ffmpeg.c:2979:9:
2977. st = av_new_stream(oc, oc->nb_streams);
2978. if (!st) {
2979. fprintf(stderr, "Could not alloc stream\n");
^
2980. av_exit(1);
2981. }
ffmpeg.c:2980:9: Skipping av_exit(): empty list of specs
2978. if (!st) {
2979. fprintf(stderr, "Could not alloc stream\n");
2980. av_exit(1);
^
2981. }
2982. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO);
ffmpeg.c:2982:5:
2980. av_exit(1);
2981. }
2982. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO);
^
2983. bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
2984. video_bitstream_filters= NULL;
| https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L2982 |
d2a_code_trace_data_45287 | static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
{
unsigned char *buf = NULL;
int b, ret = 0, bit, bytes, mask;
if (bits == 0) {
if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
goto toosmall;
BN_zero(rnd);
return 1;
}
if (bits < 0 || (bits == 1 && top > 0))
goto toosmall;
bytes = (bits + 7) / 8;
bit = (bits - 1) % 8;
mask = 0xff << (bit + 1);
buf = OPENSSL_malloc(bytes);
if (buf == NULL) {
BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
goto err;
}
b = flag == NORMAL ? RAND_bytes(buf, bytes) : RAND_priv_bytes(buf, bytes);
if (b <= 0)
goto err;
if (flag == TESTING) {
int i;
unsigned char c;
for (i = 0; i < bytes; i++) {
if (RAND_bytes(&c, 1) <= 0)
goto err;
if (c >= 128 && i > 0)
buf[i] = buf[i - 1];
else if (c < 42)
buf[i] = 0;
else if (c < 84)
buf[i] = 255;
}
}
if (top >= 0) {
if (top) {
if (bit == 0) {
buf[0] = 1;
buf[1] |= 0x80;
} else {
buf[0] |= (3 << (bit - 1));
}
} else {
buf[0] |= (1 << bit);
}
}
buf[0] &= ~mask;
if (bottom)
buf[bytes - 1] |= 1;
if (!BN_bin2bn(buf, bytes, rnd))
goto err;
ret = 1;
err:
OPENSSL_clear_free(buf, bytes);
bn_check_top(rnd);
return ret;
toosmall:
BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
return 0;
}
crypto/bn/bn_rand.c:135: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `bnrand`.
Showing all 13 steps of the trace
crypto/bn/bn_rand.c:123:9: Call
121. }
122.
123. n = BN_num_bits(range); /* n > 0 */
^
124.
125. /* BN_is_bit_set(range, n - 1) always holds */
crypto/bn/bn_lib.c:140:9: Assignment
138.
139. if (BN_is_zero(a))
140. return 0;
^
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
142. }
crypto/bn/bn_rand.c:123:5: Assignment
121. }
122.
123. n = BN_num_bits(range); /* n > 0 */
^
124.
125. /* BN_is_bit_set(range, n - 1) always holds */
crypto/bn/bn_rand.c:135:18: Call
133. */
134. do {
135. if (!bnrand(flag, r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
^
136. return 0;
137.
crypto/bn/bn_rand.c:57:14: <Offset trace>
55. unsigned char c;
56.
57. for (i = 0; i < bytes; i++) {
^
58. if (RAND_bytes(&c, 1) <= 0)
59. goto err;
crypto/bn/bn_rand.c:57:14: Assignment
55. unsigned char c;
56.
57. for (i = 0; i < bytes; i++) {
^
58. if (RAND_bytes(&c, 1) <= 0)
59. goto err;
crypto/bn/bn_rand.c:21:1: <Length trace>
19. } BNRAND_FLAG;
20.
21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
22. {
23. unsigned char *buf = NULL;
crypto/bn/bn_rand.c:21:1: Parameter `bits`
19. } BNRAND_FLAG;
20.
21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
22. {
23. unsigned char *buf = NULL;
crypto/bn/bn_rand.c:35:5: Assignment
33. goto toosmall;
34.
35. bytes = (bits + 7) / 8;
^
36. bit = (bits - 1) % 8;
37. mask = 0xff << (bit + 1);
crypto/bn/bn_rand.c:39:11: Call
37. mask = 0xff << (bit + 1);
38.
39. buf = OPENSSL_malloc(bytes);
^
40. if (buf == NULL) {
41. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/bn/bn_rand.c:39:5: Assignment
37. mask = 0xff << (bit + 1);
38.
39. buf = OPENSSL_malloc(bytes);
^
40. if (buf == NULL) {
41. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_rand.c:83:9: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bnrand`
81. buf[0] &= ~mask;
82. if (bottom) /* set bottom bit if requested */
83. buf[bytes - 1] |= 1;
^
84. if (!BN_bin2bn(buf, bytes, rnd))
85. goto err;
| https://github.com/openssl/openssl/blob/49cd47eaababc8c57871b929080fc1357e2ad7b8/crypto/bn/bn_rand.c/#L83 |
d2a_code_trace_data_45288 | int
dtls1_buffer_message(SSL *s, int is_ccs)
{
pitem *item;
hm_fragment *frag;
unsigned char seq64be[8];
OPENSSL_assert(s->init_off == 0);
frag = dtls1_hm_fragment_new(s->init_num, 0);
memcpy(frag->fragment, s->init_buf->data, s->init_num);
if ( is_ccs)
{
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
((s->version==DTLS1_VERSION)?DTLS1_CCS_HEADER_LENGTH:3) == (unsigned int)s->init_num);
}
else
{
OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num);
}
frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len;
frag->msg_header.seq = s->d1->w_msg_hdr.seq;
frag->msg_header.type = s->d1->w_msg_hdr.type;
frag->msg_header.frag_off = 0;
frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len;
frag->msg_header.is_ccs = is_ccs;
frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx;
frag->msg_header.saved_retransmit_state.write_hash = s->write_hash;
frag->msg_header.saved_retransmit_state.compress = s->compress;
frag->msg_header.saved_retransmit_state.session = s->session;
frag->msg_header.saved_retransmit_state.epoch = s->d1->w_epoch;
memset(seq64be,0,sizeof(seq64be));
seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq,
frag->msg_header.is_ccs)>>8);
seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq,
frag->msg_header.is_ccs));
item = pitem_new(seq64be, frag);
if ( item == NULL)
{
dtls1_hm_fragment_free(frag);
return 0;
}
#if 0
fprintf( stderr, "buffered messge: \ttype = %xx\n", msg_buf->type);
fprintf( stderr, "\t\t\t\t\tlen = %d\n", msg_buf->len);
fprintf( stderr, "\t\t\t\t\tseq_num = %d\n", msg_buf->seq_num);
#endif
pqueue_insert(s->d1->sent_messages, item);
return 1;
}
ssl/d1_both.c:1163: error: NULL_DEREFERENCE
pointer `frag` last assigned on line 1161 could be null and is dereferenced at line 1163, column 9.
Showing all 22 steps of the trace
ssl/d1_both.c:1150:1: start of procedure dtls1_buffer_message()
1148. }
1149.
1150. > int
1151. dtls1_buffer_message(SSL *s, int is_ccs)
1152. {
ssl/d1_both.c:1159:2: Condition is true
1157. /* this function is called immediately after a message has
1158. * been serialized */
1159. OPENSSL_assert(s->init_off == 0);
^
1160.
1161. frag = dtls1_hm_fragment_new(s->init_num, 0);
ssl/d1_both.c:1161:2:
1159. OPENSSL_assert(s->init_off == 0);
1160.
1161. > frag = dtls1_hm_fragment_new(s->init_num, 0);
1162.
1163. memcpy(frag->fragment, s->init_buf->data, s->init_num);
ssl/d1_both.c:172:1: start of procedure dtls1_hm_fragment_new()
170. long max, int *ok);
171.
172. > static hm_fragment *
173. dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
174. {
ssl/d1_both.c:175:2:
173. dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
174. {
175. > hm_fragment *frag = NULL;
176. unsigned char *buf = NULL;
177. unsigned char *bitmask = NULL;
ssl/d1_both.c:176:2:
174. {
175. hm_fragment *frag = NULL;
176. > unsigned char *buf = NULL;
177. unsigned char *bitmask = NULL;
178.
ssl/d1_both.c:177:2:
175. hm_fragment *frag = NULL;
176. unsigned char *buf = NULL;
177. > unsigned char *bitmask = NULL;
178.
179. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
ssl/d1_both.c:179:2:
177. unsigned char *bitmask = NULL;
178.
179. > frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
180. if ( frag == NULL)
181. return NULL;
crypto/mem.c:294:1: start of procedure CRYPTO_malloc()
292. }
293.
294. > void *CRYPTO_malloc(int num, const char *file, int line)
295. {
296. void *ret = NULL;
crypto/mem.c:296:2:
294. void *CRYPTO_malloc(int num, const char *file, int line)
295. {
296. > void *ret = NULL;
297.
298. if (num <= 0) return NULL;
crypto/mem.c:298:6: Taking false branch
296. void *ret = NULL;
297.
298. if (num <= 0) return NULL;
^
299.
300. allow_customize = 0;
crypto/mem.c:300:2:
298. if (num <= 0) return NULL;
299.
300. > allow_customize = 0;
301. if (malloc_debug_func != NULL)
302. {
crypto/mem.c:301:6: Taking false branch
299.
300. allow_customize = 0;
301. if (malloc_debug_func != NULL)
^
302. {
303. allow_customize_debug = 0;
crypto/mem.c:306:2: Skipping __function_pointer__(): unresolved function pointer
304. malloc_debug_func(NULL, num, file, line, 0);
305. }
306. ret = malloc_ex_func(num,file,line);
^
307. #ifdef LEVITTE_DEBUG_MEM
308. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:310:6: Taking false branch
308. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
309. #endif
310. if (malloc_debug_func != NULL)
^
311. malloc_debug_func(ret, num, file, line, 1);
312.
crypto/mem.c:317:12: Taking false branch
315. * sanitisation function can't be optimised out. NB: We only do
316. * this for >2Kb so the overhead doesn't bother us. */
317. if(ret && (num > 2048))
^
318. { extern unsigned char cleanse_ctr;
319. ((unsigned char *)ret)[0] = cleanse_ctr;
crypto/mem.c:323:2:
321. #endif
322.
323. > return ret;
324. }
325. char *CRYPTO_strdup(const char *str, const char *file, int line)
crypto/mem.c:324:2: return from a call to CRYPTO_malloc
322.
323. return ret;
324. }
^
325. char *CRYPTO_strdup(const char *str, const char *file, int line)
326. {
ssl/d1_both.c:180:7: Taking true branch
178.
179. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
180. if ( frag == NULL)
^
181. return NULL;
182.
ssl/d1_both.c:181:3:
179. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
180. if ( frag == NULL)
181. > return NULL;
182.
183. if (frag_len)
ssl/d1_both.c:212:2: return from a call to dtls1_hm_fragment_new
210.
211. return frag;
212. }
^
213.
214. static void
ssl/d1_both.c:1163:2:
1161. frag = dtls1_hm_fragment_new(s->init_num, 0);
1162.
1163. > memcpy(frag->fragment, s->init_buf->data, s->init_num);
1164.
1165. if ( is_ccs)
| https://github.com/openssl/openssl/blob/8decc967dc3089344e1bd0082f87a6b349d30ce7/ssl/d1_both.c/#L1163 |
d2a_code_trace_data_45289 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
bn_check_top(b);
if (a == b)
return a;
if (bn_wexpand(a, b->top) == NULL)
return NULL;
if (b->top > 0)
memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
a->top = b->top;
a->neg = b->neg;
bn_check_top(a);
return a;
}
test/bntest.c:2096: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_is_prime_fasttest_ex`.
Showing all 12 steps of the trace
test/bntest.c:2095:10: Call
2093. * do_trial_division was set. */
2094. if (r == NULL ||
2095. !BN_set_word(r, 3) ||
^
2096. BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
2097. 0 /* do_trial_division */, NULL) != 1 ||
crypto/bn/bn_lib.c:395:1: Parameter `*a->d`
393. }
394.
395. > int BN_set_word(BIGNUM *a, BN_ULONG w)
396. {
397. bn_check_top(a);
crypto/bn/bn_lib.c:398:9: Call
396. {
397. bn_check_top(a);
398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
399. return (0);
400. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
test/bntest.c:2096:9: Call
2094. if (r == NULL ||
2095. !BN_set_word(r, 3) ||
2096. BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
^
2097. 0 /* do_trial_division */, NULL) != 1 ||
2098. BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
crypto/bn/bn_prime.c:153:1: Parameter `*a->d`
151. }
152.
153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
154. int do_trial_division, BN_GENCB *cb)
155. {
crypto/bn/bn_prime.c:197:10: Call
195.
196. /* compute A1 := a - 1 */
197. if (!BN_copy(A1, a))
^
198. goto err;
199. if (!BN_sub_word(A1, 1))
crypto/bn/bn_lib.c:323:1: <Offset trace>
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:323:1: Parameter `b->top`
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:323:1: <Length trace>
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:323:1: Parameter `*b->d`
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:333:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_is_prime_fasttest_ex`
331.
332. if (b->top > 0)
333. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
^
334.
335. a->top = b->top;
| https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L333 |
d2a_code_trace_data_45290 | static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
{
BIGNUM *bn = NULL;
static RSA *rsa_tmp = NULL;
if (!rsa_tmp && ((bn = BN_new()) == NULL))
BIO_printf(bio_err, "Allocation error in generating RSA key\n");
if (!rsa_tmp && bn) {
if (!s_quiet) {
BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
keylength);
(void)BIO_flush(bio_err);
}
if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
!RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
RSA_free(rsa_tmp);
rsa_tmp = NULL;
}
if (!s_quiet) {
BIO_printf(bio_err, "\n");
(void)BIO_flush(bio_err);
}
BN_free(bn);
}
return (rsa_tmp);
}
apps/s_server.c:3116: error: NULL_DEREFERENCE
pointer `rsa_tmp` last assigned on line 3114 could be null and is dereferenced by call to `RSA_free()` at line 3116, column 13.
Showing all 26 steps of the trace
apps/s_server.c:3101:1: start of procedure tmp_rsa_cb()
3099.
3100. #ifndef OPENSSL_NO_RSA
3101. > static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
3102. {
3103. BIGNUM *bn = NULL;
apps/s_server.c:3103:5:
3101. static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
3102. {
3103. > BIGNUM *bn = NULL;
3104. static RSA *rsa_tmp = NULL;
3105.
apps/s_server.c:3104:5:
3102. {
3103. BIGNUM *bn = NULL;
3104. > static RSA *rsa_tmp = NULL;
3105.
3106. if (!rsa_tmp && ((bn = BN_new()) == NULL))
apps/s_server.c:3106:10: Taking true branch
3104. static RSA *rsa_tmp = NULL;
3105.
3106. if (!rsa_tmp && ((bn = BN_new()) == NULL))
^
3107. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3108. if (!rsa_tmp && bn) {
apps/s_server.c:3106:22: Taking false branch
3104. static RSA *rsa_tmp = NULL;
3105.
3106. if (!rsa_tmp && ((bn = BN_new()) == NULL))
^
3107. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3108. if (!rsa_tmp && bn) {
apps/s_server.c:3108:10: Taking true branch
3106. if (!rsa_tmp && ((bn = BN_new()) == NULL))
3107. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3108. if (!rsa_tmp && bn) {
^
3109. if (!s_quiet) {
3110. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
apps/s_server.c:3108:21: Taking true branch
3106. if (!rsa_tmp && ((bn = BN_new()) == NULL))
3107. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3108. if (!rsa_tmp && bn) {
^
3109. if (!s_quiet) {
3110. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
apps/s_server.c:3109:14: Taking false branch
3107. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3108. if (!rsa_tmp && bn) {
3109. if (!s_quiet) {
^
3110. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
3111. keylength);
apps/s_server.c:3114:14:
3112. (void)BIO_flush(bio_err);
3113. }
3114. > if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
3115. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3116. RSA_free(rsa_tmp);
crypto/bn/bn_lib.c:527:1: start of procedure BN_set_word()
525. }
526.
527. > int BN_set_word(BIGNUM *a, BN_ULONG w)
528. {
529. bn_check_top(a);
crypto/bn/bn_lib.c:530:9: Condition is true
528. {
529. bn_check_top(a);
530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
531. return (0);
532. a->neg = 0;
crypto/bn/bn_lib.c:530:9: Taking false branch
528. {
529. bn_check_top(a);
530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
531. return (0);
532. a->neg = 0;
crypto/bn/bn_lib.c:532:5:
530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
531. return (0);
532. > a->neg = 0;
533. a->d[0] = w;
534. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:533:5:
531. return (0);
532. a->neg = 0;
533. > a->d[0] = w;
534. a->top = (w ? 1 : 0);
535. bn_check_top(a);
crypto/bn/bn_lib.c:534:15: Condition is true
532. a->neg = 0;
533. a->d[0] = w;
534. a->top = (w ? 1 : 0);
^
535. bn_check_top(a);
536. return (1);
crypto/bn/bn_lib.c:534:5:
532. a->neg = 0;
533. a->d[0] = w;
534. > a->top = (w ? 1 : 0);
535. bn_check_top(a);
536. return (1);
crypto/bn/bn_lib.c:536:5:
534. a->top = (w ? 1 : 0);
535. bn_check_top(a);
536. > return (1);
537. }
538.
crypto/bn/bn_lib.c:537:1: return from a call to BN_set_word
535. bn_check_top(a);
536. return (1);
537. > }
538.
539. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
apps/s_server.c:3114:14: Taking false branch
3112. (void)BIO_flush(bio_err);
3113. }
3114. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
^
3115. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3116. RSA_free(rsa_tmp);
apps/s_server.c:3114:42:
3112. (void)BIO_flush(bio_err);
3113. }
3114. > if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
3115. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3116. RSA_free(rsa_tmp);
crypto/rsa/rsa_lib.c:72:1: start of procedure RSA_new()
70. static const RSA_METHOD *default_RSA_meth = NULL;
71.
72. > RSA *RSA_new(void)
73. {
74. RSA *r = RSA_new_method(NULL);
crypto/rsa/rsa_lib.c:74:5: Skipping RSA_new_method(): empty list of specs
72. RSA *RSA_new(void)
73. {
74. RSA *r = RSA_new_method(NULL);
^
75.
76. return r;
crypto/rsa/rsa_lib.c:76:5:
74. RSA *r = RSA_new_method(NULL);
75.
76. > return r;
77. }
78.
crypto/rsa/rsa_lib.c:77:1: return from a call to RSA_new
75.
76. return r;
77. > }
78.
79. void RSA_set_default_method(const RSA_METHOD *meth)
apps/s_server.c:3114:42: Taking true branch
3112. (void)BIO_flush(bio_err);
3113. }
3114. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
^
3115. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3116. RSA_free(rsa_tmp);
apps/s_server.c:3116:13:
3114. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
3115. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3116. > RSA_free(rsa_tmp);
3117. rsa_tmp = NULL;
3118. }
| https://github.com/openssl/openssl/blob/f3b9257f8239e06cc30cea47558d37fc540853ee/apps/s_server.c/#L3116 |
d2a_code_trace_data_45291 | static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
{
BIGNUM *bn = NULL;
static RSA *rsa_tmp = NULL;
if (!rsa_tmp && ((bn = BN_new()) == NULL))
BIO_printf(bio_err, "Allocation error in generating RSA key\n");
if (!rsa_tmp && bn) {
if (!s_quiet) {
BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
keylength);
(void)BIO_flush(bio_err);
}
if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
!RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
RSA_free(rsa_tmp);
rsa_tmp = NULL;
}
if (!s_quiet) {
BIO_printf(bio_err, "\n");
(void)BIO_flush(bio_err);
}
BN_free(bn);
}
return (rsa_tmp);
}
apps/s_server.c:3111: error: NULL_DEREFERENCE
pointer `rsa_tmp` last assigned on line 3109 could be null and is dereferenced by call to `RSA_free()` at line 3111, column 13.
Showing all 26 steps of the trace
apps/s_server.c:3096:1: start of procedure tmp_rsa_cb()
3094.
3095. #ifndef OPENSSL_NO_RSA
3096. > static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
3097. {
3098. BIGNUM *bn = NULL;
apps/s_server.c:3098:5:
3096. static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
3097. {
3098. > BIGNUM *bn = NULL;
3099. static RSA *rsa_tmp = NULL;
3100.
apps/s_server.c:3099:5:
3097. {
3098. BIGNUM *bn = NULL;
3099. > static RSA *rsa_tmp = NULL;
3100.
3101. if (!rsa_tmp && ((bn = BN_new()) == NULL))
apps/s_server.c:3101:10: Taking true branch
3099. static RSA *rsa_tmp = NULL;
3100.
3101. if (!rsa_tmp && ((bn = BN_new()) == NULL))
^
3102. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3103. if (!rsa_tmp && bn) {
apps/s_server.c:3101:22: Taking false branch
3099. static RSA *rsa_tmp = NULL;
3100.
3101. if (!rsa_tmp && ((bn = BN_new()) == NULL))
^
3102. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3103. if (!rsa_tmp && bn) {
apps/s_server.c:3103:10: Taking true branch
3101. if (!rsa_tmp && ((bn = BN_new()) == NULL))
3102. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3103. if (!rsa_tmp && bn) {
^
3104. if (!s_quiet) {
3105. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
apps/s_server.c:3103:21: Taking true branch
3101. if (!rsa_tmp && ((bn = BN_new()) == NULL))
3102. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3103. if (!rsa_tmp && bn) {
^
3104. if (!s_quiet) {
3105. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
apps/s_server.c:3104:14: Taking false branch
3102. BIO_printf(bio_err, "Allocation error in generating RSA key\n");
3103. if (!rsa_tmp && bn) {
3104. if (!s_quiet) {
^
3105. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...",
3106. keylength);
apps/s_server.c:3109:14:
3107. (void)BIO_flush(bio_err);
3108. }
3109. > if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
3110. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3111. RSA_free(rsa_tmp);
crypto/bn/bn_lib.c:527:1: start of procedure BN_set_word()
525. }
526.
527. > int BN_set_word(BIGNUM *a, BN_ULONG w)
528. {
529. bn_check_top(a);
crypto/bn/bn_lib.c:530:9: Condition is true
528. {
529. bn_check_top(a);
530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
531. return (0);
532. a->neg = 0;
crypto/bn/bn_lib.c:530:9: Taking false branch
528. {
529. bn_check_top(a);
530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
531. return (0);
532. a->neg = 0;
crypto/bn/bn_lib.c:532:5:
530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
531. return (0);
532. > a->neg = 0;
533. a->d[0] = w;
534. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:533:5:
531. return (0);
532. a->neg = 0;
533. > a->d[0] = w;
534. a->top = (w ? 1 : 0);
535. bn_check_top(a);
crypto/bn/bn_lib.c:534:15: Condition is true
532. a->neg = 0;
533. a->d[0] = w;
534. a->top = (w ? 1 : 0);
^
535. bn_check_top(a);
536. return (1);
crypto/bn/bn_lib.c:534:5:
532. a->neg = 0;
533. a->d[0] = w;
534. > a->top = (w ? 1 : 0);
535. bn_check_top(a);
536. return (1);
crypto/bn/bn_lib.c:536:5:
534. a->top = (w ? 1 : 0);
535. bn_check_top(a);
536. > return (1);
537. }
538.
crypto/bn/bn_lib.c:537:1: return from a call to BN_set_word
535. bn_check_top(a);
536. return (1);
537. > }
538.
539. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
apps/s_server.c:3109:14: Taking false branch
3107. (void)BIO_flush(bio_err);
3108. }
3109. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
^
3110. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3111. RSA_free(rsa_tmp);
apps/s_server.c:3109:42:
3107. (void)BIO_flush(bio_err);
3108. }
3109. > if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
3110. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3111. RSA_free(rsa_tmp);
crypto/rsa/rsa_lib.c:72:1: start of procedure RSA_new()
70. static const RSA_METHOD *default_RSA_meth = NULL;
71.
72. > RSA *RSA_new(void)
73. {
74. RSA *r = RSA_new_method(NULL);
crypto/rsa/rsa_lib.c:74:5: Skipping RSA_new_method(): empty list of specs
72. RSA *RSA_new(void)
73. {
74. RSA *r = RSA_new_method(NULL);
^
75.
76. return r;
crypto/rsa/rsa_lib.c:76:5:
74. RSA *r = RSA_new_method(NULL);
75.
76. > return r;
77. }
78.
crypto/rsa/rsa_lib.c:77:1: return from a call to RSA_new
75.
76. return r;
77. > }
78.
79. void RSA_set_default_method(const RSA_METHOD *meth)
apps/s_server.c:3109:42: Taking true branch
3107. (void)BIO_flush(bio_err);
3108. }
3109. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
^
3110. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3111. RSA_free(rsa_tmp);
apps/s_server.c:3111:13:
3109. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
3110. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
3111. > RSA_free(rsa_tmp);
3112. rsa_tmp = NULL;
3113. }
| https://github.com/openssl/openssl/blob/51cbee35162aecb4ca37ea9688461c79f975aff5/apps/s_server.c/#L3111 |
d2a_code_trace_data_45292 | static void opt_output_file(void *optctx, const char *filename)
{
OptionsContext *o = optctx;
AVFormatContext *oc;
int i, err;
AVOutputFormat *file_oformat;
OutputStream *ost;
InputStream *ist;
if (!strcmp(filename, "-"))
filename = "pipe:";
oc = avformat_alloc_context();
if (!oc) {
print_error(filename, AVERROR(ENOMEM));
exit_program(1);
}
if (o->format) {
file_oformat = av_guess_format(o->format, NULL, NULL);
if (!file_oformat) {
av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format);
exit_program(1);
}
} else {
file_oformat = av_guess_format(NULL, filename, NULL);
if (!file_oformat) {
av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n",
filename);
exit_program(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_avserver_streams(o, oc, filename);
if (err < 0) {
print_error(filename, err);
exit_program(1);
}
} else if (!o->nb_stream_maps) {
#define NEW_STREAM(type, index)\
if (index >= 0) {\
ost = new_ ## type ## _stream(o, oc);\
ost->source_index = index;\
ost->sync_ist = &input_streams[index];\
input_streams[index].discard = 0;\
}
if (!o->video_disable && oc->oformat->video_codec != CODEC_ID_NONE) {
int area = 0, idx = -1;
for (i = 0; i < nb_input_streams; i++) {
ist = &input_streams[i];
if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
ist->st->codec->width * ist->st->codec->height > area) {
area = ist->st->codec->width * ist->st->codec->height;
idx = i;
}
}
NEW_STREAM(video, idx);
}
if (!o->audio_disable && oc->oformat->audio_codec != CODEC_ID_NONE) {
int channels = 0, idx = -1;
for (i = 0; i < nb_input_streams; i++) {
ist = &input_streams[i];
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
ist->st->codec->channels > channels) {
channels = ist->st->codec->channels;
idx = i;
}
}
NEW_STREAM(audio, idx);
}
if (!o->subtitle_disable && oc->oformat->subtitle_codec != CODEC_ID_NONE) {
for (i = 0; i < nb_input_streams; i++)
if (input_streams[i].st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
NEW_STREAM(subtitle, i);
break;
}
}
} else {
for (i = 0; i < o->nb_stream_maps; i++) {
StreamMap *map = &o->stream_maps[i];
if (map->disabled)
continue;
ist = &input_streams[input_files[map->file_index].ist_index + map->stream_index];
switch (ist->st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break;
case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break;
case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break;
case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break;
case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break;
default:
av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d.%d - unsupported type.\n",
map->file_index, map->stream_index);
exit_program(1);
}
ost->source_index = input_files[map->file_index].ist_index + map->stream_index;
ost->sync_ist = &input_streams[input_files[map->sync_file_index].ist_index +
map->sync_stream_index];
ist->discard = 0;
}
}
output_files = grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1);
output_files[nb_output_files - 1].ctx = oc;
output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams;
output_files[nb_output_files - 1].recording_time = o->recording_time;
output_files[nb_output_files - 1].start_time = o->start_time;
output_files[nb_output_files - 1].limit_filesize = o->limit_filesize;
av_dict_copy(&output_files[nb_output_files - 1].opts, format_opts, 0);
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
if (!av_filename_number_test(oc->filename)) {
print_error(oc->filename, AVERROR(EINVAL));
exit_program(1);
}
}
if (!(oc->oformat->flags & AVFMT_NOFILE)) {
if (!file_overwrite &&
(strchr(filename, ':') == NULL ||
filename[1] == ':' ||
av_strstart(filename, "file:", NULL))) {
if (avio_check(filename, 0) == 0) {
if (!using_stdin) {
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
fflush(stderr);
if (!read_yesno()) {
fprintf(stderr, "Not overwriting - exiting\n");
exit_program(1);
}
}
else {
fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
exit_program(1);
}
}
}
if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
print_error(filename, err);
exit_program(1);
}
}
if (o->mux_preload) {
uint8_t buf[64];
snprintf(buf, sizeof(buf), "%d", (int)(o->mux_preload*AV_TIME_BASE));
av_dict_set(&output_files[nb_output_files - 1].opts, "preload", buf, 0);
}
oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE);
oc->flags |= AVFMT_FLAG_NONBLOCK;
if (o->chapters_input_file >= nb_input_files) {
if (o->chapters_input_file == INT_MAX) {
o->chapters_input_file = -1;
for (i = 0; i < nb_input_files; i++)
if (input_files[i].ctx->nb_chapters) {
o->chapters_input_file = i;
break;
}
} else {
av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n",
o->chapters_input_file);
exit_program(1);
}
}
if (o->chapters_input_file >= 0)
copy_chapters(&input_files[o->chapters_input_file], &output_files[nb_output_files - 1],
!o->metadata_chapters_manual);
for (i = 0; i < o->nb_meta_data_maps; i++) {
AVFormatContext *files[2];
AVDictionary **meta[2];
int j;
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
if ((index) < 0 || (index) >= (nb_elems)) {\
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps\n",\
(desc), (index));\
exit_program(1);\
}
int in_file_index = o->meta_data_maps[i][1].file;
if (in_file_index < 0)
continue;
METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file")
files[0] = oc;
files[1] = input_files[in_file_index].ctx;
for (j = 0; j < 2; j++) {
MetadataMap *map = &o->meta_data_maps[i][j];
switch (map->type) {
case 'g':
meta[j] = &files[j]->metadata;
break;
case 's':
METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, "stream")
meta[j] = &files[j]->streams[map->index]->metadata;
break;
case 'c':
METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, "chapter")
meta[j] = &files[j]->chapters[map->index]->metadata;
break;
case 'p':
METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, "program")
meta[j] = &files[j]->programs[map->index]->metadata;
break;
}
}
av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE);
}
if (!o->metadata_global_manual && nb_input_files)
av_dict_copy(&oc->metadata, input_files[0].ctx->metadata,
AV_DICT_DONT_OVERWRITE);
if (!o->metadata_streams_manual)
for (i = output_files[nb_output_files - 1].ost_index; i < nb_output_streams; i++) {
InputStream *ist = &input_streams[output_streams[i].source_index];
av_dict_copy(&output_streams[i].st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE);
}
for (i = 0; i < o->nb_metadata; i++) {
AVDictionary **m;
char type, *val;
int index = 0;
val = strchr(o->metadata[i].u.str, '=');
if (!val) {
av_log(NULL, AV_LOG_FATAL, "No '=' character in metadata string %s.\n",
o->metadata[i].u.str);
exit_program(1);
}
*val++ = 0;
parse_meta_type(o->metadata[i].specifier, &type, &index);
switch (type) {
case 'g':
m = &oc->metadata;
break;
case 's':
if (index < 0 || index >= oc->nb_streams) {
av_log(NULL, AV_LOG_FATAL, "Invalid stream index %d in metadata specifier.\n", index);
exit_program(1);
}
m = &oc->streams[index]->metadata;
break;
case 'c':
if (index < 0 || index >= oc->nb_chapters) {
av_log(NULL, AV_LOG_FATAL, "Invalid chapter index %d in metadata specifier.\n", index);
exit_program(1);
}
m = &oc->chapters[index]->metadata;
break;
default:
av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier);
exit_program(1);
}
av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
}
reset_options(o);
}
avconv.c:3446: error: Null Dereference
pointer `oc` last assigned on line 3425 could be null and is dereferenced at line 3446, column 5.
avconv.c:3413:1: start of procedure opt_output_file()
3411. }
3412.
3413. static void opt_output_file(void *optctx, const char *filename)
^
3414. {
3415. OptionsContext *o = optctx;
avconv.c:3415:5:
3413. static void opt_output_file(void *optctx, const char *filename)
3414. {
3415. OptionsContext *o = optctx;
^
3416. AVFormatContext *oc;
3417. int i, err;
avconv.c:3422:10: Taking true branch
3420. InputStream *ist;
3421.
3422. if (!strcmp(filename, "-"))
^
3423. filename = "pipe:";
3424.
avconv.c:3423:9:
3421.
3422. if (!strcmp(filename, "-"))
3423. filename = "pipe:";
^
3424.
3425. oc = avformat_alloc_context();
avconv.c:3425:5:
3423. filename = "pipe:";
3424.
3425. oc = avformat_alloc_context();
^
3426. if (!oc) {
3427. print_error(filename, AVERROR(ENOMEM));
libavformat/options.c:127:1: start of procedure avformat_alloc_context()
125. }
126.
127. AVFormatContext *avformat_alloc_context(void)
^
128. {
129. AVFormatContext *ic;
libavformat/options.c:130:5:
128. {
129. AVFormatContext *ic;
130. ic = av_malloc(sizeof(AVFormatContext));
^
131. if (!ic) return ic;
132. avformat_get_context_defaults(ic);
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking false branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:83:9: Taking false branch
81. ((char*)ptr)[-1]= diff;
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,32,size))
^
84. ptr = NULL;
85. #elif HAVE_MEMALIGN
libavutil/mem.c:114:5:
112. ptr = malloc(size);
113. #endif
114. return ptr;
^
115. }
116.
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavformat/options.c:131:10: Taking true branch
129. AVFormatContext *ic;
130. ic = av_malloc(sizeof(AVFormatContext));
131. if (!ic) return ic;
^
132. avformat_get_context_defaults(ic);
133. return ic;
libavformat/options.c:131:14:
129. AVFormatContext *ic;
130. ic = av_malloc(sizeof(AVFormatContext));
131. if (!ic) return ic;
^
132. avformat_get_context_defaults(ic);
133. return ic;
libavformat/options.c:134:1: return from a call to avformat_alloc_context
132. avformat_get_context_defaults(ic);
133. return ic;
134. }
^
135.
136. const AVClass *avformat_get_class(void)
avconv.c:3426:10: Taking true branch
3424.
3425. oc = avformat_alloc_context();
3426. if (!oc) {
^
3427. print_error(filename, AVERROR(ENOMEM));
3428. exit_program(1);
avconv.c:3427:9:
3425. oc = avformat_alloc_context();
3426. if (!oc) {
3427. print_error(filename, AVERROR(ENOMEM));
^
3428. exit_program(1);
3429. }
cmdutils.c:435:1: start of procedure print_error()
433. }
434.
435. void print_error(const char *filename, int err)
^
436. {
437. char errbuf[128];
cmdutils.c:438:5:
436. {
437. char errbuf[128];
438. const char *errbuf_ptr = errbuf;
^
439.
440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
cmdutils.c:440:9: Taking true branch
438. const char *errbuf_ptr = errbuf;
439.
440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
^
441. errbuf_ptr = strerror(AVUNERROR(err));
442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
cmdutils.c:441:9: Skipping strerror(): method has no implementation
439.
440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
441. errbuf_ptr = strerror(AVUNERROR(err));
^
442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
443. }
cmdutils.c:442:5: Skipping av_log(): empty list of specs
440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
441. errbuf_ptr = strerror(AVUNERROR(err));
442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
^
443. }
444.
cmdutils.c:443:1: return from a call to print_error
441. errbuf_ptr = strerror(AVUNERROR(err));
442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
443. }
^
444.
445. static int warned_cfg = 0;
avconv.c:3428:9: Skipping exit_program(): empty list of specs
3426. if (!oc) {
3427. print_error(filename, AVERROR(ENOMEM));
3428. exit_program(1);
^
3429. }
3430.
avconv.c:3431:9: Taking true branch
3429. }
3430.
3431. if (o->format) {
^
3432. file_oformat = av_guess_format(o->format, NULL, NULL);
3433. if (!file_oformat) {
avconv.c:3432:9: Skipping av_guess_format(): empty list of specs
3430.
3431. if (o->format) {
3432. file_oformat = av_guess_format(o->format, NULL, NULL);
^
3433. if (!file_oformat) {
3434. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format);
avconv.c:3433:14: Taking false branch
3431. if (o->format) {
3432. file_oformat = av_guess_format(o->format, NULL, NULL);
3433. if (!file_oformat) {
^
3434. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format);
3435. exit_program(1);
avconv.c:3446:5:
3444. }
3445.
3446. oc->oformat = file_oformat;
^
3447. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3448.
| https://github.com/libav/libav/blob/8664682d0e6b6071ca7b3f6b9e350305d3fbcf76/avconv.c/#L3446 |
d2a_code_trace_data_45293 | void avformat_free_context(AVFormatContext *s)
{
int i;
AVStream *st;
av_opt_free(s);
if (s->iformat && s->iformat->priv_class && s->priv_data)
av_opt_free(s->priv_data);
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->parser) {
av_parser_close(st->parser);
av_free_packet(&st->cur_pkt);
}
av_dict_free(&st->metadata);
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec->subtitle_header);
av_free(st->codec);
av_free(st->priv_data);
av_free(st->info);
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
av_dict_free(&s->programs[i]->metadata);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
av_freep(&s->programs);
av_freep(&s->priv_data);
while(s->nb_chapters--) {
av_dict_free(&s->chapters[s->nb_chapters]->metadata);
av_free(s->chapters[s->nb_chapters]);
}
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_freep(&s->streams);
av_free(s);
}
avconv.c:443: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `avformat_free_context`.
avconv.c:443:9: Call
441. if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
442. avio_close(s->pb);
443. avformat_free_context(s);
^
444. av_dict_free(&output_files[i].opts);
445. }
libavformat/utils.c:2620:13: Call
2618. if (st->parser) {
2619. av_parser_close(st->parser);
2620. av_free_packet(&st->cur_pkt);
^
2621. }
2622. av_dict_free(&st->metadata);
libavcodec/avpacket.c:151:1: Parameter `pkt->size`
149. }
150.
151. void av_free_packet(AVPacket *pkt)
^
152. {
153. if (pkt) {
avconv.c:444:9: Call
442. avio_close(s->pb);
443. avformat_free_context(s);
444. av_dict_free(&output_files[i].opts);
^
445. }
446. for(i=0;i<nb_input_files;i++) {
libavutil/dict.c:101:1: Parameter `(*pm)->count`
99. }
100.
101. void av_dict_free(AVDictionary **pm)
^
102. {
103. AVDictionary *m = *pm;
avconv.c:443:9: Call
441. if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
442. avio_close(s->pb);
443. avformat_free_context(s);
^
444. av_dict_free(&output_files[i].opts);
445. }
libavformat/utils.c:2606:1: <LHS trace>
2604. }
2605.
2606. void avformat_free_context(AVFormatContext *s)
^
2607. {
2608. int i;
libavformat/utils.c:2606:1: Parameter `s->nb_programs`
2604. }
2605.
2606. void avformat_free_context(AVFormatContext *s)
^
2607. {
2608. int i;
libavformat/utils.c:2631:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_free_context`
2629. av_free(st);
2630. }
2631. for(i=s->nb_programs-1; i>=0; i--) {
^
2632. av_dict_free(&s->programs[i]->metadata);
2633. av_freep(&s->programs[i]->stream_index);
| https://github.com/libav/libav/blob/06d37fede4d36ea528ef69e4358a5775df016df0/libavformat/utils.c/#L2631 |
d2a_code_trace_data_45294 | static inline void packet_forward(PACKET *pkt, size_t len)
{
pkt->curr += len;
pkt->remaining -= len;
}
ssl/s3_clnt.c:1689: error: INTEGER_OVERFLOW_L2
([0, +oo] - 3):unsigned64 by call to `PACKET_get_bytes`.
Showing all 10 steps of the trace
ssl/s3_clnt.c:1484:10: Call
1482. }
1483.
1484. if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
^
1485. SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
1486. al = SSL_AD_INTERNAL_ERROR;
ssl/packet_locl.h:110:8: Parameter `pkt->remaining`
108. * is being used.
109. */
110. __owur static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf,
^
111. size_t len)
112. {
ssl/s3_clnt.c:1689:14: Call
1687. * ECParameters in this case is just three bytes.
1688. */
1689. if (!PACKET_get_bytes(&pkt, &ecparams, 3)) {
^
1690. SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT);
1691. goto f_err;
ssl/packet_locl.h:332:8: Parameter `len`
330. * freed
331. */
332. __owur static inline int PACKET_get_bytes(PACKET *pkt, unsigned char **data,
^
333. size_t len)
334. {
ssl/packet_locl.h:338:5: Call
336. return 0;
337.
338. packet_forward(pkt, len);
^
339.
340. return 1;
ssl/packet_locl.h:80:1: <LHS trace>
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:80:1: Parameter `pkt->remaining`
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:80:1: <RHS trace>
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:80:1: Parameter `len`
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:83:5: Binary operation: ([0, +oo] - 3):unsigned64 by call to `PACKET_get_bytes`
81. {
82. pkt->curr += len;
83. pkt->remaining -= len;
^
84. }
85.
| https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/packet_locl.h/#L83 |
d2a_code_trace_data_45295 | 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:2831: 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: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:2831:9: Call
2829. pms[1] = s->client_version & 0xff;
2830. /* TODO(size_t): Convert this function */
2831. if (ssl_randbytes(s, pms + 2, (int)(pmslen - 2)) <= 0) {
^
2832. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2833. ERR_R_MALLOC_FAILURE);
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_45296 | 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);
}
apps/ciphers.c:239: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 16 steps of the trace
apps/ciphers.c:179:11: Call
177. }
178. }
179. ssl = SSL_new(ctx);
^
180. if (ssl == NULL)
181. goto err;
ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items`
516. }
517.
518. > SSL *SSL_new(SSL_CTX *ctx)
519. {
520. SSL *s;
apps/ciphers.c:239:5: Call
237. sk_SSL_CIPHER_free(sk);
238. SSL_CTX_free(ctx);
239. SSL_free(ssl);
^
240. return (ret);
241. }
ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items`
924. }
925.
926. > void SSL_free(SSL *s)
927. {
928. int i;
ssl/ssl_lib.c:963:9: Call
961. /* Make the next call work :-) */
962. if (s->session != NULL) {
963. ssl_clear_bad_session(s);
^
964. SSL_SESSION_free(s->session);
965. }
ssl/ssl_sess.c:992:1: Parameter `s->initial_ctx->sessions->num_items`
990. }
991.
992. > int ssl_clear_bad_session(SSL *s)
993. {
994. if ((s->session != NULL) &&
ssl/ssl_sess.c:997:9: Call
995. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
996. !(SSL_in_init(s) || SSL_in_before(s))) {
997. SSL_CTX_remove_session(s->session_ctx, s->session);
^
998. return (1);
999. } else
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_45297 | void CRYPTO_free(void *str, const char *file, int line)
{
if (free_impl != NULL && free_impl != &CRYPTO_free) {
free_impl(str, file, line);
return;
}
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0, file, line);
free(str);
CRYPTO_mem_debug_free(str, 1, file, line);
} else {
free(str);
}
#else
free(str);
#endif
}
crypto/x509v3/v3_pci.c:152: error: USE_AFTER_FREE
call to `CRYPTO_free()` eventually accesses memory that was invalidated by call to `free()` on line 138 indirectly during the call to `CRYPTO_realloc()`.
Showing all 12 steps of the trace
crypto/x509v3/v3_pci.c:85:1: invalidation part of the trace starts here
83. }
84.
85. > static int process_pci_value(CONF_VALUE *val,
86. ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
87. ASN1_OCTET_STRING **policy)
crypto/x509v3/v3_pci.c:85:1: parameter `policy` of process_pci_value
83. }
84.
85. > static int process_pci_value(CONF_VALUE *val,
86. ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
87. ASN1_OCTET_STRING **policy)
crypto/x509v3/v3_pci.c:138:24: when calling `CRYPTO_realloc` here
136. }
137.
138. tmp_data = OPENSSL_realloc((*policy)->data,
^
139. (*policy)->length + val_len + 1);
140. if (tmp_data) {
crypto/mem.c:196:1: parameter `str` of CRYPTO_realloc
194. }
195.
196. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
197. {
198. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
crypto/mem.c:206:9: when calling `CRYPTO_free` here
204.
205. if (num == 0) {
206. CRYPTO_free(str, file, line);
^
207. return NULL;
208. }
crypto/mem.c:253:1: parameter `str` of CRYPTO_free
251. }
252.
253. > void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:269:5: was invalidated by call to `free()`
267. }
268. #else
269. free(str);
^
270. #endif
271. }
crypto/x509v3/v3_pci.c:85:1: use-after-lifetime part of the trace starts here
83. }
84.
85. > static int process_pci_value(CONF_VALUE *val,
86. ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
87. ASN1_OCTET_STRING **policy)
crypto/x509v3/v3_pci.c:85:1: parameter `policy` of process_pci_value
83. }
84.
85. > static int process_pci_value(CONF_VALUE *val,
86. ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
87. ASN1_OCTET_STRING **policy)
crypto/x509v3/v3_pci.c:152:17: when calling `CRYPTO_free` here
150. * too!
151. */
152. OPENSSL_free((*policy)->data);
^
153. (*policy)->data = NULL;
154. (*policy)->length = 0;
crypto/mem.c:253:1: parameter `str` of CRYPTO_free
251. }
252.
253. > void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:269:5: invalid access occurs here
267. }
268. #else
269. free(str);
^
270. #endif
271. }
| https://github.com/openssl/openssl/blob/a055a8815587f402d700093dea0dec6bf34631a3/crypto/mem.c/#L269 |
d2a_code_trace_data_45298 | static int decode_header_trees(SmackVContext *smk) {
GetBitContext gb;
int mmap_size, mclr_size, full_size, type_size;
mmap_size = AV_RL32(smk->avctx->extradata);
mclr_size = AV_RL32(smk->avctx->extradata + 4);
full_size = AV_RL32(smk->avctx->extradata + 8);
type_size = AV_RL32(smk->avctx->extradata + 12);
init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
smk->mmap_tbl = av_malloc(sizeof(int) * 2);
smk->mmap_tbl[0] = 0;
smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
smk->mclr_tbl = av_malloc(sizeof(int) * 2);
smk->mclr_tbl[0] = 0;
smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
smk->full_tbl = av_malloc(sizeof(int) * 2);
smk->full_tbl[0] = 0;
smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
smk->type_tbl = av_malloc(sizeof(int) * 2);
smk->type_tbl[0] = 0;
smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size))
return -1;
}
return 0;
}
libavcodec/smacker.c:287: error: Null Dereference
pointer `&gb->buffer` last assigned on line 285 could be null and is dereferenced by call to `get_bits1()` at line 287, column 9.
libavcodec/smacker.c:276:1: start of procedure decode_header_trees()
274. }
275.
276. static int decode_header_trees(SmackVContext *smk) {
^
277. GetBitContext gb;
278. int mmap_size, mclr_size, full_size, type_size;
libavcodec/smacker.c:280:5:
278. int mmap_size, mclr_size, full_size, type_size;
279.
280. mmap_size = AV_RL32(smk->avctx->extradata);
^
281. mclr_size = AV_RL32(smk->avctx->extradata + 4);
282. full_size = AV_RL32(smk->avctx->extradata + 8);
libavcodec/smacker.c:281:5:
279.
280. mmap_size = AV_RL32(smk->avctx->extradata);
281. mclr_size = AV_RL32(smk->avctx->extradata + 4);
^
282. full_size = AV_RL32(smk->avctx->extradata + 8);
283. type_size = AV_RL32(smk->avctx->extradata + 12);
libavcodec/smacker.c:282:5:
280. mmap_size = AV_RL32(smk->avctx->extradata);
281. mclr_size = AV_RL32(smk->avctx->extradata + 4);
282. full_size = AV_RL32(smk->avctx->extradata + 8);
^
283. type_size = AV_RL32(smk->avctx->extradata + 12);
284.
libavcodec/smacker.c:283:5:
281. mclr_size = AV_RL32(smk->avctx->extradata + 4);
282. full_size = AV_RL32(smk->avctx->extradata + 8);
283. type_size = AV_RL32(smk->avctx->extradata + 12);
^
284.
285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
libavcodec/smacker.c:285:5:
283. type_size = AV_RL32(smk->avctx->extradata + 12);
284.
285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
^
286.
287. if(!get_bits1(&gb)) {
libavcodec/get_bits.h:352:1: start of procedure init_get_bits()
350. * @param bit_size the size of the buffer in bits
351. */
352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
353. int bit_size)
354. {
libavcodec/get_bits.h:355:5:
353. int bit_size)
354. {
355. int buffer_size = (bit_size+7)>>3;
^
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
libavcodec/get_bits.h:356:9: Taking true branch
354. {
355. int buffer_size = (bit_size+7)>>3;
356. if (buffer_size < 0 || bit_size < 0) {
^
357. buffer_size = bit_size = 0;
358. buffer = NULL;
libavcodec/get_bits.h:357:9:
355. int buffer_size = (bit_size+7)>>3;
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
^
358. buffer = NULL;
359. }
libavcodec/get_bits.h:358:9:
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
358. buffer = NULL;
^
359. }
360.
libavcodec/get_bits.h:361:5:
359. }
360.
361. s->buffer = buffer;
^
362. s->size_in_bits = bit_size;
363. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:362:5:
360.
361. s->buffer = buffer;
362. s->size_in_bits = bit_size;
^
363. #if !UNCHECKED_BITSTREAM_READER
364. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:364:5:
362. s->size_in_bits = bit_size;
363. #if !UNCHECKED_BITSTREAM_READER
364. s->size_in_bits_plus8 = bit_size + 8;
^
365. #endif
366. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:366:5:
364. s->size_in_bits_plus8 = bit_size + 8;
365. #endif
366. s->buffer_end = buffer + buffer_size;
^
367. s->index = 0;
368. }
libavcodec/get_bits.h:367:5:
365. #endif
366. s->buffer_end = buffer + buffer_size;
367. s->index = 0;
^
368. }
369.
libavcodec/get_bits.h:368:1: return from a call to init_get_bits
366. s->buffer_end = buffer + buffer_size;
367. s->index = 0;
368. }
^
369.
370. static inline void align_get_bits(GetBitContext *s)
libavcodec/smacker.c:287:9:
285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
286.
287. if(!get_bits1(&gb)) {
^
288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
289. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
libavcodec/get_bits.h:268:1: start of procedure get_bits1()
266. }
267.
268. static inline unsigned int get_bits1(GetBitContext *s)
^
269. {
270. unsigned int index = s->index;
libavcodec/get_bits.h:270:5:
268. static inline unsigned int get_bits1(GetBitContext *s)
269. {
270. unsigned int index = s->index;
^
271. uint8_t result = s->buffer[index>>3];
272. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:271:5:
269. {
270. unsigned int index = s->index;
271. uint8_t result = s->buffer[index>>3];
^
272. #ifdef BITSTREAM_READER_LE
273. result >>= index & 7;
| https://github.com/libav/libav/blob/33bb63cb3e1de6d78c475cf14384089ef3f1867d/libavcodec/smacker.c/#L287 |
d2a_code_trace_data_45299 | static int init_context_frame(MpegEncContext *s)
{
int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
s->mb_width = (s->width + 15) / 16;
s->mb_stride = s->mb_width + 1;
s->b8_stride = s->mb_width * 2 + 1;
s->b4_stride = s->mb_width * 4 + 1;
mb_array_size = s->mb_height * s->mb_stride;
mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
s->h_edge_pos = s->mb_width * 16;
s->v_edge_pos = s->mb_height * 16;
s->mb_num = s->mb_width * s->mb_height;
s->block_wrap[0] =
s->block_wrap[1] =
s->block_wrap[2] =
s->block_wrap[3] = s->b8_stride;
s->block_wrap[4] =
s->block_wrap[5] = s->mb_stride;
y_size = s->b8_stride * (2 * s->mb_height + 1);
c_size = s->mb_stride * (s->mb_height + 1);
yc_size = y_size + 2 * c_size;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
fail);
for (y = 0; y < s->mb_height; y++)
for (x = 0; x < s->mb_width; x++)
s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
s->mb_index2xy[s->mb_height * s->mb_width] =
(s->mb_height - 1) * s->mb_stride + s->mb_width;
if (s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base +
s->mb_stride + 1;
s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base +
s->mb_stride + 1;
s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size *
sizeof(uint16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size *
sizeof(int), fail);
FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab,
mb_array_size * sizeof(float), fail);
FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab,
mb_array_size * sizeof(float), fail);
}
if (s->codec_id == AV_CODEC_ID_MPEG4 ||
(s->flags & CODEC_FLAG_INTERLACED_ME)) {
for (i = 0; i < 2; i++) {
int j, k;
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
FF_ALLOCZ_OR_GOTO(s->avctx,
s->b_field_mv_table_base[i][j][k],
mv_table_size * 2 * sizeof(int16_t),
fail);
s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j],
mb_array_size * 2 * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j],
mv_table_size * 2 * sizeof(int16_t), fail);
s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]
+ s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i],
mb_array_size * 2 * sizeof(uint8_t), fail);
}
}
if (s->out_format == FMT_H263) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);
s->coded_block = s->coded_block_base + s->b8_stride + 1;
FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table,
mb_array_size * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table,
mb_array_size * sizeof(uint8_t), fail);
}
if (s->h263_pred || s->h263_plus || !s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base,
yc_size * sizeof(int16_t), fail);
s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
s->dc_val[2] = s->dc_val[1] + c_size;
for (i = 0; i < yc_size; i++)
s->dc_val_base[i] = 1024;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
memset(s->mbintra_table, 1, mb_array_size);
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
return init_er(s);
fail:
return AVERROR(ENOMEM);
}
libavcodec/mpegvideo.c:887: error: Null Dereference
pointer `s->mb_index2xy` last assigned on line 881 could be null and is dereferenced at line 887, column 5.
libavcodec/mpegvideo.c:852:1: start of procedure init_context_frame()
850. * Initialize and allocates MpegEncContext fields dependent on the resolution.
851. */
852. static int init_context_frame(MpegEncContext *s)
^
853. {
854. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
libavcodec/mpegvideo.c:856:5:
854. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
855.
856. s->mb_width = (s->width + 15) / 16;
^
857. s->mb_stride = s->mb_width + 1;
858. s->b8_stride = s->mb_width * 2 + 1;
libavcodec/mpegvideo.c:857:5:
855.
856. s->mb_width = (s->width + 15) / 16;
857. s->mb_stride = s->mb_width + 1;
^
858. s->b8_stride = s->mb_width * 2 + 1;
859. s->b4_stride = s->mb_width * 4 + 1;
libavcodec/mpegvideo.c:858:5:
856. s->mb_width = (s->width + 15) / 16;
857. s->mb_stride = s->mb_width + 1;
858. s->b8_stride = s->mb_width * 2 + 1;
^
859. s->b4_stride = s->mb_width * 4 + 1;
860. mb_array_size = s->mb_height * s->mb_stride;
libavcodec/mpegvideo.c:859:5:
857. s->mb_stride = s->mb_width + 1;
858. s->b8_stride = s->mb_width * 2 + 1;
859. s->b4_stride = s->mb_width * 4 + 1;
^
860. mb_array_size = s->mb_height * s->mb_stride;
861. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
libavcodec/mpegvideo.c:860:5:
858. s->b8_stride = s->mb_width * 2 + 1;
859. s->b4_stride = s->mb_width * 4 + 1;
860. mb_array_size = s->mb_height * s->mb_stride;
^
861. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
862.
libavcodec/mpegvideo.c:861:5:
859. s->b4_stride = s->mb_width * 4 + 1;
860. mb_array_size = s->mb_height * s->mb_stride;
861. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
^
862.
863. /* set default edge pos, will be overriden
libavcodec/mpegvideo.c:865:5:
863. /* set default edge pos, will be overriden
864. * in decode_header if needed */
865. s->h_edge_pos = s->mb_width * 16;
^
866. s->v_edge_pos = s->mb_height * 16;
867.
libavcodec/mpegvideo.c:866:5:
864. * in decode_header if needed */
865. s->h_edge_pos = s->mb_width * 16;
866. s->v_edge_pos = s->mb_height * 16;
^
867.
868. s->mb_num = s->mb_width * s->mb_height;
libavcodec/mpegvideo.c:868:5:
866. s->v_edge_pos = s->mb_height * 16;
867.
868. s->mb_num = s->mb_width * s->mb_height;
^
869.
870. s->block_wrap[0] =
libavcodec/mpegvideo.c:870:5:
868. s->mb_num = s->mb_width * s->mb_height;
869.
870. s->block_wrap[0] =
^
871. s->block_wrap[1] =
872. s->block_wrap[2] =
libavcodec/mpegvideo.c:874:5:
872. s->block_wrap[2] =
873. s->block_wrap[3] = s->b8_stride;
874. s->block_wrap[4] =
^
875. s->block_wrap[5] = s->mb_stride;
876.
libavcodec/mpegvideo.c:877:5:
875. s->block_wrap[5] = s->mb_stride;
876.
877. y_size = s->b8_stride * (2 * s->mb_height + 1);
^
878. c_size = s->mb_stride * (s->mb_height + 1);
879. yc_size = y_size + 2 * c_size;
libavcodec/mpegvideo.c:878:5:
876.
877. y_size = s->b8_stride * (2 * s->mb_height + 1);
878. c_size = s->mb_stride * (s->mb_height + 1);
^
879. yc_size = y_size + 2 * c_size;
880.
libavcodec/mpegvideo.c:879:5:
877. y_size = s->b8_stride * (2 * s->mb_height + 1);
878. c_size = s->mb_stride * (s->mb_height + 1);
879. yc_size = y_size + 2 * c_size;
^
880.
881. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
libavcodec/mpegvideo.c:881:5:
879. yc_size = y_size + 2 * c_size;
880.
881. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
^
882. fail); // error ressilience code looks cleaner with this
883. for (y = 0; y < s->mb_height; y++)
libavutil/mem.c:205:1: start of procedure av_mallocz()
203. }
204.
205. void *av_mallocz(size_t size)
^
206. {
207. void *ptr = av_malloc(size);
libavutil/mem.c:207:5:
205. void *av_mallocz(size_t size)
206. {
207. void *ptr = av_malloc(size);
^
208. if (ptr)
209. memset(ptr, 0, size);
libavutil/mem.c:62:1: start of procedure av_malloc()
60. * linker will do it automatically. */
61.
62. void *av_malloc(size_t size)
^
63. {
64. void *ptr = NULL;
libavutil/mem.c:64:5:
62. void *av_malloc(size_t size)
63. {
64. void *ptr = NULL;
^
65. #if CONFIG_MEMALIGN_HACK
66. long diff;
libavutil/mem.c:70:9: Taking true branch
68.
69. /* let's disallow possibly ambiguous cases */
70. if (size > (INT_MAX - 32) || !size)
^
71. return NULL;
72.
libavutil/mem.c:71:9:
69. /* let's disallow possibly ambiguous cases */
70. if (size > (INT_MAX - 32) || !size)
71. return NULL;
^
72.
73. #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:208:9: Taking false branch
206. {
207. void *ptr = av_malloc(size);
208. if (ptr)
^
209. memset(ptr, 0, size);
210. return ptr;
libavutil/mem.c:210:5:
208. if (ptr)
209. memset(ptr, 0, size);
210. return ptr;
^
211. }
212.
libavutil/mem.c:211:1: return from a call to av_mallocz
209. memset(ptr, 0, size);
210. return ptr;
211. }
^
212.
213. char *av_strdup(const char *s)
libavcodec/mpegvideo.c:881:5: Taking true branch
879. yc_size = y_size + 2 * c_size;
880.
881. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
^
882. fail); // error ressilience code looks cleaner with this
883. for (y = 0; y < s->mb_height; y++)
libavcodec/mpegvideo.c:881:5: Taking false branch
879. yc_size = y_size + 2 * c_size;
880.
881. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
^
882. fail); // error ressilience code looks cleaner with this
883. for (y = 0; y < s->mb_height; y++)
libavcodec/mpegvideo.c:883:10:
881. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
882. fail); // error ressilience code looks cleaner with this
883. for (y = 0; y < s->mb_height; y++)
^
884. for (x = 0; x < s->mb_width; x++)
885. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
libavcodec/mpegvideo.c:883:17: Loop condition is false. Leaving loop
881. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
882. fail); // error ressilience code looks cleaner with this
883. for (y = 0; y < s->mb_height; y++)
^
884. for (x = 0; x < s->mb_width; x++)
885. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
libavcodec/mpegvideo.c:887:5:
885. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
886.
887. s->mb_index2xy[s->mb_height * s->mb_width] =
^
888. (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed?
889.
| https://github.com/libav/libav/blob/01f6df01b6fdc2d71b82370374cde4bf102928c7/libavcodec/mpegvideo.c/#L887 |
d2a_code_trace_data_45300 | int MAIN(int argc, char **argv)
{
int build_chain = 0;
SSL *con=NULL;
#ifndef OPENSSL_NO_KRB5
KSSL_CTX *kctx;
#endif
int s,k,width,state=0;
char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
int cbuf_len,cbuf_off;
int sbuf_len,sbuf_off;
fd_set readfds,writefds;
short port=PORT;
int full_log=1;
char *host=SSL_HOST_NAME;
const char *unix_path = NULL;
char *xmpphost = NULL;
char *cert_file=NULL,*key_file=NULL,*chain_file=NULL;
int cert_format = FORMAT_PEM, key_format = FORMAT_PEM;
char *passarg = NULL, *pass = NULL;
X509 *cert = NULL;
EVP_PKEY *key = NULL;
STACK_OF(X509) *chain = NULL;
char *CApath=NULL,*CAfile=NULL;
char *chCApath=NULL,*chCAfile=NULL;
char *vfyCApath=NULL,*vfyCAfile=NULL;
int reconnect=0,badop=0,verify=SSL_VERIFY_NONE;
int crlf=0;
int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
SSL_CTX *ctx=NULL;
int ret=1,in_init=1,i,nbio_test=0;
int starttls_proto = PROTO_OFF;
int prexit = 0;
X509_VERIFY_PARAM *vpm = NULL;
int badarg = 0;
const SSL_METHOD *meth=NULL;
int socket_type=SOCK_STREAM;
BIO *sbio;
char *inrand=NULL;
int mbuf_len=0;
struct timeval timeout, *timeoutp;
#ifndef OPENSSL_NO_ENGINE
char *engine_id=NULL;
char *ssl_client_engine_id=NULL;
ENGINE *ssl_client_engine=NULL;
#endif
ENGINE *e=NULL;
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
struct timeval tv;
#if defined(OPENSSL_SYS_BEOS_R5)
int stdin_set = 0;
#endif
#endif
#ifndef OPENSSL_NO_TLSEXT
char *servername = NULL;
tlsextctx tlsextcbp =
{NULL,0};
# ifndef OPENSSL_NO_NEXTPROTONEG
const char *next_proto_neg_in = NULL;
# endif
const char *alpn_in = NULL;
# define MAX_SI_TYPES 100
unsigned short serverinfo_types[MAX_SI_TYPES];
int serverinfo_types_count = 0;
#endif
char *sess_in = NULL;
char *sess_out = NULL;
struct sockaddr peer;
int peerlen = sizeof(peer);
int enable_timeouts = 0 ;
long socket_mtu = 0;
#ifndef OPENSSL_NO_JPAKE
static char *jpake_secret = NULL;
#define no_jpake !jpake_secret
#else
#define no_jpake 1
#endif
#ifndef OPENSSL_NO_SRP
char * srppass = NULL;
int srp_lateuser = 0;
SRP_ARG srp_arg = {NULL,NULL,0,0,0,1024};
#endif
SSL_EXCERT *exc = NULL;
SSL_CONF_CTX *cctx = NULL;
STACK_OF(OPENSSL_STRING) *ssl_args = NULL;
char *crl_file = NULL;
int crl_format = FORMAT_PEM;
int crl_download = 0;
STACK_OF(X509_CRL) *crls = NULL;
int sdebug = 0;
meth=SSLv23_client_method();
apps_startup();
c_Pause=0;
c_quiet=0;
c_ign_eof=0;
c_debug=0;
c_msg=0;
c_showcerts=0;
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
if (!load_config(bio_err, NULL))
goto end;
cctx = SSL_CONF_CTX_new();
if (!cctx)
goto end;
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CLIENT);
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CMDLINE);
if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
((mbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
{
BIO_printf(bio_err,"out of memory\n");
goto end;
}
verify_depth=0;
verify_error=X509_V_OK;
#ifdef FIONBIO
c_nbio=0;
#endif
argc--;
argv++;
while (argc >= 1)
{
if (strcmp(*argv,"-host") == 0)
{
if (--argc < 1) goto bad;
host= *(++argv);
}
else if (strcmp(*argv,"-port") == 0)
{
if (--argc < 1) goto bad;
port=atoi(*(++argv));
if (port == 0) goto bad;
}
else if (strcmp(*argv,"-connect") == 0)
{
if (--argc < 1) goto bad;
if (!extract_host_port(*(++argv),&host,NULL,&port))
goto bad;
}
else if (strcmp(*argv,"-unix") == 0)
{
if (--argc < 1) goto bad;
unix_path = *(++argv);
}
else if (strcmp(*argv,"-xmpphost") == 0)
{
if (--argc < 1) goto bad;
xmpphost= *(++argv);
}
else if (strcmp(*argv,"-verify") == 0)
{
verify=SSL_VERIFY_PEER;
if (--argc < 1) goto bad;
verify_depth=atoi(*(++argv));
if (!c_quiet)
BIO_printf(bio_err,"verify depth is %d\n",verify_depth);
}
else if (strcmp(*argv,"-cert") == 0)
{
if (--argc < 1) goto bad;
cert_file= *(++argv);
}
else if (strcmp(*argv,"-CRL") == 0)
{
if (--argc < 1) goto bad;
crl_file= *(++argv);
}
else if (strcmp(*argv,"-crl_download") == 0)
crl_download = 1;
else if (strcmp(*argv,"-sess_out") == 0)
{
if (--argc < 1) goto bad;
sess_out = *(++argv);
}
else if (strcmp(*argv,"-sess_in") == 0)
{
if (--argc < 1) goto bad;
sess_in = *(++argv);
}
else if (strcmp(*argv,"-certform") == 0)
{
if (--argc < 1) goto bad;
cert_format = str2fmt(*(++argv));
}
else if (strcmp(*argv,"-CRLform") == 0)
{
if (--argc < 1) goto bad;
crl_format = str2fmt(*(++argv));
}
else if (args_verify(&argv, &argc, &badarg, bio_err, &vpm))
{
if (badarg)
goto bad;
continue;
}
else if (strcmp(*argv,"-verify_return_error") == 0)
verify_return_error = 1;
else if (strcmp(*argv,"-verify_quiet") == 0)
verify_quiet = 1;
else if (strcmp(*argv,"-brief") == 0)
{
c_brief = 1;
verify_quiet = 1;
c_quiet = 1;
}
else if (args_excert(&argv, &argc, &badarg, bio_err, &exc))
{
if (badarg)
goto bad;
continue;
}
else if (args_ssl(&argv, &argc, cctx, &badarg, bio_err, &ssl_args))
{
if (badarg)
goto bad;
continue;
}
else if (strcmp(*argv,"-prexit") == 0)
prexit=1;
else if (strcmp(*argv,"-crlf") == 0)
crlf=1;
else if (strcmp(*argv,"-quiet") == 0)
{
c_quiet=1;
c_ign_eof=1;
}
else if (strcmp(*argv,"-ign_eof") == 0)
c_ign_eof=1;
else if (strcmp(*argv,"-no_ign_eof") == 0)
c_ign_eof=0;
else if (strcmp(*argv,"-pause") == 0)
c_Pause=1;
else if (strcmp(*argv,"-debug") == 0)
c_debug=1;
#ifndef OPENSSL_NO_TLSEXT
else if (strcmp(*argv,"-tlsextdebug") == 0)
c_tlsextdebug=1;
else if (strcmp(*argv,"-status") == 0)
c_status_req=1;
#endif
#ifdef WATT32
else if (strcmp(*argv,"-wdebug") == 0)
dbug_init();
#endif
else if (strcmp(*argv,"-msg") == 0)
c_msg=1;
else if (strcmp(*argv,"-msgfile") == 0)
{
if (--argc < 1) goto bad;
bio_c_msg = BIO_new_file(*(++argv), "w");
}
#ifndef OPENSSL_NO_SSL_TRACE
else if (strcmp(*argv,"-trace") == 0)
c_msg=2;
#endif
else if (strcmp(*argv,"-security_debug") == 0)
{ sdebug=1; }
else if (strcmp(*argv,"-security_debug_verbose") == 0)
{ sdebug=2; }
else if (strcmp(*argv,"-showcerts") == 0)
c_showcerts=1;
else if (strcmp(*argv,"-nbio_test") == 0)
nbio_test=1;
else if (strcmp(*argv,"-state") == 0)
state=1;
#ifndef OPENSSL_NO_PSK
else if (strcmp(*argv,"-psk_identity") == 0)
{
if (--argc < 1) goto bad;
psk_identity=*(++argv);
}
else if (strcmp(*argv,"-psk") == 0)
{
size_t j;
if (--argc < 1) goto bad;
psk_key=*(++argv);
for (j = 0; j < strlen(psk_key); j++)
{
if (isxdigit((unsigned char)psk_key[j]))
continue;
BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
goto bad;
}
}
#endif
#ifndef OPENSSL_NO_SRP
else if (strcmp(*argv,"-srpuser") == 0)
{
if (--argc < 1) goto bad;
srp_arg.srplogin= *(++argv);
meth=TLSv1_client_method();
}
else if (strcmp(*argv,"-srppass") == 0)
{
if (--argc < 1) goto bad;
srppass= *(++argv);
meth=TLSv1_client_method();
}
else if (strcmp(*argv,"-srp_strength") == 0)
{
if (--argc < 1) goto bad;
srp_arg.strength=atoi(*(++argv));
BIO_printf(bio_err,"SRP minimal length for N is %d\n",srp_arg.strength);
meth=TLSv1_client_method();
}
else if (strcmp(*argv,"-srp_lateuser") == 0)
{
srp_lateuser= 1;
meth=TLSv1_client_method();
}
else if (strcmp(*argv,"-srp_moregroups") == 0)
{
srp_arg.amp=1;
meth=TLSv1_client_method();
}
#endif
#ifndef OPENSSL_NO_SSL2
else if (strcmp(*argv,"-ssl2") == 0)
meth=SSLv2_client_method();
#endif
#ifndef OPENSSL_NO_SSL3
else if (strcmp(*argv,"-ssl3") == 0)
meth=SSLv3_client_method();
#endif
#ifndef OPENSSL_NO_TLS1
else if (strcmp(*argv,"-tls1_2") == 0)
meth=TLSv1_2_client_method();
else if (strcmp(*argv,"-tls1_1") == 0)
meth=TLSv1_1_client_method();
else if (strcmp(*argv,"-tls1") == 0)
meth=TLSv1_client_method();
#endif
#ifndef OPENSSL_NO_DTLS1
else if (strcmp(*argv,"-dtls") == 0)
{
meth=DTLS_client_method();
socket_type=SOCK_DGRAM;
}
else if (strcmp(*argv,"-dtls1") == 0)
{
meth=DTLSv1_client_method();
socket_type=SOCK_DGRAM;
}
else if (strcmp(*argv,"-dtls1_2") == 0)
{
meth=DTLSv1_2_client_method();
socket_type=SOCK_DGRAM;
}
else if (strcmp(*argv,"-timeout") == 0)
enable_timeouts=1;
else if (strcmp(*argv,"-mtu") == 0)
{
if (--argc < 1) goto bad;
socket_mtu = atol(*(++argv));
}
#endif
else if (strcmp(*argv,"-keyform") == 0)
{
if (--argc < 1) goto bad;
key_format = str2fmt(*(++argv));
}
else if (strcmp(*argv,"-pass") == 0)
{
if (--argc < 1) goto bad;
passarg = *(++argv);
}
else if (strcmp(*argv,"-cert_chain") == 0)
{
if (--argc < 1) goto bad;
chain_file= *(++argv);
}
else if (strcmp(*argv,"-key") == 0)
{
if (--argc < 1) goto bad;
key_file= *(++argv);
}
else if (strcmp(*argv,"-reconnect") == 0)
{
reconnect=5;
}
else if (strcmp(*argv,"-CApath") == 0)
{
if (--argc < 1) goto bad;
CApath= *(++argv);
}
else if (strcmp(*argv,"-chainCApath") == 0)
{
if (--argc < 1) goto bad;
chCApath= *(++argv);
}
else if (strcmp(*argv,"-verifyCApath") == 0)
{
if (--argc < 1) goto bad;
vfyCApath= *(++argv);
}
else if (strcmp(*argv,"-build_chain") == 0)
build_chain = 1;
else if (strcmp(*argv,"-CAfile") == 0)
{
if (--argc < 1) goto bad;
CAfile= *(++argv);
}
else if (strcmp(*argv,"-chainCAfile") == 0)
{
if (--argc < 1) goto bad;
chCAfile= *(++argv);
}
else if (strcmp(*argv,"-verifyCAfile") == 0)
{
if (--argc < 1) goto bad;
vfyCAfile= *(++argv);
}
#ifndef OPENSSL_NO_TLSEXT
# ifndef OPENSSL_NO_NEXTPROTONEG
else if (strcmp(*argv,"-nextprotoneg") == 0)
{
if (--argc < 1) goto bad;
next_proto_neg_in = *(++argv);
}
# endif
else if (strcmp(*argv,"-alpn") == 0)
{
if (--argc < 1) goto bad;
alpn_in = *(++argv);
}
else if (strcmp(*argv,"-serverinfo") == 0)
{
char *c;
int start = 0;
int len;
if (--argc < 1) goto bad;
c = *(++argv);
serverinfo_types_count = 0;
len = strlen(c);
for (i = 0; i <= len; ++i)
{
if (i == len || c[i] == ',')
{
serverinfo_types[serverinfo_types_count]
= atoi(c+start);
serverinfo_types_count++;
start = i+1;
}
if (serverinfo_types_count == MAX_SI_TYPES)
break;
}
}
#endif
#ifdef FIONBIO
else if (strcmp(*argv,"-nbio") == 0)
{ c_nbio=1; }
#endif
else if (strcmp(*argv,"-starttls") == 0)
{
if (--argc < 1) goto bad;
++argv;
if (strcmp(*argv,"smtp") == 0)
starttls_proto = PROTO_SMTP;
else if (strcmp(*argv,"pop3") == 0)
starttls_proto = PROTO_POP3;
else if (strcmp(*argv,"imap") == 0)
starttls_proto = PROTO_IMAP;
else if (strcmp(*argv,"ftp") == 0)
starttls_proto = PROTO_FTP;
else if (strcmp(*argv, "xmpp") == 0)
starttls_proto = PROTO_XMPP;
else
goto bad;
}
#ifndef OPENSSL_NO_ENGINE
else if (strcmp(*argv,"-engine") == 0)
{
if (--argc < 1) goto bad;
engine_id = *(++argv);
}
else if (strcmp(*argv,"-ssl_client_engine") == 0)
{
if (--argc < 1) goto bad;
ssl_client_engine_id = *(++argv);
}
#endif
else if (strcmp(*argv,"-rand") == 0)
{
if (--argc < 1) goto bad;
inrand= *(++argv);
}
#ifndef OPENSSL_NO_TLSEXT
else if (strcmp(*argv,"-servername") == 0)
{
if (--argc < 1) goto bad;
servername= *(++argv);
}
#endif
#ifndef OPENSSL_NO_JPAKE
else if (strcmp(*argv,"-jpake") == 0)
{
if (--argc < 1) goto bad;
jpake_secret = *++argv;
}
#endif
else if (strcmp(*argv,"-use_srtp") == 0)
{
if (--argc < 1) goto bad;
srtp_profiles = *(++argv);
}
else if (strcmp(*argv,"-keymatexport") == 0)
{
if (--argc < 1) goto bad;
keymatexportlabel= *(++argv);
}
else if (strcmp(*argv,"-keymatexportlen") == 0)
{
if (--argc < 1) goto bad;
keymatexportlen=atoi(*(++argv));
if (keymatexportlen == 0) goto bad;
}
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
badop=1;
break;
}
argc--;
argv++;
}
if (badop)
{
bad:
sc_usage();
goto end;
}
if (unix_path && (socket_type != SOCK_STREAM))
{
BIO_printf(bio_err, "Can't use unix sockets and datagrams together\n");
goto end;
}
#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
if (jpake_secret)
{
if (psk_key)
{
BIO_printf(bio_err,
"Can't use JPAKE and PSK together\n");
goto end;
}
psk_identity = "JPAKE";
}
#endif
OpenSSL_add_ssl_algorithms();
SSL_load_error_strings();
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
next_proto.status = -1;
if (next_proto_neg_in)
{
next_proto.data = next_protos_parse(&next_proto.len, next_proto_neg_in);
if (next_proto.data == NULL)
{
BIO_printf(bio_err, "Error parsing -nextprotoneg argument\n");
goto end;
}
}
else
next_proto.data = NULL;
#endif
#ifndef OPENSSL_NO_ENGINE
e = setup_engine(bio_err, engine_id, 1);
if (ssl_client_engine_id)
{
ssl_client_engine = ENGINE_by_id(ssl_client_engine_id);
if (!ssl_client_engine)
{
BIO_printf(bio_err,
"Error getting client auth engine\n");
goto end;
}
}
#endif
if (!app_passwd(bio_err, passarg, NULL, &pass, NULL))
{
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
if (key_file == NULL)
key_file = cert_file;
if (key_file)
{
key = load_key(bio_err, key_file, key_format, 0, pass, e,
"client certificate private key file");
if (!key)
{
ERR_print_errors(bio_err);
goto end;
}
}
if (cert_file)
{
cert = load_cert(bio_err,cert_file,cert_format,
NULL, e, "client certificate file");
if (!cert)
{
ERR_print_errors(bio_err);
goto end;
}
}
if (chain_file)
{
chain = load_certs(bio_err, chain_file,FORMAT_PEM,
NULL, e, "client certificate chain");
if (!chain)
goto end;
}
if (crl_file)
{
X509_CRL *crl;
crl = load_crl(crl_file, crl_format);
if (!crl)
{
BIO_puts(bio_err, "Error loading CRL\n");
ERR_print_errors(bio_err);
goto end;
}
crls = sk_X509_CRL_new_null();
if (!crls || !sk_X509_CRL_push(crls, crl))
{
BIO_puts(bio_err, "Error adding CRL\n");
ERR_print_errors(bio_err);
X509_CRL_free(crl);
goto end;
}
}
if (!load_excert(&exc, bio_err))
goto end;
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
&& !RAND_status())
{
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
}
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
if (bio_c_out == NULL)
{
if (c_quiet && !c_debug)
{
bio_c_out=BIO_new(BIO_s_null());
if (c_msg && !bio_c_msg)
bio_c_msg=BIO_new_fp(stdout,BIO_NOCLOSE);
}
else
{
if (bio_c_out == NULL)
bio_c_out=BIO_new_fp(stdout,BIO_NOCLOSE);
}
}
#ifndef OPENSSL_NO_SRP
if(!app_passwd(bio_err, srppass, NULL, &srp_arg.srppassin, NULL))
{
BIO_printf(bio_err, "Error getting password\n");
goto end;
}
#endif
ctx=SSL_CTX_new(meth);
if (ctx == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
if (sdebug)
ssl_ctx_security_debug(ctx, bio_err, sdebug);
if (vpm)
SSL_CTX_set1_param(ctx, vpm);
if (!args_ssl_call(ctx, bio_err, cctx, ssl_args, 1, no_jpake))
{
ERR_print_errors(bio_err);
goto end;
}
if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile,
crls, crl_download))
{
BIO_printf(bio_err, "Error loading store locations\n");
ERR_print_errors(bio_err);
goto end;
}
#ifndef OPENSSL_NO_ENGINE
if (ssl_client_engine)
{
if (!SSL_CTX_set_client_cert_engine(ctx, ssl_client_engine))
{
BIO_puts(bio_err, "Error setting client auth engine\n");
ERR_print_errors(bio_err);
ENGINE_free(ssl_client_engine);
goto end;
}
ENGINE_free(ssl_client_engine);
}
#endif
#ifndef OPENSSL_NO_PSK
#ifdef OPENSSL_NO_JPAKE
if (psk_key != NULL)
#else
if (psk_key != NULL || jpake_secret)
#endif
{
if (c_debug)
BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client callback\n");
SSL_CTX_set_psk_client_callback(ctx, psk_client_cb);
}
if (srtp_profiles != NULL)
SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles);
#endif
if (exc) ssl_ctx_set_excert(ctx, exc);
if (socket_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
#if !defined(OPENSSL_NO_TLSEXT)
# if !defined(OPENSSL_NO_NEXTPROTONEG)
if (next_proto.data)
SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &next_proto);
# endif
if (alpn_in)
{
unsigned short alpn_len;
unsigned char *alpn = next_protos_parse(&alpn_len, alpn_in);
if (alpn == NULL)
{
BIO_printf(bio_err, "Error parsing -alpn argument\n");
goto end;
}
SSL_CTX_set_alpn_protos(ctx, alpn, alpn_len);
OPENSSL_free(alpn);
}
#endif
#ifndef OPENSSL_NO_TLSEXT
for (i = 0; i < serverinfo_types_count; i++)
{
SSL_CTX_add_client_custom_ext(ctx,
serverinfo_types[i],
NULL, NULL, NULL,
serverinfo_cli_parse_cb,
NULL);
}
#endif
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
#if 0
else
SSL_CTX_set_cipher_list(ctx,getenv("SSL_CIPHER"));
#endif
SSL_CTX_set_verify(ctx,verify,verify_callback);
if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(ctx)))
{
ERR_print_errors(bio_err);
}
ssl_ctx_add_crls(ctx, crls, crl_download);
if (!set_cert_key_stuff(ctx,cert,key,chain,build_chain))
goto end;
#ifndef OPENSSL_NO_TLSEXT
if (servername != NULL)
{
tlsextcbp.biodebug = bio_err;
SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb);
SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp);
}
#ifndef OPENSSL_NO_SRP
if (srp_arg.srplogin)
{
if (!srp_lateuser && !SSL_CTX_set_srp_username(ctx, srp_arg.srplogin))
{
BIO_printf(bio_err,"Unable to set SRP username\n");
goto end;
}
srp_arg.msg = c_msg;
srp_arg.debug = c_debug ;
SSL_CTX_set_srp_cb_arg(ctx,&srp_arg);
SSL_CTX_set_srp_client_pwd_callback(ctx, ssl_give_srp_client_pwd_cb);
SSL_CTX_set_srp_strength(ctx, srp_arg.strength);
if (c_msg || c_debug || srp_arg.amp == 0)
SSL_CTX_set_srp_verify_param_callback(ctx, ssl_srp_verify_param_cb);
}
#endif
#endif
con=SSL_new(ctx);
if (sess_in)
{
SSL_SESSION *sess;
BIO *stmp = BIO_new_file(sess_in, "r");
if (!stmp)
{
BIO_printf(bio_err, "Can't open session file %s\n",
sess_in);
ERR_print_errors(bio_err);
goto end;
}
sess = PEM_read_bio_SSL_SESSION(stmp, NULL, 0, NULL);
BIO_free(stmp);
if (!sess)
{
BIO_printf(bio_err, "Can't open session file %s\n",
sess_in);
ERR_print_errors(bio_err);
goto end;
}
SSL_set_session(con, sess);
SSL_SESSION_free(sess);
}
#ifndef OPENSSL_NO_TLSEXT
if (servername != NULL)
{
if (!SSL_set_tlsext_host_name(con,servername))
{
BIO_printf(bio_err,"Unable to set TLS servername extension.\n");
ERR_print_errors(bio_err);
goto end;
}
}
#endif
#ifndef OPENSSL_NO_KRB5
if (con && (kctx = kssl_ctx_new()) != NULL)
{
SSL_set0_kssl_ctx(con, kctx);
kssl_ctx_setstring(kctx, KSSL_SERVER, host);
}
#endif
#if 0
#ifdef TLSEXT_TYPE_opaque_prf_input
SSL_set_tlsext_opaque_prf_input(con, "Test client", 11);
#endif
#endif
re_start:
#ifdef NO_SYS_UN_H
if (init_client(&s,host,port,socket_type) == 0)
#else
if ((!unix_path && (init_client(&s,host,port,socket_type) == 0)) ||
(unix_path && (init_client_unix(&s,unix_path) == 0)))
#endif
{
BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
SHUTDOWN(s);
goto end;
}
BIO_printf(bio_c_out,"CONNECTED(%08X)\n",s);
#ifdef FIONBIO
if (c_nbio)
{
unsigned long l=1;
BIO_printf(bio_c_out,"turning on non blocking io\n");
if (BIO_socket_ioctl(s,FIONBIO,&l) < 0)
{
ERR_print_errors(bio_err);
goto end;
}
}
#endif
if (c_Pause & 0x01) SSL_set_debug(con, 1);
if (socket_type == SOCK_DGRAM)
{
sbio=BIO_new_dgram(s,BIO_NOCLOSE);
if (getsockname(s, &peer, (void *)&peerlen) < 0)
{
BIO_printf(bio_err, "getsockname:errno=%d\n",
get_last_socket_error());
SHUTDOWN(s);
goto end;
}
(void)BIO_ctrl_set_connected(sbio, 1, &peer);
if (enable_timeouts)
{
timeout.tv_sec = 0;
timeout.tv_usec = DGRAM_RCV_TIMEOUT;
BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_RECV_TIMEOUT, 0, &timeout);
timeout.tv_sec = 0;
timeout.tv_usec = DGRAM_SND_TIMEOUT;
BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout);
}
if (socket_mtu > 28)
{
SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
SSL_set_mtu(con, socket_mtu - 28);
}
else
BIO_ctrl(sbio, BIO_CTRL_DGRAM_MTU_DISCOVER, 0, NULL);
}
else
sbio=BIO_new_socket(s,BIO_NOCLOSE);
if (nbio_test)
{
BIO *test;
test=BIO_new(BIO_f_nbio_test());
sbio=BIO_push(test,sbio);
}
if (c_debug)
{
SSL_set_debug(con, 1);
BIO_set_callback(sbio,bio_dump_callback);
BIO_set_callback_arg(sbio,(char *)bio_c_out);
}
if (c_msg)
{
#ifndef OPENSSL_NO_SSL_TRACE
if (c_msg == 2)
SSL_set_msg_callback(con, SSL_trace);
else
#endif
SSL_set_msg_callback(con, msg_cb);
SSL_set_msg_callback_arg(con, bio_c_msg ? bio_c_msg : bio_c_out);
}
#ifndef OPENSSL_NO_TLSEXT
if (c_tlsextdebug)
{
SSL_set_tlsext_debug_callback(con, tlsext_cb);
SSL_set_tlsext_debug_arg(con, bio_c_out);
}
if (c_status_req)
{
SSL_set_tlsext_status_type(con, TLSEXT_STATUSTYPE_ocsp);
SSL_CTX_set_tlsext_status_cb(ctx, ocsp_resp_cb);
SSL_CTX_set_tlsext_status_arg(ctx, bio_c_out);
#if 0
{
STACK_OF(OCSP_RESPID) *ids = sk_OCSP_RESPID_new_null();
OCSP_RESPID *id = OCSP_RESPID_new();
id->value.byKey = ASN1_OCTET_STRING_new();
id->type = V_OCSP_RESPID_KEY;
ASN1_STRING_set(id->value.byKey, "Hello World", -1);
sk_OCSP_RESPID_push(ids, id);
SSL_set_tlsext_status_ids(con, ids);
}
#endif
}
#endif
#ifndef OPENSSL_NO_JPAKE
if (jpake_secret)
jpake_client_auth(bio_c_out, sbio, jpake_secret);
#endif
SSL_set_bio(con,sbio,sbio);
SSL_set_connect_state(con);
width=SSL_get_fd(con)+1;
read_tty=1;
write_tty=0;
tty_on=0;
read_ssl=1;
write_ssl=1;
cbuf_len=0;
cbuf_off=0;
sbuf_len=0;
sbuf_off=0;
if (starttls_proto == PROTO_SMTP)
{
int foundit=0;
BIO *fbio = BIO_new(BIO_f_buffer());
BIO_push(fbio, sbio);
do
{
mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
}
while (mbuf_len>3 && mbuf[3]=='-');
BIO_printf(fbio,"EHLO openssl.client.net\r\n");
(void)BIO_flush(fbio);
do
{
mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
if (strstr(mbuf,"STARTTLS"))
foundit=1;
}
while (mbuf_len>3 && mbuf[3]=='-');
(void)BIO_flush(fbio);
BIO_pop(fbio);
BIO_free(fbio);
if (!foundit)
BIO_printf(bio_err,
"didn't found starttls in server response,"
" try anyway...\n");
BIO_printf(sbio,"STARTTLS\r\n");
BIO_read(sbio,sbuf,BUFSIZZ);
}
else if (starttls_proto == PROTO_POP3)
{
BIO_read(sbio,mbuf,BUFSIZZ);
BIO_printf(sbio,"STLS\r\n");
BIO_read(sbio,sbuf,BUFSIZZ);
}
else if (starttls_proto == PROTO_IMAP)
{
int foundit=0;
BIO *fbio = BIO_new(BIO_f_buffer());
BIO_push(fbio, sbio);
BIO_gets(fbio,mbuf,BUFSIZZ);
BIO_printf(fbio,". CAPABILITY\r\n");
(void)BIO_flush(fbio);
do
{
mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
if (strstr(mbuf,"STARTTLS"))
foundit=1;
}
while (mbuf_len>3 && mbuf[0]!='.');
(void)BIO_flush(fbio);
BIO_pop(fbio);
BIO_free(fbio);
if (!foundit)
BIO_printf(bio_err,
"didn't found STARTTLS in server response,"
" try anyway...\n");
BIO_printf(sbio,". STARTTLS\r\n");
BIO_read(sbio,sbuf,BUFSIZZ);
}
else if (starttls_proto == PROTO_FTP)
{
BIO *fbio = BIO_new(BIO_f_buffer());
BIO_push(fbio, sbio);
do
{
mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
}
while (mbuf_len>3 && mbuf[3]=='-');
(void)BIO_flush(fbio);
BIO_pop(fbio);
BIO_free(fbio);
BIO_printf(sbio,"AUTH TLS\r\n");
BIO_read(sbio,sbuf,BUFSIZZ);
}
if (starttls_proto == PROTO_XMPP)
{
int seen = 0;
BIO_printf(sbio,"<stream:stream "
"xmlns:stream='http://etherx.jabber.org/streams' "
"xmlns='jabber:client' to='%s' version='1.0'>", xmpphost ?
xmpphost : host);
seen = BIO_read(sbio,mbuf,BUFSIZZ);
mbuf[seen] = 0;
while (!strstr(mbuf, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'") &&
!strstr(mbuf, "<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\""))
{
seen = BIO_read(sbio,mbuf,BUFSIZZ);
if (seen <= 0)
goto shut;
mbuf[seen] = 0;
}
BIO_printf(sbio, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
seen = BIO_read(sbio,sbuf,BUFSIZZ);
sbuf[seen] = 0;
if (!strstr(sbuf, "<proceed"))
goto shut;
mbuf[0] = 0;
}
for (;;)
{
FD_ZERO(&readfds);
FD_ZERO(&writefds);
if ((SSL_version(con) == DTLS1_VERSION) &&
DTLSv1_get_timeout(con, &timeout))
timeoutp = &timeout;
else
timeoutp = NULL;
if (SSL_in_init(con) && !SSL_total_renegotiations(con))
{
in_init=1;
tty_on=0;
}
else
{
tty_on=1;
if (in_init)
{
in_init=0;
#if 0
#ifndef OPENSSL_NO_TLSEXT
if (servername != NULL && !SSL_session_reused(con))
{
BIO_printf(bio_c_out,"Server did %sacknowledge servername extension.\n",tlsextcbp.ack?"":"not ");
}
#endif
#endif
if (sess_out)
{
BIO *stmp = BIO_new_file(sess_out, "w");
if (stmp)
{
PEM_write_bio_SSL_SESSION(stmp, SSL_get_session(con));
BIO_free(stmp);
}
else
BIO_printf(bio_err, "Error writing session file %s\n", sess_out);
}
if (c_brief)
{
BIO_puts(bio_err,
"CONNECTION ESTABLISHED\n");
print_ssl_summary(bio_err, con);
}
print_stuff(bio_c_out,con,full_log);
if (full_log > 0) full_log--;
if (starttls_proto)
{
BIO_printf(bio_err,"%s",mbuf);
starttls_proto = PROTO_OFF;
}
if (reconnect)
{
reconnect--;
BIO_printf(bio_c_out,"drop connection and then reconnect\n");
SSL_shutdown(con);
SSL_set_connect_state(con);
SHUTDOWN(SSL_get_fd(con));
goto re_start;
}
}
}
ssl_pending = read_ssl && SSL_pending(con);
if (!ssl_pending)
{
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
if (tty_on)
{
if (read_tty) openssl_fdset(fileno(stdin),&readfds);
if (write_tty) openssl_fdset(fileno(stdout),&writefds);
}
if (read_ssl)
openssl_fdset(SSL_get_fd(con),&readfds);
if (write_ssl)
openssl_fdset(SSL_get_fd(con),&writefds);
#else
if(!tty_on || !write_tty) {
if (read_ssl)
openssl_fdset(SSL_get_fd(con),&readfds);
if (write_ssl)
openssl_fdset(SSL_get_fd(con),&writefds);
}
#endif
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
i=0;
if(!write_tty) {
if(read_tty) {
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
#if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
if(!i && (!_kbhit() || !read_tty) ) continue;
#else
if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
#endif
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
}
#elif defined(OPENSSL_SYS_NETWARE)
if(!write_tty) {
if(read_tty) {
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
}
#elif defined(OPENSSL_SYS_BEOS_R5)
i=0;
stdin_set = 0;
(void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
if(!write_tty) {
if(read_tty) {
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
if (read(fileno(stdin), sbuf, 0) >= 0)
stdin_set = 1;
if (!i && (stdin_set != 1 || !read_tty))
continue;
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
}
(void)fcntl(fileno(stdin), F_SETFL, 0);
#else
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
#endif
if ( i < 0)
{
BIO_printf(bio_err,"bad select %d\n",
get_last_socket_error());
goto shut;
}
}
if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_handle_timeout(con) > 0)
{
BIO_printf(bio_err,"TIMEOUT occurred\n");
}
if (!ssl_pending && FD_ISSET(SSL_get_fd(con),&writefds))
{
k=SSL_write(con,&(cbuf[cbuf_off]),
(unsigned int)cbuf_len);
switch (SSL_get_error(con,k))
{
case SSL_ERROR_NONE:
cbuf_off+=k;
cbuf_len-=k;
if (k <= 0) goto end;
if (cbuf_len <= 0)
{
read_tty=1;
write_ssl=0;
}
else
{
read_tty=0;
write_ssl=1;
}
break;
case SSL_ERROR_WANT_WRITE:
BIO_printf(bio_c_out,"write W BLOCK\n");
write_ssl=1;
read_tty=0;
break;
case SSL_ERROR_WANT_READ:
BIO_printf(bio_c_out,"write R BLOCK\n");
write_tty=0;
read_ssl=1;
write_ssl=0;
break;
case SSL_ERROR_WANT_X509_LOOKUP:
BIO_printf(bio_c_out,"write X BLOCK\n");
break;
case SSL_ERROR_ZERO_RETURN:
if (cbuf_len != 0)
{
BIO_printf(bio_c_out,"shutdown\n");
ret = 0;
goto shut;
}
else
{
read_tty=1;
write_ssl=0;
break;
}
case SSL_ERROR_SYSCALL:
if ((k != 0) || (cbuf_len != 0))
{
BIO_printf(bio_err,"write:errno=%d\n",
get_last_socket_error());
goto shut;
}
else
{
read_tty=1;
write_ssl=0;
}
break;
case SSL_ERROR_SSL:
ERR_print_errors(bio_err);
goto shut;
}
}
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
else if (!ssl_pending && write_tty)
#else
else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
#endif
{
#ifdef CHARSET_EBCDIC
ascii2ebcdic(&(sbuf[sbuf_off]),&(sbuf[sbuf_off]),sbuf_len);
#endif
i=raw_write_stdout(&(sbuf[sbuf_off]),sbuf_len);
if (i <= 0)
{
BIO_printf(bio_c_out,"DONE\n");
ret = 0;
goto shut;
}
sbuf_len-=i;;
sbuf_off+=i;
if (sbuf_len <= 0)
{
read_ssl=1;
write_tty=0;
}
}
else if (ssl_pending || FD_ISSET(SSL_get_fd(con),&readfds))
{
#ifdef RENEG
{ static int iiii; if (++iiii == 52) { SSL_renegotiate(con); iiii=0; } }
#endif
#if 1
k=SSL_read(con,sbuf,1024 );
#else
k=SSL_read(con,sbuf,16);
{ char zbuf[10240];
printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240));
}
#endif
switch (SSL_get_error(con,k))
{
case SSL_ERROR_NONE:
if (k <= 0)
goto end;
sbuf_off=0;
sbuf_len=k;
read_ssl=0;
write_tty=1;
break;
case SSL_ERROR_WANT_WRITE:
BIO_printf(bio_c_out,"read W BLOCK\n");
write_ssl=1;
read_tty=0;
break;
case SSL_ERROR_WANT_READ:
BIO_printf(bio_c_out,"read R BLOCK\n");
write_tty=0;
read_ssl=1;
if ((read_tty == 0) && (write_ssl == 0))
write_ssl=1;
break;
case SSL_ERROR_WANT_X509_LOOKUP:
BIO_printf(bio_c_out,"read X BLOCK\n");
break;
case SSL_ERROR_SYSCALL:
ret=get_last_socket_error();
if (c_brief)
BIO_puts(bio_err, "CONNECTION CLOSED BY SERVER\n");
else
BIO_printf(bio_err,"read:errno=%d\n",ret);
goto shut;
case SSL_ERROR_ZERO_RETURN:
BIO_printf(bio_c_out,"closed\n");
ret=0;
goto shut;
case SSL_ERROR_SSL:
ERR_print_errors(bio_err);
goto shut;
}
}
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
#if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
else if (_kbhit())
#else
else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
#endif
#elif defined (OPENSSL_SYS_NETWARE)
else if (_kbhit())
#elif defined(OPENSSL_SYS_BEOS_R5)
else if (stdin_set)
#else
else if (FD_ISSET(fileno(stdin),&readfds))
#endif
{
if (crlf)
{
int j, lf_num;
i=raw_read_stdin(cbuf,BUFSIZZ/2);
lf_num = 0;
for (j = 0; j < i; j++)
if (cbuf[j] == '\n')
lf_num++;
for (j = i-1; j >= 0; j--)
{
cbuf[j+lf_num] = cbuf[j];
if (cbuf[j] == '\n')
{
lf_num--;
i++;
cbuf[j+lf_num] = '\r';
}
}
assert(lf_num == 0);
}
else
i=raw_read_stdin(cbuf,BUFSIZZ);
if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q')))
{
BIO_printf(bio_err,"DONE\n");
ret=0;
goto shut;
}
if ((!c_ign_eof) && (cbuf[0] == 'R'))
{
BIO_printf(bio_err,"RENEGOTIATING\n");
SSL_renegotiate(con);
cbuf_len=0;
}
#ifndef OPENSSL_NO_HEARTBEATS
else if ((!c_ign_eof) && (cbuf[0] == 'B'))
{
BIO_printf(bio_err,"HEARTBEATING\n");
SSL_heartbeat(con);
cbuf_len=0;
}
#endif
else
{
cbuf_len=i;
cbuf_off=0;
#ifdef CHARSET_EBCDIC
ebcdic2ascii(cbuf, cbuf, i);
#endif
}
write_ssl=1;
read_tty=0;
}
}
ret=0;
shut:
if (in_init)
print_stuff(bio_c_out,con,full_log);
SSL_shutdown(con);
SHUTDOWN(SSL_get_fd(con));
end:
if (con != NULL)
{
if (prexit != 0)
print_stuff(bio_c_out,con,1);
SSL_free(con);
}
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (next_proto.data)
OPENSSL_free(next_proto.data);
#endif
if (ctx != NULL) SSL_CTX_free(ctx);
if (cert)
X509_free(cert);
if (crls)
sk_X509_CRL_pop_free(crls, X509_CRL_free);
if (key)
EVP_PKEY_free(key);
if (chain)
sk_X509_pop_free(chain, X509_free);
if (pass)
OPENSSL_free(pass);
if (vpm)
X509_VERIFY_PARAM_free(vpm);
ssl_excert_free(exc);
if (ssl_args)
sk_OPENSSL_STRING_free(ssl_args);
if (cctx)
SSL_CONF_CTX_free(cctx);
#ifndef OPENSSL_NO_JPAKE
if (jpake_secret && psk_key)
OPENSSL_free(psk_key);
#endif
if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); }
if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); }
if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); }
if (bio_c_out != NULL)
{
BIO_free(bio_c_out);
bio_c_out=NULL;
}
if (bio_c_msg != NULL)
{
BIO_free(bio_c_msg);
bio_c_msg=NULL;
}
apps_shutdown();
OPENSSL_EXIT(ret);
}
apps/s_client.c:1362: error: UNINITIALIZED_VALUE
The value read from serverinfo_types[_] was never initialized.
Showing all 1 steps of the trace
apps/s_client.c:1362:4:
1360. for (i = 0; i < serverinfo_types_count; i++)
1361. {
1362. > SSL_CTX_add_client_custom_ext(ctx,
1363. serverinfo_types[i],
1364. NULL, NULL, NULL,
| https://github.com/openssl/openssl/blob/360928b7d0f16dde70e26841bbf9e1af727e8b8f/apps/s_client.c/#L1362 |
d2a_code_trace_data_45301 | STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER)
**cipher_list, STACK_OF(SSL_CIPHER)
**cipher_list_by_id,
const char *rule_str, CERT *c)
{
int ok, num_of_ciphers, num_of_alias_max, num_of_group_aliases;
uint32_t disabled_mkey, disabled_auth, disabled_enc, disabled_mac;
STACK_OF(SSL_CIPHER) *cipherstack, *tmp_cipher_list;
const char *rule_p;
CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr;
const SSL_CIPHER **ca_list = NULL;
if (rule_str == NULL || cipher_list == NULL || cipher_list_by_id == NULL)
return NULL;
#ifndef OPENSSL_NO_EC
if (!check_suiteb_cipher_list(ssl_method, c, &rule_str))
return NULL;
#endif
disabled_mkey = disabled_mkey_mask;
disabled_auth = disabled_auth_mask;
disabled_enc = disabled_enc_mask;
disabled_mac = disabled_mac_mask;
num_of_ciphers = ssl_method->num_ciphers();
co_list = OPENSSL_malloc(sizeof(*co_list) * num_of_ciphers);
if (co_list == NULL) {
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
return (NULL);
}
ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
disabled_mkey, disabled_auth, disabled_enc,
disabled_mac, co_list, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kECDHE, SSL_aECDSA, 0, 0, 0, 0, CIPHER_ADD,
-1, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head,
&tail);
ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head,
&tail);
ssl_cipher_apply_rule(0, 0, 0, SSL_AESGCM, 0, 0, 0, CIPHER_ADD, -1,
&head, &tail);
ssl_cipher_apply_rule(0, 0, 0, SSL_CHACHA20, 0, 0, 0, CIPHER_ADD, -1,
&head, &tail);
ssl_cipher_apply_rule(0, 0, 0, SSL_AES ^ SSL_AESGCM, 0, 0, 0, CIPHER_ADD,
-1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, 0, SSL_MD5, 0, 0, CIPHER_ORD, -1, &head,
&tail);
ssl_cipher_apply_rule(0, 0, SSL_aNULL, 0, 0, 0, 0, CIPHER_ORD, -1, &head,
&tail);
ssl_cipher_apply_rule(0, SSL_kRSA, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head,
&tail);
ssl_cipher_apply_rule(0, SSL_kPSK, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head,
&tail);
ssl_cipher_apply_rule(0, 0, 0, SSL_RC4, 0, 0, 0, CIPHER_ORD, -1, &head,
&tail);
if (!ssl_cipher_strength_sort(&head, &tail)) {
OPENSSL_free(co_list);
return NULL;
}
ssl_cipher_apply_rule(0, 0, 0, 0, 0, TLS1_2_VERSION, 0, CIPHER_BUMP, -1,
&head, &tail);
ssl_cipher_apply_rule(0, 0, 0, 0, SSL_AEAD, 0, 0, CIPHER_BUMP, -1,
&head, &tail);
ssl_cipher_apply_rule(0, SSL_kDHE | SSL_kECDHE, 0, 0, 0, 0, 0,
CIPHER_BUMP, -1, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kDHE | SSL_kECDHE, 0, 0, SSL_AEAD, 0, 0,
CIPHER_BUMP, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail);
num_of_group_aliases = OSSL_NELEM(cipher_aliases);
num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
ca_list = OPENSSL_malloc(sizeof(*ca_list) * num_of_alias_max);
if (ca_list == NULL) {
OPENSSL_free(co_list);
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
return (NULL);
}
ssl_cipher_collect_aliases(ca_list, num_of_group_aliases,
disabled_mkey, disabled_auth, disabled_enc,
disabled_mac, head);
ok = 1;
rule_p = rule_str;
if (strncmp(rule_str, "DEFAULT", 7) == 0) {
ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
&head, &tail, ca_list, c);
rule_p += 7;
if (*rule_p == ':')
rule_p++;
}
if (ok && (strlen(rule_p) > 0))
ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c);
OPENSSL_free(ca_list);
if (!ok) {
OPENSSL_free(co_list);
return (NULL);
}
if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) {
OPENSSL_free(co_list);
return (NULL);
}
for (curr = head; curr != NULL; curr = curr->next) {
if (curr->active
&& (!FIPS_mode() || curr->cipher->algo_strength & SSL_FIPS)) {
if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher)) {
OPENSSL_free(co_list);
sk_SSL_CIPHER_free(cipherstack);
return NULL;
}
#ifdef CIPHER_DEBUG
fprintf(stderr, "<%s>\n", curr->cipher->name);
#endif
}
}
OPENSSL_free(co_list);
tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack);
if (tmp_cipher_list == NULL) {
sk_SSL_CIPHER_free(cipherstack);
return NULL;
}
sk_SSL_CIPHER_free(*cipher_list);
*cipher_list = cipherstack;
if (*cipher_list_by_id != NULL)
sk_SSL_CIPHER_free(*cipher_list_by_id);
*cipher_list_by_id = tmp_cipher_list;
(void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id, ssl_cipher_ptr_id_cmp);
sk_SSL_CIPHER_sort(*cipher_list_by_id);
return (cipherstack);
}
test/sslapitest.c:221: error: BUFFER_OVERRUN_L1
Offset: 7 Size: 4 by call to `SSL_CTX_set_cipher_list`.
Showing all 10 steps of the trace
test/sslapitest.c:221:10: Call
219.
220. /* We also want to ensure that we use RSA-based key exchange. */
221. rc = SSL_CTX_set_cipher_list(cctx, "RSA");
^
222. if (rc == 0) {
223. printf("Unable to restrict to RSA key exchange.\n");
ssl/ssl_lib.c:2084:1: Parameter `*str`
2082.
2083. /** specify the ciphers to be used by default by the SSL_CTX */
2084. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str)
2085. {
2086. STACK_OF(SSL_CIPHER) *sk;
ssl/ssl_lib.c:2088:10: Call
2086. STACK_OF(SSL_CIPHER) *sk;
2087.
2088. sk = ssl_create_cipher_list(ctx->method, &ctx->cipher_list,
^
2089. &ctx->cipher_list_by_id, str, ctx->cert);
2090. /*
ssl/ssl_ciph.c:1295:1: <Length trace>
1293. #endif
1294.
1295. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER)
1296. **cipher_list, STACK_OF(SSL_CIPHER)
1297. **cipher_list_by_id,
ssl/ssl_ciph.c:1295:1: Parameter `*rule_str`
1293. #endif
1294.
1295. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER)
1296. **cipher_list, STACK_OF(SSL_CIPHER)
1297. **cipher_list_by_id,
ssl/ssl_ciph.c:1313:10: Call
1311. return NULL;
1312. #ifndef OPENSSL_NO_EC
1313. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str))
^
1314. return NULL;
1315. #endif
ssl/ssl_ciph.c:1241:1: Parameter `**prule_str`
1239.
1240. #ifndef OPENSSL_NO_EC
1241. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c,
1242. const char **prule_str)
1243. {
ssl/ssl_ciph.c:1466:5: Assignment
1464. */
1465. ok = 1;
1466. rule_p = rule_str;
^
1467. if (strncmp(rule_str, "DEFAULT", 7) == 0) {
1468. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
ssl/ssl_ciph.c:1470:9: Assignment
1468. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
1469. &head, &tail, ca_list, c);
1470. rule_p += 7;
^
1471. if (*rule_p == ':')
1472. rule_p++;
ssl/ssl_ciph.c:1471:13: Array access: Offset: 7 Size: 4 by call to `SSL_CTX_set_cipher_list`
1469. &head, &tail, ca_list, c);
1470. rule_p += 7;
1471. if (*rule_p == ':')
^
1472. rule_p++;
1473. }
| https://github.com/openssl/openssl/blob/6f8950a3cc466a7e2660dd9d7c8e9d11f47643ed/ssl/ssl_ciph.c/#L1471 |
d2a_code_trace_data_45302 | static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
{
const char *s = *t;
int64_t v = 0;
if (*s == '9' || *s == '8' || !ossl_isdigit(*s))
return 0;
do {
v = (v << 3) + (*s - '0');
} while (ossl_isdigit(*++s) && *s != '9' && *s != '8');
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT,
"HERE-->%s", *t);
return 0;
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_NUMBER;
res->v.int_val = v;
return 1;
}
test/property_test.c:352: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add`.
Showing all 23 steps of the trace
test/property_test.c:335:1: Array declaration
333. }
334.
335. > static int test_query_cache_stochastic(void)
336. {
337. const int max = 10000, tail = 10;
test/property_test.c:352:14: Call
350. v[i] = 2 * i;
351. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i);
352. if (!TEST_true(ossl_method_store_add(store, NULL, i, buf, "abc",
^
353. NULL, NULL))
354. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i))
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:213:28: Call
211. ossl_method_cache_flush(store, nid);
212. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
213. impl->properties = ossl_parse_property(store->ctx, properties);
^
214. if (impl->properties == NULL)
215. goto err;
crypto/property/property_parse.c:329:1: Parameter `*defn`
327. }
328.
329. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn)
330. {
331. PROPERTY_DEFINITION *prop = NULL;
crypto/property/property_parse.c:334:5: Assignment
332. OSSL_PROPERTY_LIST *res = NULL;
333. STACK_OF(PROPERTY_DEFINITION) *sk;
334. const char *s = defn;
^
335. int done;
336.
crypto/property/property_parse.c:340:9: Call
338. return NULL;
339.
340. s = skip_space(s);
^
341. done = *s == '\0';
342. while (!done) {
crypto/property/property_parse.c:52:1: Parameter `*s`
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:56:5: Assignment
54. while (ossl_isspace(*s))
55. s++;
56. return s;
^
57. }
58.
crypto/property/property_parse.c:340:5: Assignment
338. return NULL;
339.
340. s = skip_space(s);
^
341. done = *s == '\0';
342. while (!done) {
crypto/property/property_parse.c:350:14: Call
348. memset(&prop->v, 0, sizeof(prop->v));
349. prop->optional = 0;
350. if (!parse_name(ctx, &s, 1, &prop->name_idx))
^
351. goto err;
352. prop->oper = PROPERTY_OPER_EQ;
crypto/property/property_parse.c:83:1: Parameter `**t`
81. }
82.
83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
84. OSSL_PROPERTY_IDX *idx)
85. {
crypto/property/property_parse.c:358:13: Call
356. goto err;
357. }
358. if (match_ch(&s, '=')) {
^
359. if (!parse_value(ctx, &s, prop, 1)) {
360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
crypto/property/property_parse.c:59:1: Parameter `**t`
57. }
58.
59. > static int match_ch(const char *t[], char m)
60. {
61. const char *s = *t;
crypto/property/property_parse.c:359:18: Call
357. }
358. if (match_ch(&s, '=')) {
359. if (!parse_value(ctx, &s, prop, 1)) {
^
360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
361. "HERE-->%s", start);
crypto/property/property_parse.c:254:1: Parameter `**t`
252. }
253.
254. > static int parse_value(OPENSSL_CTX *ctx, const char *t[],
255. PROPERTY_DEFINITION *res, int create)
256. {
crypto/property/property_parse.c:257:5: Assignment
255. PROPERTY_DEFINITION *res, int create)
256. {
257. const char *s = *t;
^
258. int r = 0;
259.
crypto/property/property_parse.c:274:9: Assignment
272. r = parse_hex(&s, res);
273. } else if (*s == '0' && ossl_isdigit(s[1])) {
274. s++;
^
275. r = parse_oct(&s, res);
276. } else if (ossl_isdigit(*s)) {
crypto/property/property_parse.c:275:13: Call
273. } else if (*s == '0' && ossl_isdigit(s[1])) {
274. s++;
275. r = parse_oct(&s, res);
^
276. } else if (ossl_isdigit(*s)) {
277. return parse_number(t, res);
crypto/property/property_parse.c:169:1: <Length trace>
167. }
168.
169. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
170. {
171. const char *s = *t;
crypto/property/property_parse.c:169:1: Parameter `**t`
167. }
168.
169. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
170. {
171. const char *s = *t;
crypto/property/property_parse.c:171:5: Assignment
169. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
170. {
171. const char *s = *t;
^
172. int64_t v = 0;
173.
crypto/property/property_parse.c:178:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add`
176. do {
177. v = (v << 3) + (*s - '0');
178. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8');
^
179. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
180. ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT,
| https://github.com/openssl/openssl/blob/c1d56231ef6385b557ec72eec508e55ea26ca8b0/crypto/property/property_parse.c/#L178 |
d2a_code_trace_data_45303 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ec_lib.c:965: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `ec_wNAF_mul`.
Showing all 20 steps of the trace
crypto/ec/ec_lib.c:933:1: Parameter `ctx->stack.depth`
931. */
932.
933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
934. size_t num, const EC_POINT *points[],
935. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:965:15: Call
963. else
964. /* use default */
965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
966.
967. BN_CTX_free(new_ctx);
crypto/ec/ec_mult.c:410:1: Parameter `ctx->stack.depth`
408. * in the addition if scalar != NULL
409. */
410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
412. BN_CTX *ctx)
crypto/ec/ec_mult.c:453:20: Call
451. * always call the ladder version.
452. */
453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
^
454. }
455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) {
crypto/ec/ec_mult.c:139:1: Parameter `ctx->stack.depth`
137. * Returns 1 on success, 0 otherwise.
138. */
139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r,
140. const BIGNUM *scalar, const EC_POINT *point,
141. BN_CTX *ctx)
crypto/ec/ec_mult.c:164:5: Call
162. }
163.
164. BN_CTX_start(ctx);
^
165.
166. if (((p = EC_POINT_new(group)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/ec/ec_mult.c:196:10: Call
194. }
195.
196. if (!BN_mul(cardinality, group->order, group->cofactor, ctx)) {
^
197. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
198. goto err;
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. if (ctx == NULL)
crypto/bn/bn_ctx.c:193:27: Call
191. ctx->err_stack--;
192. else {
193. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
194. /* Does this stack frame have anything to release? */
195. if (fp < ctx->used)
crypto/bn/bn_ctx.c:268:1: <Offset trace>
266. }
267.
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269. {
270. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:1: Parameter `st->depth`
266. }
267.
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269. {
270. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:1: <Length trace>
266. }
267.
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269. {
270. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:1: Parameter `*st->indexes`
266. }
267.
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269. {
270. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:270:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `ec_wNAF_mul`
268. static unsigned int BN_STACK_pop(BN_STACK *st)
269. {
270. return st->indexes[--(st->depth)];
^
271. }
272.
| https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_ctx.c/#L270 |
d2a_code_trace_data_45304 | static int decode_header_trees(SmackVContext *smk) {
GetBitContext gb;
int mmap_size, mclr_size, full_size, type_size;
mmap_size = AV_RL32(smk->avctx->extradata);
mclr_size = AV_RL32(smk->avctx->extradata + 4);
full_size = AV_RL32(smk->avctx->extradata + 8);
type_size = AV_RL32(smk->avctx->extradata + 12);
init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
smk->mmap_tbl = av_malloc(sizeof(int) * 2);
smk->mmap_tbl[0] = 0;
smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
smk->mclr_tbl = av_malloc(sizeof(int) * 2);
smk->mclr_tbl[0] = 0;
smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
smk->full_tbl = av_malloc(sizeof(int) * 2);
smk->full_tbl[0] = 0;
smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
smk->type_tbl = av_malloc(sizeof(int) * 2);
smk->type_tbl[0] = 0;
smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size))
return -1;
}
return 0;
}
libavcodec/smacker.c:291: error: Null Dereference
pointer `smk->mmap_tbl` last assigned on line 290 could be null and is dereferenced at line 291, column 9.
libavcodec/smacker.c:277:1: start of procedure decode_header_trees()
275. }
276.
277. static int decode_header_trees(SmackVContext *smk) {
^
278. GetBitContext gb;
279. int mmap_size, mclr_size, full_size, type_size;
libavcodec/smacker.c:281:5:
279. int mmap_size, mclr_size, full_size, type_size;
280.
281. mmap_size = AV_RL32(smk->avctx->extradata);
^
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
283. full_size = AV_RL32(smk->avctx->extradata + 8);
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:282:5:
280.
281. mmap_size = AV_RL32(smk->avctx->extradata);
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
^
283. full_size = AV_RL32(smk->avctx->extradata + 8);
284. type_size = AV_RL32(smk->avctx->extradata + 12);
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:283:5:
281. mmap_size = AV_RL32(smk->avctx->extradata);
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
283. full_size = AV_RL32(smk->avctx->extradata + 8);
^
284. type_size = AV_RL32(smk->avctx->extradata + 12);
285.
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:284:5:
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
283. full_size = AV_RL32(smk->avctx->extradata + 8);
284. type_size = AV_RL32(smk->avctx->extradata + 12);
^
285.
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:286:5:
284. type_size = AV_RL32(smk->avctx->extradata + 12);
285.
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
^
287.
288. if(!get_bits1(&gb)) {
libavcodec/get_bits.h:375:1: start of procedure init_get_bits()
373. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
374. */
375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
376. int bit_size)
377. {
libavcodec/get_bits.h:379:5:
377. {
378. int buffer_size;
379. int ret = 0;
^
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
libavcodec/get_bits.h:381:9: Taking false branch
379. int ret = 0;
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
382. buffer_size = bit_size = 0;
383. buffer = NULL;
libavcodec/get_bits.h:381:35: Taking false branch
379. int ret = 0;
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
382. buffer_size = bit_size = 0;
383. buffer = NULL;
libavcodec/get_bits.h:381:52: Taking false branch
379. int ret = 0;
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
382. buffer_size = bit_size = 0;
383. buffer = NULL;
libavcodec/get_bits.h:387:5:
385. }
386.
387. buffer_size = (bit_size + 7) >> 3;
^
388.
389. s->buffer = buffer;
libavcodec/get_bits.h:389:5:
387. buffer_size = (bit_size + 7) >> 3;
388.
389. s->buffer = buffer;
^
390. s->size_in_bits = bit_size;
391. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:390:5:
388.
389. s->buffer = buffer;
390. s->size_in_bits = bit_size;
^
391. #if !UNCHECKED_BITSTREAM_READER
392. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:392:5:
390. s->size_in_bits = bit_size;
391. #if !UNCHECKED_BITSTREAM_READER
392. s->size_in_bits_plus8 = bit_size + 8;
^
393. #endif
394. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:394:5:
392. s->size_in_bits_plus8 = bit_size + 8;
393. #endif
394. s->buffer_end = buffer + buffer_size;
^
395. s->index = 0;
396.
libavcodec/get_bits.h:395:5:
393. #endif
394. s->buffer_end = buffer + buffer_size;
395. s->index = 0;
^
396.
397. return ret;
libavcodec/get_bits.h:397:5:
395. s->index = 0;
396.
397. return ret;
^
398. }
399.
libavcodec/get_bits.h:398:1: return from a call to init_get_bits
396.
397. return ret;
398. }
^
399.
400. /**
libavcodec/smacker.c:288:9:
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
287.
288. if(!get_bits1(&gb)) {
^
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
libavcodec/get_bits.h:271:1: start of procedure get_bits1()
269. }
270.
271. static inline unsigned int get_bits1(GetBitContext *s)
^
272. {
273. unsigned int index = s->index;
libavcodec/get_bits.h:273:5:
271. static inline unsigned int get_bits1(GetBitContext *s)
272. {
273. unsigned int index = s->index;
^
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:274:5:
272. {
273. unsigned int index = s->index;
274. uint8_t result = s->buffer[index >> 3];
^
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
libavcodec/get_bits.h:276:5:
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
^
277. result &= 1;
278. #else
libavcodec/get_bits.h:277:5:
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
277. result &= 1;
^
278. #else
279. result <<= index & 7;
libavcodec/get_bits.h:283:9: Taking false branch
281. #endif
282. #if !UNCHECKED_BITSTREAM_READER
283. if (s->index < s->size_in_bits_plus8)
^
284. #endif
285. index++;
libavcodec/get_bits.h:286:5:
284. #endif
285. index++;
286. s->index = index;
^
287.
288. return result;
libavcodec/get_bits.h:288:5:
286. s->index = index;
287.
288. return result;
^
289. }
290.
libavcodec/get_bits.h:289:1: return from a call to get_bits1
287.
288. return result;
289. }
^
290.
291. static inline unsigned int show_bits1(GetBitContext *s)
libavcodec/smacker.c:288:9: Taking true branch
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
287.
288. if(!get_bits1(&gb)) {
^
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
libavcodec/smacker.c:289:9: Skipping av_log(): empty list of specs
287.
288. if(!get_bits1(&gb)) {
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
^
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
291. smk->mmap_tbl[0] = 0;
libavcodec/smacker.c:290:9:
288. if(!get_bits1(&gb)) {
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
^
291. smk->mmap_tbl[0] = 0;
292. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking true branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:81:9:
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
81. ptr = NULL;
^
82. #elif HAVE_ALIGNED_MALLOC
83. ptr = _aligned_malloc(size, 32);
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavcodec/smacker.c:291:9:
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
291. smk->mmap_tbl[0] = 0;
^
292. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
293. } else {
| https://github.com/libav/libav/blob/710b0e27025948b7511821c2f888ff2d74a59e14/libavcodec/smacker.c/#L291 |
d2a_code_trace_data_45305 | static int decode_header_trees(SmackVContext *smk) {
GetBitContext gb;
int mmap_size, mclr_size, full_size, type_size;
mmap_size = AV_RL32(smk->avctx->extradata);
mclr_size = AV_RL32(smk->avctx->extradata + 4);
full_size = AV_RL32(smk->avctx->extradata + 8);
type_size = AV_RL32(smk->avctx->extradata + 12);
init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
smk->mmap_tbl = av_malloc(sizeof(int) * 2);
smk->mmap_tbl[0] = 0;
smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
smk->mclr_tbl = av_malloc(sizeof(int) * 2);
smk->mclr_tbl[0] = 0;
smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
smk->full_tbl = av_malloc(sizeof(int) * 2);
smk->full_tbl[0] = 0;
smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size))
return -1;
}
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
smk->type_tbl = av_malloc(sizeof(int) * 2);
smk->type_tbl[0] = 0;
smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
} else {
if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size))
return -1;
}
return 0;
}
libavcodec/smacker.c:318: error: Null Dereference
pointer `smk->type_tbl` last assigned on line 317 could be null and is dereferenced at line 318, column 9.
libavcodec/smacker.c:277:1: start of procedure decode_header_trees()
275. }
276.
277. static int decode_header_trees(SmackVContext *smk) {
^
278. GetBitContext gb;
279. int mmap_size, mclr_size, full_size, type_size;
libavcodec/smacker.c:281:5:
279. int mmap_size, mclr_size, full_size, type_size;
280.
281. mmap_size = AV_RL32(smk->avctx->extradata);
^
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
283. full_size = AV_RL32(smk->avctx->extradata + 8);
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:282:5:
280.
281. mmap_size = AV_RL32(smk->avctx->extradata);
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
^
283. full_size = AV_RL32(smk->avctx->extradata + 8);
284. type_size = AV_RL32(smk->avctx->extradata + 12);
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:283:5:
281. mmap_size = AV_RL32(smk->avctx->extradata);
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
283. full_size = AV_RL32(smk->avctx->extradata + 8);
^
284. type_size = AV_RL32(smk->avctx->extradata + 12);
285.
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:284:5:
282. mclr_size = AV_RL32(smk->avctx->extradata + 4);
283. full_size = AV_RL32(smk->avctx->extradata + 8);
284. type_size = AV_RL32(smk->avctx->extradata + 12);
^
285.
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
42.
43. #define AV_RL32 AV_RL32
44. static av_always_inline uint32_t AV_RL32(const void *p)
^
45. {
46. uint32_t v;
libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
45. {
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
^
48. return v;
49. }
libavutil/ppc/intreadwrite.h:48:5:
46. uint32_t v;
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
^
49. }
50.
libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
47. __asm__ ("lwbrx %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
48. return v;
49. }
^
50.
51. #define AV_WL32 AV_WL32
libavcodec/smacker.c:286:5:
284. type_size = AV_RL32(smk->avctx->extradata + 12);
285.
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
^
287.
288. if(!get_bits1(&gb)) {
libavcodec/get_bits.h:375:1: start of procedure init_get_bits()
373. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
374. */
375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
376. int bit_size)
377. {
libavcodec/get_bits.h:379:5:
377. {
378. int buffer_size;
379. int ret = 0;
^
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
libavcodec/get_bits.h:381:9: Taking false branch
379. int ret = 0;
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
382. buffer_size = bit_size = 0;
383. buffer = NULL;
libavcodec/get_bits.h:381:35: Taking false branch
379. int ret = 0;
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
382. buffer_size = bit_size = 0;
383. buffer = NULL;
libavcodec/get_bits.h:381:52: Taking false branch
379. int ret = 0;
380.
381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
382. buffer_size = bit_size = 0;
383. buffer = NULL;
libavcodec/get_bits.h:387:5:
385. }
386.
387. buffer_size = (bit_size + 7) >> 3;
^
388.
389. s->buffer = buffer;
libavcodec/get_bits.h:389:5:
387. buffer_size = (bit_size + 7) >> 3;
388.
389. s->buffer = buffer;
^
390. s->size_in_bits = bit_size;
391. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:390:5:
388.
389. s->buffer = buffer;
390. s->size_in_bits = bit_size;
^
391. #if !UNCHECKED_BITSTREAM_READER
392. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:392:5:
390. s->size_in_bits = bit_size;
391. #if !UNCHECKED_BITSTREAM_READER
392. s->size_in_bits_plus8 = bit_size + 8;
^
393. #endif
394. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:394:5:
392. s->size_in_bits_plus8 = bit_size + 8;
393. #endif
394. s->buffer_end = buffer + buffer_size;
^
395. s->index = 0;
396.
libavcodec/get_bits.h:395:5:
393. #endif
394. s->buffer_end = buffer + buffer_size;
395. s->index = 0;
^
396.
397. return ret;
libavcodec/get_bits.h:397:5:
395. s->index = 0;
396.
397. return ret;
^
398. }
399.
libavcodec/get_bits.h:398:1: return from a call to init_get_bits
396.
397. return ret;
398. }
^
399.
400. /**
libavcodec/smacker.c:288:9:
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
287.
288. if(!get_bits1(&gb)) {
^
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
libavcodec/get_bits.h:271:1: start of procedure get_bits1()
269. }
270.
271. static inline unsigned int get_bits1(GetBitContext *s)
^
272. {
273. unsigned int index = s->index;
libavcodec/get_bits.h:273:5:
271. static inline unsigned int get_bits1(GetBitContext *s)
272. {
273. unsigned int index = s->index;
^
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:274:5:
272. {
273. unsigned int index = s->index;
274. uint8_t result = s->buffer[index >> 3];
^
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
libavcodec/get_bits.h:276:5:
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
^
277. result &= 1;
278. #else
libavcodec/get_bits.h:277:5:
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
277. result &= 1;
^
278. #else
279. result <<= index & 7;
libavcodec/get_bits.h:283:9: Taking false branch
281. #endif
282. #if !UNCHECKED_BITSTREAM_READER
283. if (s->index < s->size_in_bits_plus8)
^
284. #endif
285. index++;
libavcodec/get_bits.h:286:5:
284. #endif
285. index++;
286. s->index = index;
^
287.
288. return result;
libavcodec/get_bits.h:288:5:
286. s->index = index;
287.
288. return result;
^
289. }
290.
libavcodec/get_bits.h:289:1: return from a call to get_bits1
287.
288. return result;
289. }
^
290.
291. static inline unsigned int show_bits1(GetBitContext *s)
libavcodec/smacker.c:288:9: Taking true branch
286. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
287.
288. if(!get_bits1(&gb)) {
^
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
libavcodec/smacker.c:289:9: Skipping av_log(): empty list of specs
287.
288. if(!get_bits1(&gb)) {
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
^
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
291. smk->mmap_tbl[0] = 0;
libavcodec/smacker.c:290:9:
288. if(!get_bits1(&gb)) {
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
^
291. smk->mmap_tbl[0] = 0;
292. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking false branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavcodec/smacker.c:291:9:
289. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
291. smk->mmap_tbl[0] = 0;
^
292. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
293. } else {
libavcodec/smacker.c:292:9:
290. smk->mmap_tbl = av_malloc(sizeof(int) * 2);
291. smk->mmap_tbl[0] = 0;
292. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
^
293. } else {
294. if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size))
libavcodec/smacker.c:297:9:
295. return -1;
296. }
297. if(!get_bits1(&gb)) {
^
298. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
299. smk->mclr_tbl = av_malloc(sizeof(int) * 2);
libavcodec/get_bits.h:271:1: start of procedure get_bits1()
269. }
270.
271. static inline unsigned int get_bits1(GetBitContext *s)
^
272. {
273. unsigned int index = s->index;
libavcodec/get_bits.h:273:5:
271. static inline unsigned int get_bits1(GetBitContext *s)
272. {
273. unsigned int index = s->index;
^
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:274:5:
272. {
273. unsigned int index = s->index;
274. uint8_t result = s->buffer[index >> 3];
^
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
libavcodec/get_bits.h:276:5:
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
^
277. result &= 1;
278. #else
libavcodec/get_bits.h:277:5:
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
277. result &= 1;
^
278. #else
279. result <<= index & 7;
libavcodec/get_bits.h:283:9: Taking false branch
281. #endif
282. #if !UNCHECKED_BITSTREAM_READER
283. if (s->index < s->size_in_bits_plus8)
^
284. #endif
285. index++;
libavcodec/get_bits.h:286:5:
284. #endif
285. index++;
286. s->index = index;
^
287.
288. return result;
libavcodec/get_bits.h:288:5:
286. s->index = index;
287.
288. return result;
^
289. }
290.
libavcodec/get_bits.h:289:1: return from a call to get_bits1
287.
288. return result;
289. }
^
290.
291. static inline unsigned int show_bits1(GetBitContext *s)
libavcodec/smacker.c:297:9: Taking true branch
295. return -1;
296. }
297. if(!get_bits1(&gb)) {
^
298. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
299. smk->mclr_tbl = av_malloc(sizeof(int) * 2);
libavcodec/smacker.c:298:9: Skipping av_log(): empty list of specs
296. }
297. if(!get_bits1(&gb)) {
298. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
^
299. smk->mclr_tbl = av_malloc(sizeof(int) * 2);
300. smk->mclr_tbl[0] = 0;
libavcodec/smacker.c:299:9:
297. if(!get_bits1(&gb)) {
298. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
299. smk->mclr_tbl = av_malloc(sizeof(int) * 2);
^
300. smk->mclr_tbl[0] = 0;
301. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking false branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavcodec/smacker.c:300:9:
298. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
299. smk->mclr_tbl = av_malloc(sizeof(int) * 2);
300. smk->mclr_tbl[0] = 0;
^
301. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
302. } else {
libavcodec/smacker.c:301:9:
299. smk->mclr_tbl = av_malloc(sizeof(int) * 2);
300. smk->mclr_tbl[0] = 0;
301. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
^
302. } else {
303. if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size))
libavcodec/smacker.c:306:9:
304. return -1;
305. }
306. if(!get_bits1(&gb)) {
^
307. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
308. smk->full_tbl = av_malloc(sizeof(int) * 2);
libavcodec/get_bits.h:271:1: start of procedure get_bits1()
269. }
270.
271. static inline unsigned int get_bits1(GetBitContext *s)
^
272. {
273. unsigned int index = s->index;
libavcodec/get_bits.h:273:5:
271. static inline unsigned int get_bits1(GetBitContext *s)
272. {
273. unsigned int index = s->index;
^
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:274:5:
272. {
273. unsigned int index = s->index;
274. uint8_t result = s->buffer[index >> 3];
^
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
libavcodec/get_bits.h:276:5:
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
^
277. result &= 1;
278. #else
libavcodec/get_bits.h:277:5:
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
277. result &= 1;
^
278. #else
279. result <<= index & 7;
libavcodec/get_bits.h:283:9: Taking false branch
281. #endif
282. #if !UNCHECKED_BITSTREAM_READER
283. if (s->index < s->size_in_bits_plus8)
^
284. #endif
285. index++;
libavcodec/get_bits.h:286:5:
284. #endif
285. index++;
286. s->index = index;
^
287.
288. return result;
libavcodec/get_bits.h:288:5:
286. s->index = index;
287.
288. return result;
^
289. }
290.
libavcodec/get_bits.h:289:1: return from a call to get_bits1
287.
288. return result;
289. }
^
290.
291. static inline unsigned int show_bits1(GetBitContext *s)
libavcodec/smacker.c:306:9: Taking true branch
304. return -1;
305. }
306. if(!get_bits1(&gb)) {
^
307. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
308. smk->full_tbl = av_malloc(sizeof(int) * 2);
libavcodec/smacker.c:307:9: Skipping av_log(): empty list of specs
305. }
306. if(!get_bits1(&gb)) {
307. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
^
308. smk->full_tbl = av_malloc(sizeof(int) * 2);
309. smk->full_tbl[0] = 0;
libavcodec/smacker.c:308:9:
306. if(!get_bits1(&gb)) {
307. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
308. smk->full_tbl = av_malloc(sizeof(int) * 2);
^
309. smk->full_tbl[0] = 0;
310. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking false branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavcodec/smacker.c:309:9:
307. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
308. smk->full_tbl = av_malloc(sizeof(int) * 2);
309. smk->full_tbl[0] = 0;
^
310. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
311. } else {
libavcodec/smacker.c:310:9:
308. smk->full_tbl = av_malloc(sizeof(int) * 2);
309. smk->full_tbl[0] = 0;
310. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
^
311. } else {
312. if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size))
libavcodec/smacker.c:315:9:
313. return -1;
314. }
315. if(!get_bits1(&gb)) {
^
316. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
317. smk->type_tbl = av_malloc(sizeof(int) * 2);
libavcodec/get_bits.h:271:1: start of procedure get_bits1()
269. }
270.
271. static inline unsigned int get_bits1(GetBitContext *s)
^
272. {
273. unsigned int index = s->index;
libavcodec/get_bits.h:273:5:
271. static inline unsigned int get_bits1(GetBitContext *s)
272. {
273. unsigned int index = s->index;
^
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:274:5:
272. {
273. unsigned int index = s->index;
274. uint8_t result = s->buffer[index >> 3];
^
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
libavcodec/get_bits.h:276:5:
274. uint8_t result = s->buffer[index >> 3];
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
^
277. result &= 1;
278. #else
libavcodec/get_bits.h:277:5:
275. #ifdef BITSTREAM_READER_LE
276. result >>= index & 7;
277. result &= 1;
^
278. #else
279. result <<= index & 7;
libavcodec/get_bits.h:283:9: Taking false branch
281. #endif
282. #if !UNCHECKED_BITSTREAM_READER
283. if (s->index < s->size_in_bits_plus8)
^
284. #endif
285. index++;
libavcodec/get_bits.h:286:5:
284. #endif
285. index++;
286. s->index = index;
^
287.
288. return result;
libavcodec/get_bits.h:288:5:
286. s->index = index;
287.
288. return result;
^
289. }
290.
libavcodec/get_bits.h:289:1: return from a call to get_bits1
287.
288. return result;
289. }
^
290.
291. static inline unsigned int show_bits1(GetBitContext *s)
libavcodec/smacker.c:315:9: Taking true branch
313. return -1;
314. }
315. if(!get_bits1(&gb)) {
^
316. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
317. smk->type_tbl = av_malloc(sizeof(int) * 2);
libavcodec/smacker.c:316:9: Skipping av_log(): empty list of specs
314. }
315. if(!get_bits1(&gb)) {
316. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
^
317. smk->type_tbl = av_malloc(sizeof(int) * 2);
318. smk->type_tbl[0] = 0;
libavcodec/smacker.c:317:9:
315. if(!get_bits1(&gb)) {
316. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
317. smk->type_tbl = av_malloc(sizeof(int) * 2);
^
318. smk->type_tbl[0] = 0;
319. smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possibly ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking true branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:81:9:
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
81. ptr = NULL;
^
82. #elif HAVE_ALIGNED_MALLOC
83. ptr = _aligned_malloc(size, 32);
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavcodec/smacker.c:318:9:
316. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
317. smk->type_tbl = av_malloc(sizeof(int) * 2);
318. smk->type_tbl[0] = 0;
^
319. smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
320. } else {
| https://github.com/libav/libav/blob/710b0e27025948b7511821c2f888ff2d74a59e14/libavcodec/smacker.c/#L318 |
d2a_code_trace_data_45306 | static int custom_ext_meth_add(custom_ext_methods *exts,
unsigned int ext_type,
custom_ext_add_cb add_cb,
custom_ext_free_cb free_cb,
void *add_arg,
custom_ext_parse_cb parse_cb, void *parse_arg)
{
custom_ext_method *meth;
if (!add_cb && free_cb)
return 0;
if (SSL_extension_supported(ext_type) &&
ext_type != TLSEXT_TYPE_signed_certificate_timestamp)
return 0;
if (ext_type > 0xffff)
return 0;
if (custom_ext_find(exts, ext_type))
return 0;
exts->meths = OPENSSL_realloc(exts->meths,
(exts->meths_count +
1) * sizeof(custom_ext_method));
if (!exts->meths) {
exts->meths_count = 0;
return 0;
}
meth = exts->meths + exts->meths_count;
memset(meth, 0, sizeof(*meth));
meth->parse_cb = parse_cb;
meth->add_cb = add_cb;
meth->free_cb = free_cb;
meth->ext_type = ext_type;
meth->add_arg = add_arg;
meth->parse_arg = parse_arg;
exts->meths_count++;
return 1;
}
ssl/t1_ext.c:240: error: BUFFER_OVERRUN_S2
Offset added: [`exts->meths_count` + 48, `exts->meths_count` + 48] (⇐ `exts->meths_count` + 48) Size: [1, 48⋅`exts->meths_count` + 48].
Showing all 6 steps of the trace
ssl/t1_ext.c:203:1: <Length trace>
201.
202. /* Set callbacks for a custom extension. */
203. > static int custom_ext_meth_add(custom_ext_methods *exts,
204. unsigned int ext_type,
205. custom_ext_add_cb add_cb,
ssl/t1_ext.c:203:1: Parameter `exts->meths_count`
201.
202. /* Set callbacks for a custom extension. */
203. > static int custom_ext_meth_add(custom_ext_methods *exts,
204. unsigned int ext_type,
205. custom_ext_add_cb add_cb,
ssl/t1_ext.c:228:9: Call
226. return 0;
227. /* Search for duplicate */
228. if (custom_ext_find(exts, ext_type))
^
229. return 0;
230. exts->meths = OPENSSL_realloc(exts->meths,
ssl/t1_ext.c:64:1: Parameter `exts->meths_count`
62.
63. /* Find a custom extension from the list. */
64. > static custom_ext_method *custom_ext_find(const custom_ext_methods *exts,
65. unsigned int ext_type)
66. {
ssl/t1_ext.c:239:5: Assignment
237. }
238.
239. meth = exts->meths + exts->meths_count;
^
240. memset(meth, 0, sizeof(*meth));
241. meth->parse_cb = parse_cb;
ssl/t1_ext.c:240:5: Array access: Offset added: [exts->meths_count + 48, exts->meths_count + 48] (⇐ exts->meths_count + 48) Size: [1, 48⋅exts->meths_count + 48]
238.
239. meth = exts->meths + exts->meths_count;
240. memset(meth, 0, sizeof(*meth));
^
241. meth->parse_cb = parse_cb;
242. meth->add_cb = add_cb;
| https://github.com/openssl/openssl/blob/9829b5ab52cb5f1891fc48262503b7eec32351b3/ssl/t1_ext.c/#L240 |
d2a_code_trace_data_45307 | int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
if (allocbytes != NULL)
*allocbytes = WPACKET_get_curr(pkt);
return 1;
}
ssl/statem/statem_srvr.c:2128: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `pkt->written` + 73]):unsigned64 by call to `tls_construct_extensions`.
Showing all 14 steps of the trace
ssl/statem/statem_srvr.c:2081:17: Call
2079. * tls_process_client_hello()
2080. */
2081. || !WPACKET_memcpy(pkt, s->s3->server_random, SSL3_RANDOM_SIZE)) {
^
2082. SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
2083. goto err;
ssl/packet.c:353:1: Parameter `pkt->buf->length`
351. }
352.
353. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
354. {
355. unsigned char *dest;
ssl/statem/statem_srvr.c:2128:17: Call
2126. || (!SSL_IS_TLS13(s)
2127. && !WPACKET_put_bytes_u8(pkt, compm))
2128. || !tls_construct_extensions(s, pkt,
^
2129. SSL_IS_TLS13(s)
2130. ? SSL_EXT_TLS1_3_SERVER_HELLO
ssl/statem/extensions.c:649:1: Parameter `pkt->written`
647. * failure construction stops at the first extension to fail to construct.
648. */
649. > int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context,
650. X509 *x, size_t chainidx, int *al)
651. {
ssl/statem/extensions.c:662:10: Call
660. tmpal = SSL_AD_INTERNAL_ERROR;
661.
662. if (!WPACKET_start_sub_packet_u16(pkt)
^
663. /*
664. * If extensions are of zero length then we don't even add the
ssl/packet.c:275:1: Parameter `pkt->written`
273. }
274.
275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
276. {
277. WPACKET_SUB *sub;
ssl/packet.c:299:10: Call
297. }
298.
299. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
300. return 0;
301. /* 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:39:1: <LHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `pkt->buf->length`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: <RHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `len`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:49:36: Binary operation: ([0, +oo] - [0, pkt->written + 73]):unsigned64 by call to `tls_construct_extensions`
47. return 0;
48.
49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
^
50. size_t newlen;
51. size_t reflen;
| https://github.com/openssl/openssl/blob/e128f891de71bbdba8391355af8d6d47d20b1969/ssl/packet.c/#L49 |
d2a_code_trace_data_45308 | static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
{
int i;
LHASH_NODE *a,*n;
if (lh == NULL)
return;
for (i=lh->num_nodes-1; i>=0; i--)
{
a=lh->b[i];
while (a != NULL)
{
n=a->next;
if(use_arg)
func_arg(a->data,arg);
else
func(a->data);
a=n;
}
}
}
apps/ciphers.c:225: error: INTEGER_OVERFLOW_L2
([0, 8] - 1):unsigned32 by call to `SSL_CTX_free`.
Showing all 13 steps of the trace
apps/ciphers.c:164:6: Call
162. OpenSSL_add_ssl_algorithms();
163.
164. ctx=SSL_CTX_new(meth);
^
165. if (ctx == NULL) goto err;
166. if (ciphers != NULL) {
ssl/ssl_lib.c:1759:16: Call
1757. ret->app_verify_cookie_cb=0;
1758.
1759. ret->sessions=lh_SSL_SESSION_new();
^
1760. if (ret->sessions == NULL) goto err;
1761. ret->cert_store=X509_STORE_new();
crypto/lhash/lhash.c:127:2: Assignment
125. ret->comp=((c == NULL)?(LHASH_COMP_FN_TYPE)strcmp:c);
126. ret->hash=((h == NULL)?(LHASH_HASH_FN_TYPE)lh_strhash:h);
127. ret->num_nodes=MIN_NODES/2;
^
128. ret->num_alloc_nodes=MIN_NODES;
129. ret->p=0;
apps/ciphers.c:225:19: Call
223. }
224. end:
225. if (ctx != NULL) SSL_CTX_free(ctx);
^
226. if (ssl != NULL) SSL_free(ssl);
227. if (STDout != NULL) BIO_free_all(STDout);
ssl/ssl_lib.c:1899:1: Parameter `a->sessions->num_nodes`
1897. #endif
1898.
1899. > void SSL_CTX_free(SSL_CTX *a)
1900. {
1901. int i;
ssl/ssl_lib.c:1931:3: Call
1929. */
1930. if (a->sessions != NULL)
1931. SSL_CTX_flush_sessions(a,0);
^
1932.
1933. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes`
983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM)
984.
985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
986. {
987. unsigned long i;
ssl/ssl_sess.c:997:2: Call
995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;
996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0;
997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout),
^
998. TIMEOUT_PARAM, &tp);
999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i;
crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes`
303. }
304.
305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
306. {
307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
crypto/lhash/lhash.c:307:2: Call
305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
306. {
307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
^
308. }
309.
crypto/lhash/lhash.c:270:1: <LHS trace>
268. }
269.
270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
272. {
crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes`
268. }
269.
270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
272. {
crypto/lhash/lhash.c:281:7: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_CTX_free`
279. /* reverse the order so we search from 'top to bottom'
280. * We were having memory leaks otherwise */
281. for (i=lh->num_nodes-1; i>=0; i--)
^
282. {
283. a=lh->b[i];
| https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281 |
d2a_code_trace_data_45309 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
int i, nw, lb, rb;
BN_ULONG *t, *f;
BN_ULONG l;
bn_check_top(r);
bn_check_top(a);
if (n < 0) {
BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
return 0;
}
r->neg = a->neg;
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return (0);
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return (1);
}
apps/s_client.c:258: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp`.
Showing all 30 steps of the trace
apps/s_client.c:252:9: Call
250. int ret =
251. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
252. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
^
253. p != NULL && BN_rshift1(p, N) &&
254. /* p = (N-1)/2 */
crypto/bn/bn_prime.c:197:12: Call
195. BN_GENCB *cb)
196. {
197. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
198. }
199.
crypto/bn/bn_prime.c:200:1: Parameter `a->top`
198. }
199.
200. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
201. int do_trial_division, BN_GENCB *cb)
202. {
crypto/bn/bn_prime.c:210:9: Call
208. const BIGNUM *A = NULL;
209.
210. if (BN_cmp(a, BN_value_one()) <= 0)
^
211. return 0;
212.
crypto/bn/bn_lib.c:645:1: Parameter `a->top`
643. }
644.
645. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
646. {
647. int i;
apps/s_client.c:253:22: Call
251. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
252. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
253. p != NULL && BN_rshift1(p, N) &&
^
254. /* p = (N-1)/2 */
255. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
crypto/bn/bn_shift.c:54:9: Call
52. bn_check_top(a);
53.
54. if (BN_is_zero(a)) {
^
55. BN_zero(r);
56. return (1);
crypto/bn/bn_lib.c:920:1: Parameter `a->top`
918. }
919.
920. > int BN_is_zero(const BIGNUM *a)
921. {
922. return a->top == 0;
apps/s_client.c:258:9: Call
256. r != NULL &&
257. /* verify g^((N-1)/2) == -1 (mod N) */
258. BN_mod_exp(r, g, p, N, bn_ctx) &&
^
259. BN_add_word(r, 1) && BN_cmp(r, N) == 0;
260.
crypto/bn/bn_exp.c:90:1: Parameter `m->top`
88. }
89.
90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
91. BN_CTX *ctx)
92. {
crypto/bn/bn_exp.c:142:9: Call
140. /* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */
141.
142. if (BN_is_odd(m)) {
^
143. # ifdef MONT_EXP_WORD
144. if (a->top == 1 && !a->neg
crypto/bn/bn_lib.c:935:1: Parameter `a->top`
933. }
934.
935. > int BN_is_odd(const BIGNUM *a)
936. {
937. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_exp.c:147:19: Call
145. && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) {
146. BN_ULONG A = a->d[0];
147. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
^
148. } else
149. # endif
crypto/bn/bn_exp.c:1097:1: Parameter `m->top`
1095. }
1096.
1097. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
1098. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
1099. {
crypto/bn/bn_exp.c:1132:10: Call
1130. bn_check_top(m);
1131.
1132. if (!BN_is_odd(m)) {
^
1133. BNerr(BN_F_BN_MOD_EXP_MONT_WORD, BN_R_CALLED_WITH_EVEN_MODULUS);
1134. return (0);
crypto/bn/bn_lib.c:935:1: Parameter `a->top`
933. }
934.
935. > int BN_is_odd(const BIGNUM *a)
936. {
937. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_exp.c:1187:22: Call
1185. r_is_one = 0;
1186. } else {
1187. if (!BN_MOD_MUL_WORD(r, w, m))
^
1188. goto err;
1189. }
crypto/bn/bn_div.c:205:31: Call
203.
204. /* First we normalise the numbers */
205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
206. if (!(BN_lshift(sdiv, divisor, norm_shift)))
207. goto err;
crypto/bn/bn_lib.c:167:9: Assignment
165.
166. if (BN_is_zero(a))
167. return 0;
^
168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
169. }
crypto/bn/bn_div.c:205:5: Assignment
203.
204. /* First we normalise the numbers */
205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
206. if (!(BN_lshift(sdiv, divisor, norm_shift)))
207. goto err;
crypto/bn/bn_div.c:206:11: Call
204. /* First we normalise the numbers */
205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
206. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
207. goto err;
208. sdiv->neg = 0;
crypto/bn/bn_shift.c:81:1: <Offset trace>
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:81:1: Parameter `n`
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:96:5: Assignment
94.
95. r->neg = a->neg;
96. nw = n / BN_BITS2;
^
97. if (bn_wexpand(r, a->top + nw + 1) == NULL)
98. return (0);
crypto/bn/bn_shift.c:81:1: <Length trace>
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:81:1: Parameter `*r->d`
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:9: Call
95. r->neg = a->neg;
96. nw = n / BN_BITS2;
97. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
98. return (0);
99. lb = n % BN_BITS2;
crypto/bn/bn_lib.c:1016:1: Parameter `*a->d`
1014. }
1015.
1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
1017. {
1018. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:102:5: Assignment
100. rb = BN_BITS2 - lb;
101. f = a->d;
102. t = r->d;
^
103. t[a->top + nw] = 0;
104. if (lb == 0)
crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp`
108. for (i = a->top - 1; i >= 0; i--) {
109. l = f[i];
110. t[nw + i + 1] |= (l >> rb) & BN_MASK2;
^
111. t[nw + i] = (l << lb) & BN_MASK2;
112. }
| https://github.com/openssl/openssl/blob/748e85308ef4f3e672975b3604ea2d76424fa404/crypto/bn/bn_shift.c/#L110 |
d2a_code_trace_data_45310 | 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/record/ssl3_record.c:1602: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`.
Showing all 17 steps of the trace
ssl/record/ssl3_record.c:1447:1: Parameter `s->initial_ctx->sessions->num_items`
1445. */
1446. /* used only by dtls1_read_bytes */
1447. > int dtls1_get_record(SSL *s)
1448. {
1449. int ssl_major, ssl_minor;
ssl/record/ssl3_record.c:1463:9: Call
1461. * This is a non-blocking operation.
1462. */
1463. if (dtls1_process_buffered_records(s) < 0)
^
1464. return -1;
1465.
ssl/record/rec_layer_d1.c:237:1: Parameter `s->initial_ctx->sessions->num_items`
235.
236.
237. > int dtls1_process_buffered_records(SSL *s)
238. {
239. pitem *item;
ssl/record/ssl3_record.c:1602:10: Call
1600. }
1601.
1602. if (!dtls1_process_record(s)) {
^
1603. rr->length = 0;
1604. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */
ssl/record/ssl3_record.c:1264:1: Parameter `s->initial_ctx->sessions->num_items`
1262. }
1263.
1264. > int dtls1_process_record(SSL *s)
1265. {
1266. int i, al;
ssl/record/ssl3_record.c:1423:5: Call
1421.
1422. f_err:
1423. ssl3_send_alert(s, SSL3_AL_FATAL, al);
^
1424. err:
1425. return (0);
ssl/s3_msg.c:64:1: Parameter `s->initial_ctx->sessions->num_items`
62. }
63.
64. > int ssl3_send_alert(SSL *s, int level, int desc)
65. {
66. /* Map tls/ssl alert value to correct one */
ssl/s3_msg.c:75:9: Call
73. /* If a fatal one, remove from cache */
74. if ((level == SSL3_AL_FATAL) && (s->session != NULL))
75. SSL_CTX_remove_session(s->session_ctx, s->session);
^
76.
77. s->s3->alert_dispatch = 1;
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `dtls1_process_record`
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/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_45311 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *A, *a = NULL;
const BN_ULONG *B;
int i;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
if (BN_get_flags(b,BN_FLG_SECURE))
a = A = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = A = OPENSSL_zalloc(words * sizeof(*a));
if (A == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
}
#if 1
B = b->d;
if (B != NULL) {
for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) {
BN_ULONG a0, a1, a2, a3;
a0 = B[0];
a1 = B[1];
a2 = B[2];
a3 = B[3];
A[0] = a0;
A[1] = a1;
A[2] = a2;
A[3] = a3;
}
switch (b->top & 3) {
case 3:
A[2] = B[2];
case 2:
A[1] = B[1];
case 1:
A[0] = B[0];
case 0:
;
}
}
#else
memset(A, 0, sizeof(*A) * words);
memcpy(A, b->d, sizeof(b->d[0]) * b->top);
#endif
return (a);
}
crypto/dsa/dsa_ossl.c:208: error: BUFFER_OVERRUN_L3
Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_div`.
Showing all 14 steps of the trace
crypto/dsa/dsa_ossl.c:133:1: Parameter `(*rp)->d`
131. }
132.
133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
134. BIGNUM **kinvp, BIGNUM **rp,
135. const unsigned char *dgst, int dlen)
crypto/dsa/dsa_ossl.c:208:10: Call
206.
207.
208. if (!BN_mod(r, r, dsa->q, ctx))
^
209. goto err;
210.
crypto/bn/bn_div.c:140:1: Parameter `*rm->d`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/bn/bn_div.c:409:9: Call
407. */
408. int neg = num->neg;
409. BN_rshift(rm, snum, norm_shift);
^
410. if (!BN_is_zero(rm))
411. rm->neg = neg;
crypto/bn/bn_shift.c:120:1: Parameter `*r->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:144:13: Call
142. if (r != a) {
143. r->neg = a->neg;
144. if (bn_wexpand(r, i) == NULL)
^
145. return (0);
146. } else {
crypto/bn/bn_lib.c:1014:1: Parameter `*a->d`
1012. }
1013.
1014. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
1015. {
1016. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:1016:37: Call
1014. BIGNUM *bn_wexpand(BIGNUM *a, int words)
1015. {
1016. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
1017. }
1018.
crypto/bn/bn_lib.c:323:1: Parameter `*b->d`
321. */
322.
323. > BIGNUM *bn_expand2(BIGNUM *b, int words)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:328:23: Call
326.
327. if (words > b->dmax) {
328. BN_ULONG *a = bn_expand_internal(b, words);
^
329. if (!a)
330. return NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *A, *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `*b->d`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *A, *a = NULL;
crypto/bn/bn_lib.c:272:5: Assignment
270.
271. #if 1
272. B = b->d;
^
273. /* Check if the previous number needs to be copied */
274. if (B != NULL) {
crypto/bn/bn_lib.c:289:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_div`
287. a1 = B[1];
288. a2 = B[2];
289. a3 = B[3];
^
290. A[0] = a0;
291. A[1] = a1;
| https://github.com/openssl/openssl/blob/ec772a817afc0f788c38006f623204a7d76221ec/crypto/bn/bn_lib.c/#L289 |
d2a_code_trace_data_45312 | 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/dsa/dsa_gen.c:422: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 47 steps of the trace
crypto/dsa/dsa_gen.c:390:10: Call
388. }
389.
390. if (!BN_lshift(test, BN_value_one(), L - 1))
^
391. goto err;
392. for (;;) {
crypto/bn/bn_shift.c:83:1: Parameter `r->top`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/dsa/dsa_gen.c:422:17: Call
420.
421. /* step 4 */
422. r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx,
^
423. seed_in ? 1 : 0, cb);
424. if (r > 0)
crypto/bn/bn_prime.c:151:1: Parameter `a->top`
149. }
150.
151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
152. int do_trial_division, BN_GENCB *cb)
153. {
crypto/bn/bn_prime.c:161:9: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:161:29: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:165:10: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:860:1: Parameter `a->top`
858. }
859.
860. > int BN_is_odd(const BIGNUM *a)
861. {
862. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_prime.c:165:26: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:542:1: Parameter `a->top`
540. }
541.
542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
543. {
544. int i;
crypto/bn/bn_prime.c:198:10: Call
196.
197. /* compute A1 := a - 1 */
198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1))
^
199. goto err;
200. /* compute A3 := a - 3 */
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:201:10: Call
199. goto err;
200. /* compute A3 := a - 3 */
201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3))
^
202. goto err;
203.
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:215:10: Call
213. if (mont == NULL)
214. goto err;
215. if (!BN_MONT_CTX_set(mont, a, ctx))
^
216. goto err;
217.
crypto/bn/bn_mont.c:238:9: Call
236. BIGNUM *Ri, *R;
237.
238. if (BN_is_zero(mod))
^
239. return 0;
240.
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/bn/bn_prime.c:223:13: Call
221. goto err;
222.
223. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
224. if (j == -1)
225. goto err;
crypto/bn/bn_prime.c:245:1: Parameter `a->top`
243. }
244.
245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
246. const BIGNUM *a1_odd, int k, BN_CTX *ctx,
247. BN_MONT_CTX *mont)
crypto/bn/bn_prime.c:249:10: Call
247. BN_MONT_CTX *mont)
248. {
249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
250. return -1;
251. if (BN_is_one(w))
crypto/bn/bn_exp.c:296:1: Parameter `m->top`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c:310:16: Call
308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
311. }
312.
crypto/bn/bn_exp.c:596:1: Parameter `m->top`
594. * http://www.daemonology.net/hyperthreading-considered-harmful/)
595. */
596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
597. const BIGNUM *m, BN_CTX *ctx,
598. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:617:10: Call
615. bn_check_top(m);
616.
617. if (!BN_is_odd(m)) {
^
618. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
619. return 0;
crypto/bn/bn_lib.c:860:1: Parameter `a->top`
858. }
859.
860. > int BN_is_odd(const BIGNUM *a)
861. {
862. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_exp.c:755:14: Call
753. /* prepare a^1 in Montgomery domain */
754. if (a->neg || BN_ucmp(a, m) >= 0) {
755. if (!BN_nnmod(&am, a, m, ctx))
^
756. goto err;
757. if (!BN_to_montgomery(&am, &am, mont, ctx))
crypto/bn/bn_mod.c:13:1: Parameter `d->top`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:199:31: Call
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_lib.c:140:9: Assignment
138.
139. if (BN_is_zero(a))
140. return 0;
^
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
142. }
crypto/bn/bn_div.c:199:5: Assignment
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_div.c:200:11: Call
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
201. goto err;
202. sdiv->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return 0;
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return 0;
100. r->neg = a->neg;
crypto/bn/bn_lib.c:941:1: Parameter `*a->d`
939. }
940.
941. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:104:5: Assignment
102. rb = BN_BITS2 - lb;
103. f = a->d;
104. t = r->d;
^
105. t[a->top + nw] = 0;
106. if (lb == 0)
crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`
110. for (i = a->top - 1; i >= 0; i--) {
111. l = f[i];
112. t[nw + i + 1] |= (l >> rb) & BN_MASK2;
^
113. t[nw + i] = (l << lb) & BN_MASK2;
114. }
| https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_shift.c/#L112 |
d2a_code_trace_data_45313 | static int
setupMap(TIFFRGBAImage* img)
{
int32 x, range;
range = (int32)((1L<<img->bitspersample)-1);
if( img->bitspersample == 16 )
range = (int32) 255;
img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
if (img->Map == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
"No space for photometric conversion table");
return (0);
}
if (img->photometric == PHOTOMETRIC_MINISWHITE) {
for (x = 0; x <= range; x++)
img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
} else {
for (x = 0; x <= range; x++)
img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
}
if (img->bitspersample <= 16 &&
(img->photometric == PHOTOMETRIC_MINISBLACK ||
img->photometric == PHOTOMETRIC_MINISWHITE)) {
if (!makebwmap(img))
return (0);
_TIFFfree(img->Map);
img->Map = NULL;
}
return (1);
}
libtiff/tif_getimage.c:2457: error: Memory Leak
memory dynamically allocated by call to `_TIFFmalloc()` at line 2437, column 32 is not reachable after line 2457, column 7.
libtiff/tif_getimage.c:2426:1: start of procedure setupMap()
2424. * process also handles inverting B&W images when needed.
2425. */
2426. static int
^
2427. setupMap(TIFFRGBAImage* img)
2428. {
libtiff/tif_getimage.c:2431:5:
2429. int32 x, range;
2430.
2431. range = (int32)((1L<<img->bitspersample)-1);
^
2432.
2433. /* treat 16 bit the same as eight bit */
libtiff/tif_getimage.c:2434:9: Taking false branch
2432.
2433. /* treat 16 bit the same as eight bit */
2434. if( img->bitspersample == 16 )
^
2435. range = (int32) 255;
2436.
libtiff/tif_getimage.c:2437:5:
2435. range = (int32) 255;
2436.
2437. img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
^
2438. if (img->Map == NULL) {
2439. TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
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)
libtiff/tif_getimage.c:2438:9: Taking false branch
2436.
2437. img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
2438. if (img->Map == NULL) {
^
2439. TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
2440. "No space for photometric conversion table");
libtiff/tif_getimage.c:2443:9: Taking true branch
2441. return (0);
2442. }
2443. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
^
2444. for (x = 0; x <= range; x++)
2445. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
libtiff/tif_getimage.c:2444:7:
2442. }
2443. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2444. for (x = 0; x <= range; x++)
^
2445. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2446. } else {
libtiff/tif_getimage.c:2444:14: Loop condition is true. Entering loop body
2442. }
2443. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2444. for (x = 0; x <= range; x++)
^
2445. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2446. } else {
libtiff/tif_getimage.c:2445:6:
2443. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2444. for (x = 0; x <= range; x++)
2445. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
^
2446. } else {
2447. for (x = 0; x <= range; x++)
libtiff/tif_getimage.c:2444:26:
2442. }
2443. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2444. for (x = 0; x <= range; x++)
^
2445. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2446. } else {
libtiff/tif_getimage.c:2444:14: Loop condition is false. Leaving loop
2442. }
2443. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2444. for (x = 0; x <= range; x++)
^
2445. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2446. } else {
libtiff/tif_getimage.c:2450:9: Taking true branch
2448. img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
2449. }
2450. if (img->bitspersample <= 16 &&
^
2451. (img->photometric == PHOTOMETRIC_MINISBLACK ||
2452. img->photometric == PHOTOMETRIC_MINISWHITE)) {
libtiff/tif_getimage.c:2451:3: Taking false branch
2449. }
2450. if (img->bitspersample <= 16 &&
2451. (img->photometric == PHOTOMETRIC_MINISBLACK ||
^
2452. img->photometric == PHOTOMETRIC_MINISWHITE)) {
2453. /*
libtiff/tif_getimage.c:2452:3: Taking true branch
2450. if (img->bitspersample <= 16 &&
2451. (img->photometric == PHOTOMETRIC_MINISBLACK ||
2452. img->photometric == PHOTOMETRIC_MINISWHITE)) {
^
2453. /*
2454. * Use photometric mapping table to construct
libtiff/tif_getimage.c:2457:7: Skipping makebwmap(): empty list of specs
2455. * unpacking tables for samples <= 8 bits.
2456. */
2457. if (!makebwmap(img))
^
2458. return (0);
2459. /* no longer need Map, free it */
| https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/libtiff/tif_getimage.c/#L2457 |
d2a_code_trace_data_45314 | static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
CONF *conf, char *section)
{
EVP_PKEY *pktmp;
pktmp = X509_get_pubkey(x);
EVP_PKEY_copy_parameters(pktmp,pkey);
EVP_PKEY_save_parameters(pktmp,1);
EVP_PKEY_free(pktmp);
if (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;
if (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
goto err;
if (!X509_set_pubkey(x,pkey)) goto err;
if (clrext)
{
while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
}
if (conf)
{
X509V3_CTX ctx;
X509_set_version(x,2);
X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
X509V3_set_nconf(&ctx, conf);
if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;
}
if (!X509_sign(x,pkey,digest)) goto err;
return 1;
err:
ERR_print_errors(bio_err);
return 0;
}
apps/x509.c:1226: error: NULL_DEREFERENCE
pointer `pktmp` last assigned on line 1225 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1226, column 2.
Showing all 84 steps of the trace
apps/x509.c:1219:1: start of procedure sign()
1217.
1218. /* self sign */
1219. > static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
1220. CONF *conf, char *section)
1221. {
apps/x509.c:1225:2:
1223. EVP_PKEY *pktmp;
1224.
1225. > pktmp = X509_get_pubkey(x);
1226. EVP_PKEY_copy_parameters(pktmp,pkey);
1227. EVP_PKEY_save_parameters(pktmp,1);
crypto/x509/x509_cmp.c:358:1: start of procedure X509_get_pubkey()
356. }
357.
358. > EVP_PKEY *X509_get_pubkey(X509 *x)
359. {
360. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:360:7: Taking false branch
358. EVP_PKEY *X509_get_pubkey(X509 *x)
359. {
360. if ((x == NULL) || (x->cert_info == NULL))
^
361. return(NULL);
362. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:360:22: Taking false branch
358. EVP_PKEY *X509_get_pubkey(X509 *x)
359. {
360. if ((x == NULL) || (x->cert_info == NULL))
^
361. return(NULL);
362. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:362:2:
360. if ((x == NULL) || (x->cert_info == NULL))
361. return(NULL);
362. > return(X509_PUBKEY_get(x->cert_info->key));
363. }
364.
crypto/asn1/x_pubkey.c:226:1: start of procedure X509_PUBKEY_get()
224. }
225.
226. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
227. {
228. EVP_PKEY *ret=NULL;
crypto/asn1/x_pubkey.c:228:2:
226. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
227. {
228. > EVP_PKEY *ret=NULL;
229. long j;
230. int type;
crypto/asn1/x_pubkey.c:237:6: Taking false branch
235. #endif
236.
237. if (key == NULL) goto err;
^
238.
239. if (key->pkey != NULL)
crypto/asn1/x_pubkey.c:239:6: Taking false branch
237. if (key == NULL) goto err;
238.
239. if (key->pkey != NULL)
^
240. {
241. CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
crypto/asn1/x_pubkey.c:245:6: Taking false branch
243. }
244.
245. if (key->public_key == NULL) goto err;
^
246.
247. type=OBJ_obj2nid(key->algor->algorithm);
crypto/asn1/x_pubkey.c:247:2:
245. if (key->public_key == NULL) goto err;
246.
247. > type=OBJ_obj2nid(key->algor->algorithm);
248. if ((ret = EVP_PKEY_new()) == NULL)
249. {
crypto/objects/obj_dat.c:366:1: start of procedure OBJ_obj2nid()
364. }
365.
366. > int OBJ_obj2nid(const ASN1_OBJECT *a)
367. {
368. ASN1_OBJECT **op;
crypto/objects/obj_dat.c:371:6: Taking false branch
369. ADDED_OBJ ad,*adp;
370.
371. if (a == NULL)
^
372. return(NID_undef);
373. if (a->nid != 0)
crypto/objects/obj_dat.c:373:6: Taking false branch
371. if (a == NULL)
372. return(NID_undef);
373. if (a->nid != 0)
^
374. return(a->nid);
375.
crypto/objects/obj_dat.c:376:6: Taking true branch
374. return(a->nid);
375.
376. if (added != NULL)
^
377. {
378. ad.type=ADDED_DATA;
crypto/objects/obj_dat.c:378:3:
376. if (added != NULL)
377. {
378. > ad.type=ADDED_DATA;
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
crypto/objects/obj_dat.c:379:3:
377. {
378. ad.type=ADDED_DATA;
379. > ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
crypto/objects/obj_dat.c:380:3:
378. ad.type=ADDED_DATA;
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. > adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
382. }
crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
246. }
247.
248. > void *lh_retrieve(LHASH *lh, const void *data)
249. {
250. unsigned long hash;
crypto/lhash/lhash.c:254:2:
252. const void *ret;
253.
254. > lh->error=0;
255. rn=getrn(lh,data,&hash);
256.
crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
253.
254. lh->error=0;
255. rn=getrn(lh,data,&hash);
^
256.
257. if (*rn == NULL)
crypto/lhash/lhash.c:257:6: Taking false branch
255. rn=getrn(lh,data,&hash);
256.
257. if (*rn == NULL)
^
258. {
259. lh->num_retrieve_miss++;
crypto/lhash/lhash.c:264:3:
262. else
263. {
264. > ret= (*rn)->data;
265. lh->num_retrieve++;
266. }
crypto/lhash/lhash.c:265:3:
263. {
264. ret= (*rn)->data;
265. > lh->num_retrieve++;
266. }
267. return((void *)ret);
crypto/lhash/lhash.c:267:2:
265. lh->num_retrieve++;
266. }
267. > return((void *)ret);
268. }
269.
crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
266. }
267. return((void *)ret);
268. }
^
269.
270. static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
crypto/objects/obj_dat.c:381:7: Taking true branch
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
^
382. }
383. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
crypto/objects/obj_dat.c:381:20:
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. > if (adp != NULL) return (adp->obj->nid);
382. }
383. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
crypto/objects/obj_dat.c:388:2: return from a call to OBJ_obj2nid
386. return(NID_undef);
387. return((*op)->nid);
388. }
^
389.
390. /* Convert an object name into an ASN1_OBJECT
crypto/asn1/x_pubkey.c:248:6:
246.
247. type=OBJ_obj2nid(key->algor->algorithm);
248. > if ((ret = EVP_PKEY_new()) == NULL)
249. {
250. X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
crypto/evp/p_lib.c:301:1: start of procedure EVP_PKEY_new()
299. }
300.
301. > EVP_PKEY *EVP_PKEY_new(void)
302. {
303. EVP_PKEY *ret;
crypto/evp/p_lib.c:305:2:
303. EVP_PKEY *ret;
304.
305. > ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
306. if (ret == NULL)
307. {
crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
289. }
290.
291. > void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. void *ret = NULL;
crypto/mem.c:293:2:
291. void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. > void *ret = NULL;
294. extern unsigned char cleanse_ctr;
295.
crypto/mem.c:296:6: Taking false branch
294. extern unsigned char cleanse_ctr;
295.
296. if (num <= 0) return NULL;
^
297.
298. allow_customize = 0;
crypto/mem.c:298:2:
296. if (num <= 0) return NULL;
297.
298. > allow_customize = 0;
299. if (malloc_debug_func != NULL)
300. {
crypto/mem.c:299:6: Taking true branch
297.
298. allow_customize = 0;
299. if (malloc_debug_func != NULL)
^
300. {
301. allow_customize_debug = 0;
crypto/mem.c:301:3:
299. if (malloc_debug_func != NULL)
300. {
301. > allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
300. {
301. allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
^
303. }
304. ret = malloc_ex_func(num,file,line);
crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
304. ret = malloc_ex_func(num,file,line);
^
305. #ifdef LEVITTE_DEBUG_MEM
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:308:6: Taking true branch
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
307. #endif
308. if (malloc_debug_func != NULL)
^
309. malloc_debug_func(ret, num, file, line, 1);
310.
crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
307. #endif
308. if (malloc_debug_func != NULL)
309. malloc_debug_func(ret, num, file, line, 1);
^
310.
311. /* Create a dependency on the value of 'cleanse_ctr' so our memory
crypto/mem.c:314:12: Taking false branch
312. * sanitisation function can't be optimised out. NB: We only do
313. * this for >2Kb so the overhead doesn't bother us. */
314. if(ret && (num > 2048))
^
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
crypto/mem.c:317:2:
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
317. > return ret;
318. }
319.
crypto/mem.c:318:2: return from a call to CRYPTO_malloc
316.
317. return ret;
318. }
^
319.
320. void *CRYPTO_realloc(void *str, int num, const char *file, int line)
crypto/evp/p_lib.c:306:6: Taking true branch
304.
305. ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
306. if (ret == NULL)
^
307. {
308. EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
crypto/evp/p_lib.c:308:3:
306. if (ret == NULL)
307. {
308. > EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
309. return(NULL);
310. }
crypto/err/err.c:664:1: start of procedure ERR_put_error()
662. /********************************************************/
663.
664. > void ERR_put_error(int lib, int func, int reason, const char *file,
665. int line)
666. {
crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
686. }
687. #endif
688. es=ERR_get_state();
^
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:690:2:
688. es=ERR_get_state();
689.
690. > es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:691:6: Taking false branch
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
^
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
crypto/err/err.c:693:2:
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. > es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
crypto/err/err.c:694:2:
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
694. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
crypto/err/err.c:695:2:
693. es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. > es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
crypto/err/err.c:696:2:
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. > es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Taking false branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Loop condition is false. Leaving loop
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:698:2: return from a call to ERR_put_error
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
^
699.
700. void ERR_clear_error(void)
crypto/evp/p_lib.c:309:3:
307. {
308. EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
309. > return(NULL);
310. }
311. ret->type=EVP_PKEY_NONE;
crypto/evp/p_lib.c:317:2: return from a call to EVP_PKEY_new
315. ret->save_parameters=1;
316. return(ret);
317. }
^
318.
319. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
crypto/asn1/x_pubkey.c:248:6: Taking true branch
246.
247. type=OBJ_obj2nid(key->algor->algorithm);
248. if ((ret = EVP_PKEY_new()) == NULL)
^
249. {
250. X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
crypto/asn1/x_pubkey.c:250:3:
248. if ((ret = EVP_PKEY_new()) == NULL)
249. {
250. > X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
251. goto err;
252. }
crypto/err/err.c:664:1: start of procedure ERR_put_error()
662. /********************************************************/
663.
664. > void ERR_put_error(int lib, int func, int reason, const char *file,
665. int line)
666. {
crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
686. }
687. #endif
688. es=ERR_get_state();
^
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:690:2:
688. es=ERR_get_state();
689.
690. > es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:691:6: Taking false branch
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
^
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
crypto/err/err.c:693:2:
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. > es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
crypto/err/err.c:694:2:
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
694. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
crypto/err/err.c:695:2:
693. es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. > es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
crypto/err/err.c:696:2:
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. > es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Taking false branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Loop condition is false. Leaving loop
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:698:2: return from a call to ERR_put_error
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
^
699.
700. void ERR_clear_error(void)
crypto/asn1/x_pubkey.c:337:1:
335. CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
336. return(ret);
337. > err:
338. if (ret != NULL)
339. EVP_PKEY_free(ret);
crypto/asn1/x_pubkey.c:338:6: Taking false branch
336. return(ret);
337. err:
338. if (ret != NULL)
^
339. EVP_PKEY_free(ret);
340. return(NULL);
crypto/asn1/x_pubkey.c:340:2:
338. if (ret != NULL)
339. EVP_PKEY_free(ret);
340. > return(NULL);
341. }
342.
crypto/asn1/x_pubkey.c:341:2: return from a call to X509_PUBKEY_get
339. EVP_PKEY_free(ret);
340. return(NULL);
341. }
^
342.
343. /* Now two pseudo ASN1 routines that take an EVP_PKEY structure
crypto/x509/x509_cmp.c:363:2: return from a call to X509_get_pubkey
361. return(NULL);
362. return(X509_PUBKEY_get(x->cert_info->key));
363. }
^
364.
365. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
apps/x509.c:1226:2:
1224.
1225. pktmp = X509_get_pubkey(x);
1226. > EVP_PKEY_copy_parameters(pktmp,pkey);
1227. EVP_PKEY_save_parameters(pktmp,1);
1228. EVP_PKEY_free(pktmp);
crypto/evp/p_lib.c:156:1: start of procedure EVP_PKEY_copy_parameters()
154. }
155.
156. > int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
157. {
158. if (to->type != from->type)
crypto/evp/p_lib.c:158:6:
156. int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
157. {
158. > if (to->type != from->type)
159. {
160. EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_DIFFERENT_KEY_TYPES);
| https://github.com/openssl/openssl/blob/00dd8f6d6e703dadab3c50af84ed55ffff598ddc/apps/x509.c/#L1226 |
d2a_code_trace_data_45315 | AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
AVFilterBufferRef *ret = NULL;
av_unused char buf[16];
FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
if (link->dstpad->get_video_buffer)
ret = link->dstpad->get_video_buffer(link, perms, w, h);
if (!ret)
ret = avfilter_default_get_video_buffer(link, perms, w, h);
if (ret)
ret->type = AVMEDIA_TYPE_VIDEO;
FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
return ret;
}
libavfilter/video.c:155: error: Null Dereference
pointer `ret` last assigned on line 150 could be null and is dereferenced by call to `ff_dlog_ref()` at line 155, column 106.
libavfilter/video.c:138:1: start of procedure avfilter_get_video_buffer()
136. }
137.
138. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
^
139. {
140. AVFilterBufferRef *ret = NULL;
libavfilter/video.c:140:5:
138. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
139. {
140. AVFilterBufferRef *ret = NULL;
^
141.
142. av_unused char buf[16];
libavfilter/video.c:143:47:
141.
142. av_unused char buf[16];
143. FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
^
144. av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
145.
libavfilter/avfilter.c:182:1: start of procedure ff_dlog_link()
180. }
181.
182. void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
^
183. {
184. if (link->type == AVMEDIA_TYPE_VIDEO) {
libavfilter/avfilter.c:184:9: Taking false branch
182. void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
183. {
184. if (link->type == AVMEDIA_TYPE_VIDEO) {
^
185. av_dlog(ctx,
186. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
libavfilter/avfilter.c:194:9: Skipping av_get_channel_layout_string(): empty list of specs
192. } else {
193. char buf[128];
194. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
^
195.
196. av_dlog(ctx,
libavfilter/avfilter.c:184:5:
182. void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
183. {
184. if (link->type == AVMEDIA_TYPE_VIDEO) {
^
185. av_dlog(ctx,
186. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
libavfilter/avfilter.c:204:1: return from a call to ff_dlog_link
202. end ? "\n" : "");
203. }
204. }
^
205.
206. int avfilter_request_frame(AVFilterLink *link)
libavfilter/video.c:146:9: Taking true branch
144. av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
145.
146. if (link->dstpad->get_video_buffer)
^
147. ret = link->dstpad->get_video_buffer(link, perms, w, h);
148.
libavfilter/video.c:147:9: Skipping __function_pointer__(): unresolved function pointer
145.
146. if (link->dstpad->get_video_buffer)
147. ret = link->dstpad->get_video_buffer(link, perms, w, h);
^
148.
149. if (!ret)
libavfilter/video.c:149:10: Taking true branch
147. ret = link->dstpad->get_video_buffer(link, perms, w, h);
148.
149. if (!ret)
^
150. ret = avfilter_default_get_video_buffer(link, perms, w, h);
151.
libavfilter/video.c:150:9:
148.
149. if (!ret)
150. ret = avfilter_default_get_video_buffer(link, perms, w, h);
^
151.
152. if (ret)
libavfilter/video.c:75:1: start of procedure avfilter_default_get_video_buffer()
73. * filter chain. This will allow for a buffer pool instead of the constant
74. * alloc & free cycle currently implemented. */
75. AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
^
76. {
77. int linesize[4];
libavfilter/video.c:79:5:
77. int linesize[4];
78. uint8_t *data[4];
79. AVFilterBufferRef *picref = NULL;
^
80.
81. // +2 is needed for swscaler, +16 to be SIMD-friendly
libavfilter/video.c:82:9: Taking true branch
80.
81. // +2 is needed for swscaler, +16 to be SIMD-friendly
82. if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
^
83. return NULL;
84.
libavfilter/video.c:83:9:
81. // +2 is needed for swscaler, +16 to be SIMD-friendly
82. if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
83. return NULL;
^
84.
85. picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
libavfilter/video.c:93:1: return from a call to avfilter_default_get_video_buffer
91.
92. return picref;
93. }
^
94.
95. AVFilterBufferRef *
libavfilter/video.c:152:9: Taking false branch
150. ret = avfilter_default_get_video_buffer(link, perms, w, h);
151.
152. if (ret)
^
153. ret->type = AVMEDIA_TYPE_VIDEO;
154.
libavfilter/video.c:155:47:
153. ret->type = AVMEDIA_TYPE_VIDEO;
154.
155. FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
^
156.
157. return ret;
libavfilter/avfilter.c:182:1: start of procedure ff_dlog_link()
180. }
181.
182. void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
^
183. {
184. if (link->type == AVMEDIA_TYPE_VIDEO) {
libavfilter/avfilter.c:184:9: Taking false branch
182. void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
183. {
184. if (link->type == AVMEDIA_TYPE_VIDEO) {
^
185. av_dlog(ctx,
186. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
libavfilter/avfilter.c:194:9: Skipping av_get_channel_layout_string(): empty list of specs
192. } else {
193. char buf[128];
194. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
^
195.
196. av_dlog(ctx,
libavfilter/avfilter.c:184:5:
182. void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
183. {
184. if (link->type == AVMEDIA_TYPE_VIDEO) {
^
185. av_dlog(ctx,
186. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
libavfilter/avfilter.c:204:1: return from a call to ff_dlog_link
202. end ? "\n" : "");
203. }
204. }
^
205.
206. int avfilter_request_frame(AVFilterLink *link)
libavfilter/video.c:155:106:
153. ret->type = AVMEDIA_TYPE_VIDEO;
154.
155. FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
^
156.
157. return ret;
libavfilter/video.c:38:1: start of procedure ff_dlog_ref()
36. #endif
37.
38. static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
^
39. {
40. av_unused char buf[16];
libavfilter/video.c:47:9: Taking false branch
45. ref->pts, ref->pos);
46.
47. if (ref->video) {
^
48. av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
49. ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
| https://github.com/libav/libav/blob/46ea46357a1f9adf7a8266125308803d00024b75/libavfilter/video.c/#L155 |
d2a_code_trace_data_45316 | ssize_t
ngx_parse_size(ngx_str_t *line)
{
u_char unit;
size_t len;
ssize_t size;
ngx_int_t scale;
len = line->len;
unit = line->data[len - 1];
switch (unit) {
case 'K':
case 'k':
len--;
scale = 1024;
break;
case 'M':
case 'm':
len--;
scale = 1024 * 1024;
break;
default:
scale = 1;
}
size = ngx_atosz(line->data, len);
if (size == NGX_ERROR) {
return NGX_ERROR;
}
size *= scale;
return size;
}
src/http/modules/ngx_http_log_module.c:935: error: Integer Overflow L2
([0, +oo] - 1):unsigned64 by call to `ngx_parse_size`.
src/http/modules/ngx_http_log_module.c:857:9: Call
855. ngx_memzero(log, sizeof(ngx_http_log_t));
856.
857. n = ngx_http_script_variables_count(&value[1]);
^
858.
859. if (n == 0) {
src/http/ngx_http_script.c:214:1: Parameter `value->len`
212.
213.
214. ngx_uint_t
^
215. ngx_http_script_variables_count(ngx_str_t *value)
216. {
src/http/modules/ngx_http_log_module.c:932:9: Assignment
930. }
931.
932. name.len = value[3].len - 7;
^
933. name.data = value[3].data + 7;
934.
src/http/modules/ngx_http_log_module.c:935:15: Call
933. name.data = value[3].data + 7;
934.
935. buf = ngx_parse_size(&name);
^
936.
937. if (buf == NGX_ERROR) {
src/core/ngx_parse.c:11:1: <LHS trace>
9.
10.
11. ssize_t
^
12. ngx_parse_size(ngx_str_t *line)
13. {
src/core/ngx_parse.c:11:1: Parameter `line->len`
9.
10.
11. ssize_t
^
12. ngx_parse_size(ngx_str_t *line)
13. {
src/core/ngx_parse.c:19:5: Assignment
17. ngx_int_t scale;
18.
19. len = line->len;
^
20. unit = line->data[len - 1];
21.
src/core/ngx_parse.c:20:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size`
18.
19. len = line->len;
20. unit = line->data[len - 1];
^
21.
22. switch (unit) {
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_parse.c/#L20 |
d2a_code_trace_data_45317 | static void info_cb(const SSL *s, int where, int ret)
{
if (where & SSL_CB_ALERT) {
HANDSHAKE_EX_DATA *ex_data =
(HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
if (where & SSL_CB_WRITE) {
ex_data->alert_sent = ret;
if (strcmp(SSL_alert_type_string(ret), "F") == 0
|| strcmp(SSL_alert_desc_string(ret), "CN") == 0)
ex_data->num_fatal_alerts_sent++;
} else {
ex_data->alert_received = ret;
}
}
}
test/handshake_helper.c:90: error: NULL_DEREFERENCE
pointer `ex_data` last assigned on line 87 could be null and is dereferenced at line 90, column 13.
Showing all 12 steps of the trace
test/handshake_helper.c:84:1: start of procedure info_cb()
82. static int ex_data_idx;
83.
84. > static void info_cb(const SSL *s, int where, int ret)
85. {
86. if (where & SSL_CB_ALERT) {
test/handshake_helper.c:86:9: Taking true branch
84. static void info_cb(const SSL *s, int where, int ret)
85. {
86. if (where & SSL_CB_ALERT) {
^
87. HANDSHAKE_EX_DATA *ex_data =
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
test/handshake_helper.c:87:9:
85. {
86. if (where & SSL_CB_ALERT) {
87. > HANDSHAKE_EX_DATA *ex_data =
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89. if (where & SSL_CB_WRITE) {
ssl/ssl_lib.c:3729:1: start of procedure SSL_get_ex_data()
3727. }
3728.
3729. > void *SSL_get_ex_data(const SSL *s, int idx)
3730. {
3731. return (CRYPTO_get_ex_data(&s->ex_data, idx));
ssl/ssl_lib.c:3731:5:
3729. void *SSL_get_ex_data(const SSL *s, int idx)
3730. {
3731. > return (CRYPTO_get_ex_data(&s->ex_data, idx));
3732. }
3733.
crypto/ex_data.c:387:1: start of procedure CRYPTO_get_ex_data()
385. * particular index in the class used by this variable
386. */
387. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
388. {
389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:389:9: Taking true branch
387. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
388. {
389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
390. return NULL;
391. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:390:9:
388. {
389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
390. > return NULL;
391. return sk_void_value(ad->sk, idx);
392. }
crypto/ex_data.c:392:1: return from a call to CRYPTO_get_ex_data
390. return NULL;
391. return sk_void_value(ad->sk, idx);
392. > }
ssl/ssl_lib.c:3732:1: return from a call to SSL_get_ex_data
3730. {
3731. return (CRYPTO_get_ex_data(&s->ex_data, idx));
3732. > }
3733.
3734. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
test/handshake_helper.c:89:13: Taking true branch
87. HANDSHAKE_EX_DATA *ex_data =
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89. if (where & SSL_CB_WRITE) {
^
90. ex_data->alert_sent = ret;
91. if (strcmp(SSL_alert_type_string(ret), "F") == 0
test/handshake_helper.c:90:13:
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89. if (where & SSL_CB_WRITE) {
90. > ex_data->alert_sent = ret;
91. if (strcmp(SSL_alert_type_string(ret), "F") == 0
92. || strcmp(SSL_alert_desc_string(ret), "CN") == 0)
| https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L90 |
d2a_code_trace_data_45318 | void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb)
{
ENGINE_CLEANUP_ITEM *item;
if (!int_cleanup_check(1))
return;
item = int_cleanup_item(cb);
if (item)
sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);
}
crypto/engine/eng_lib.c:179: error: MEMORY_LEAK
memory dynamically allocated by call to `int_cleanup_item()` at line 177, column 12 is not reachable after line 179, column 9.
Showing all 43 steps of the trace
crypto/engine/eng_lib.c:172:1: start of procedure engine_cleanup_add_first()
170. }
171.
172. > void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb)
173. {
174. ENGINE_CLEANUP_ITEM *item;
crypto/engine/eng_lib.c:175:10:
173. {
174. ENGINE_CLEANUP_ITEM *item;
175. > if (!int_cleanup_check(1))
176. return;
177. item = int_cleanup_item(cb);
crypto/engine/eng_lib.c:153:1: start of procedure int_cleanup_check()
151. */
152. static STACK_OF(ENGINE_CLEANUP_ITEM) *cleanup_stack = NULL;
153. > static int int_cleanup_check(int create)
154. {
155. if (cleanup_stack)
crypto/engine/eng_lib.c:155:9: Taking true branch
153. static int int_cleanup_check(int create)
154. {
155. if (cleanup_stack)
^
156. return 1;
157. if (!create)
crypto/engine/eng_lib.c:156:9:
154. {
155. if (cleanup_stack)
156. > return 1;
157. if (!create)
158. return 0;
crypto/engine/eng_lib.c:161:1: return from a call to int_cleanup_check
159. cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null();
160. return (cleanup_stack ? 1 : 0);
161. > }
162.
163. static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
crypto/engine/eng_lib.c:175:10: Taking false branch
173. {
174. ENGINE_CLEANUP_ITEM *item;
175. if (!int_cleanup_check(1))
^
176. return;
177. item = int_cleanup_item(cb);
crypto/engine/eng_lib.c:177:5:
175. if (!int_cleanup_check(1))
176. return;
177. > item = int_cleanup_item(cb);
178. if (item)
179. sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);
crypto/engine/eng_lib.c:163:1: start of procedure int_cleanup_item()
161. }
162.
163. > static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
164. {
165. ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item));
crypto/engine/eng_lib.c:165:5:
163. static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
164. {
165. > ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item));
166. if (item == NULL)
167. return NULL;
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/engine/eng_lib.c:166:9: Taking false branch
164. {
165. ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item));
166. if (item == NULL)
^
167. return NULL;
168. item->cb = cb;
crypto/engine/eng_lib.c:168:5:
166. if (item == NULL)
167. return NULL;
168. > item->cb = cb;
169. return item;
170. }
crypto/engine/eng_lib.c:169:5:
167. return NULL;
168. item->cb = cb;
169. > return item;
170. }
171.
crypto/engine/eng_lib.c:170:1: return from a call to int_cleanup_item
168. item->cb = cb;
169. return item;
170. > }
171.
172. void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb)
crypto/engine/eng_lib.c:178:9: Taking true branch
176. return;
177. item = int_cleanup_item(cb);
178. if (item)
^
179. sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);
180. }
crypto/engine/eng_lib.c:179:9:
177. item = int_cleanup_item(cb);
178. if (item)
179. > sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);
180. }
181.
crypto/engine/eng_int.h:109:1: start of procedure sk_ENGINE_CLEANUP_ITEM_insert()
107. ENGINE_CLEANUP_CB *cb;
108. } ENGINE_CLEANUP_ITEM;
109. > DEFINE_STACK_OF(ENGINE_CLEANUP_ITEM)
110. void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb);
111. void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb);
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 true 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:174:9:
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);
176. if (s == NULL)
crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
164. }
165.
166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
crypto/mem.c:168:9: Taking true branch
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
^
169. return CRYPTO_malloc(num, file, line);
170.
crypto/mem.c:169:9:
167. {
168. if (str == NULL)
169. > return CRYPTO_malloc(num, file, line);
170.
171. if (num == 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 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/mem.c:191:1: return from a call to CRYPTO_realloc
189. return realloc(str, num);
190.
191. > }
192.
193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
crypto/stack/stack.c:176:13: Taking true branch
174. s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
^
177. return (0);
178. st->data = s;
crypto/stack/stack.c:177:13:
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
177. > return (0);
178. st->data = s;
179. st->num_alloc *= 2;
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/engine/eng_int.h:109:1: return from a call to sk_ENGINE_CLEANUP_ITEM_insert
107. ENGINE_CLEANUP_CB *cb;
108. } ENGINE_CLEANUP_ITEM;
109. > DEFINE_STACK_OF(ENGINE_CLEANUP_ITEM)
110. void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb);
111. void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb);
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/engine/eng_lib.c/#L179 |
d2a_code_trace_data_45319 | static void imdct36(int *out, int *buf, int *in, int *win)
{
int i, j, t0, t1, t2, t3, s0, s1, s2, s3;
int tmp[18], *tmp1, *in1;
for(i=17;i>=1;i--)
in[i] += in[i-1];
for(i=17;i>=3;i-=2)
in[i] += in[i-2];
for(j=0;j<2;j++) {
tmp1 = tmp + j;
in1 = in + j;
#if 0
int64_t t0, t1, t2, t3;
t2 = in1[2*4] + in1[2*8] - in1[2*2];
t3 = (in1[2*0] + (int64_t)(in1[2*6]>>1))<<32;
t1 = in1[2*0] - in1[2*6];
tmp1[ 6] = t1 - (t2>>1);
tmp1[16] = t1 + t2;
t0 = MUL64(2*(in1[2*2] + in1[2*4]), C2);
t1 = MUL64( in1[2*4] - in1[2*8] , -2*C8);
t2 = MUL64(2*(in1[2*2] + in1[2*8]), -C4);
tmp1[10] = (t3 - t0 - t2) >> 32;
tmp1[ 2] = (t3 + t0 + t1) >> 32;
tmp1[14] = (t3 + t2 - t1) >> 32;
tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3);
t2 = MUL64(2*(in1[2*1] + in1[2*5]), C1);
t3 = MUL64( in1[2*5] - in1[2*7] , -2*C7);
t0 = MUL64(2*in1[2*3], C3);
t1 = MUL64(2*(in1[2*1] + in1[2*7]), -C5);
tmp1[ 0] = (t2 + t3 + t0) >> 32;
tmp1[12] = (t2 + t1 - t0) >> 32;
tmp1[ 8] = (t3 - t1 - t0) >> 32;
#else
t2 = in1[2*4] + in1[2*8] - in1[2*2];
t3 = in1[2*0] + (in1[2*6]>>1);
t1 = in1[2*0] - in1[2*6];
tmp1[ 6] = t1 - (t2>>1);
tmp1[16] = t1 + t2;
t0 = MULH(2*(in1[2*2] + in1[2*4]), C2);
t1 = MULH( in1[2*4] - in1[2*8] , -2*C8);
t2 = MULH(2*(in1[2*2] + in1[2*8]), -C4);
tmp1[10] = t3 - t0 - t2;
tmp1[ 2] = t3 + t0 + t1;
tmp1[14] = t3 + t2 - t1;
tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3);
t2 = MULH(2*(in1[2*1] + in1[2*5]), C1);
t3 = MULH( in1[2*5] - in1[2*7] , -2*C7);
t0 = MULH(2*in1[2*3], C3);
t1 = MULH(2*(in1[2*1] + in1[2*7]), -C5);
tmp1[ 0] = t2 + t3 + t0;
tmp1[12] = t2 + t1 - t0;
tmp1[ 8] = t3 - t1 - t0;
#endif
}
i = 0;
for(j=0;j<4;j++) {
t0 = tmp[i];
t1 = tmp[i + 2];
s0 = t1 + t0;
s2 = t1 - t0;
t2 = tmp[i + 1];
t3 = tmp[i + 3];
s1 = MULH(2*(t3 + t2), icos36h[j]);
s3 = MULL(t3 - t2, icos36[8 - j]);
t0 = s0 + s1;
t1 = s0 - s1;
out[(9 + j)*SBLIMIT] = MULH(t1, win[9 + j]) + buf[9 + j];
out[(8 - j)*SBLIMIT] = MULH(t1, win[8 - j]) + buf[8 - j];
buf[9 + j] = MULH(t0, win[18 + 9 + j]);
buf[8 - j] = MULH(t0, win[18 + 8 - j]);
t0 = s2 + s3;
t1 = s2 - s3;
out[(9 + 8 - j)*SBLIMIT] = MULH(t1, win[9 + 8 - j]) + buf[9 + 8 - j];
out[( j)*SBLIMIT] = MULH(t1, win[ j]) + buf[ j];
buf[9 + 8 - j] = MULH(t0, win[18 + 9 + 8 - j]);
buf[ + j] = MULH(t0, win[18 + j]);
i += 4;
}
s0 = tmp[16];
s1 = MULH(2*tmp[17], icos36h[4]);
t0 = s0 + s1;
t1 = s0 - s1;
out[(9 + 4)*SBLIMIT] = MULH(t1, win[9 + 4]) + buf[9 + 4];
out[(8 - 4)*SBLIMIT] = MULH(t1, win[8 - 4]) + buf[8 - 4];
buf[9 + 4] = MULH(t0, win[18 + 9 + 4]);
buf[8 - 4] = MULH(t0, win[18 + 8 - 4]);
}
libavcodec/mpegaudiodec.c:1092: error: Uninitialized Value
The value read from tmp[_] was never initialized.
libavcodec/mpegaudiodec.c:1092:9:
1090.
1091. t2 = tmp[i + 1];
1092. t3 = tmp[i + 3];
^
1093. s1 = MULH(2*(t3 + t2), icos36h[j]);
1094. s3 = MULL(t3 - t2, icos36[8 - j]);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L1092 |
d2a_code_trace_data_45320 | static void vc1_decode_i_blocks_adv(VC1Context *v)
{
int k, j;
MpegEncContext *s = &v->s;
int cbp, val;
uint8_t *coded_val;
int mb_pos;
int mquant = v->pq;
int mqdiff;
int overlap;
GetBitContext *gb = &s->gb;
switch(v->y_ac_table_index){
case 0:
v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
break;
case 1:
v->codingset = CS_HIGH_MOT_INTRA;
break;
case 2:
v->codingset = CS_MID_RATE_INTRA;
break;
}
switch(v->c_ac_table_index){
case 0:
v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
break;
case 1:
v->codingset2 = CS_HIGH_MOT_INTER;
break;
case 2:
v->codingset2 = CS_MID_RATE_INTER;
break;
}
s->mb_x = s->mb_y = 0;
s->mb_intra = 1;
s->first_slice_line = 1;
for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
ff_init_block_index(s);
ff_update_block_index(s);
s->dsp.clear_blocks(s->block[0]);
mb_pos = s->mb_x + s->mb_y * s->mb_stride;
s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
if(v->acpred_is_raw)
v->s.ac_pred = get_bits1(&v->s.gb);
else
v->s.ac_pred = v->acpred_plane[mb_pos];
if(v->condover == CONDOVER_SELECT) {
if(v->overflg_is_raw)
overlap = get_bits1(&v->s.gb);
else
overlap = v->over_flags_plane[mb_pos];
} else
overlap = (v->condover == CONDOVER_ALL);
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
s->y_dc_scale = s->y_dc_scale_table[mquant];
s->c_dc_scale = s->c_dc_scale_table[mquant];
for(k = 0; k < 6; k++) {
val = ((cbp >> (5 - k)) & 1);
if (k < 4) {
int pred = vc1_coded_block_pred(&v->s, k, &coded_val);
val = val ^ pred;
*coded_val = val;
}
cbp |= val << (5 - k);
v->a_avail = !s->first_slice_line || (k==2 || k==3);
v->c_avail = !!s->mb_x || (k==1 || k==3);
vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant);
s->dsp.vc1_inv_trans_8x8(s->block[k]);
for(j = 0; j < 64; j++) s->block[k][j] += 128;
}
vc1_put_block(v, s->block);
if(overlap) {
if(s->mb_x) {
s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
if(!(s->flags & CODEC_FLAG_GRAY)) {
s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
}
}
s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
if(!s->first_slice_line) {
s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
if(!(s->flags & CODEC_FLAG_GRAY)) {
s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
}
}
s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
}
if(get_bits_count(&s->gb) > v->bits) {
ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
return;
}
}
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
libavcodec/vc1.c:3586: error: Buffer Overrun L2
Offset: [0, 63] Size: 2.
libavcodec/vc1.c:3586:21: <Offset trace>
3584.
3585. s->dsp.vc1_inv_trans_8x8(s->block[k]);
3586. for(j = 0; j < 64; j++) s->block[k][j] += 128;
^
3587. }
3588.
libavcodec/vc1.c:3586:21: Assignment
3584.
3585. s->dsp.vc1_inv_trans_8x8(s->block[k]);
3586. for(j = 0; j < 64; j++) s->block[k][j] += 128;
^
3587. }
3588.
libavcodec/vc1.c:3583:17: <Length trace>
3581. v->c_avail = !!s->mb_x || (k==1 || k==3);
3582.
3583. vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant);
^
3584.
3585. s->dsp.vc1_inv_trans_8x8(s->block[k]);
libavcodec/vc1.c:3583:17: Call
3581. v->c_avail = !!s->mb_x || (k==1 || k==3);
3582.
3583. vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant);
^
3584.
3585. s->dsp.vc1_inv_trans_8x8(s->block[k]);
libavcodec/vc1.c:2496:1: Parameter `*block`
2494. * @param codingset set of VLC to decode data
2495. */
2496. static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant)
^
2497. {
2498. GetBitContext *gb = &v->s.gb;
libavcodec/vc1.c:3586:41: Array access: Offset: [0, 63] Size: 2
3584.
3585. s->dsp.vc1_inv_trans_8x8(s->block[k]);
3586. for(j = 0; j < 64; j++) s->block[k][j] += 128;
^
3587. }
3588.
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3586 |
d2a_code_trace_data_45321 | 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:1063: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 21]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 20 steps of the trace
ssl/t1_lib.c:1016:1: Parameter `pkt->written`
1014. }
1015.
1016. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al)
1017. {
1018. #ifndef OPENSSL_NO_EC
ssl/t1_lib.c:1057:14: Call
1055. if (s->tlsext_hostname != NULL) {
1056. /* Add TLS extension servername to the Client Hello message */
1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
^
1058. /* Sub-packet for server_name extension */
1059. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:242:1: Parameter `pkt->written`
240. }
241.
242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
243. {
244. unsigned char *data;
ssl/t1_lib.c:1059:21: Call
1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
1058. /* Sub-packet for server_name extension */
1059. || !WPACKET_start_sub_packet_u16(pkt)
^
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:205:1: Parameter `pkt->written`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/t1_lib.c:1061:21: Call
1059. || !WPACKET_start_sub_packet_u16(pkt)
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
^
1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
ssl/packet.c:205:1: Parameter `pkt->written`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/t1_lib.c:1062:21: Call
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
^
1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
1064. strlen(s->tlsext_hostname))
ssl/packet.c:242:1: Parameter `pkt->written`
240. }
241.
242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
243. {
244. unsigned char *data;
ssl/t1_lib.c:1063:21: Call
1061. || !WPACKET_start_sub_packet_u16(pkt)
1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
^
1064. strlen(s->tlsext_hostname))
1065. || !WPACKET_close(pkt)
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->buf->length`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/packet.c:302:17: Call
300. {
301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
302. || !WPACKET_memcpy(pkt, src, len)
^
303. || !WPACKET_close(pkt))
304. return 0;
ssl/packet.c:283:1: Parameter `pkt->written`
281. }
282.
283. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
284. {
285. unsigned char *dest;
ssl/packet.c:290:10: Call
288. return 1;
289.
290. if (!WPACKET_allocate_bytes(pkt, len, &dest))
^
291. return 0;
292.
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 21]):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/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25 |
d2a_code_trace_data_45322 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/dh/dh_key.c:149: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`.
Showing all 24 steps of the trace
crypto/dh/dh_key.c:149:10: Call
147. if (dh->flags & DH_FLAG_CACHE_MONT_P)
148. {
149. mont = BN_MONT_CTX_set_locked(&dh->method_mont_p,
^
150. CRYPTO_LOCK_DH, dh->p, ctx);
151. if (!mont)
crypto/bn/bn_mont.c:478:1: Parameter `ctx->stack.depth`
476. }
477.
478. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
479. const BIGNUM *mod, BN_CTX *ctx)
480. {
crypto/bn/bn_mont.c:494:16: Call
492. {
493. ret = BN_MONT_CTX_new();
494. if (ret && !BN_MONT_CTX_set(ret, mod, ctx))
^
495. BN_MONT_CTX_free(ret);
496. else
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_locked`
351. static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
^
354. }
355.
| https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353 |
d2a_code_trace_data_45323 | static in_addr_t *
ngx_resolver_rotate(ngx_resolver_t *r, in_addr_t *src, ngx_uint_t n)
{
void *dst, *p;
ngx_uint_t j;
dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t));
j = ngx_random() % n;
if (j == 0) {
ngx_memcpy(dst, src, n * sizeof(in_addr_t));
return dst;
}
p = ngx_cpymem(dst, &src[j], (n - j) * sizeof(in_addr_t));
ngx_memcpy(p, src, j * sizeof(in_addr_t));
return dst;
}
src/core/ngx_resolver.c:2150: error: Null Dereference
pointer `dst` last assigned on line 2145 could be null and is dereferenced by call to `memcpy()` at line 2150, column 9.
src/core/ngx_resolver.c:2139:1: start of procedure ngx_resolver_rotate()
2137.
2138.
2139. static in_addr_t *
^
2140. ngx_resolver_rotate(ngx_resolver_t *r, in_addr_t *src, ngx_uint_t n)
2141. {
src/core/ngx_resolver.c:2145:5:
2143. ngx_uint_t j;
2144.
2145. dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t));
^
2146.
2147. j = ngx_random() % n;
src/core/ngx_resolver.c:2074:1: start of procedure ngx_resolver_alloc()
2072.
2073.
2074. static void *
^
2075. ngx_resolver_alloc(ngx_resolver_t *r, size_t size)
2076. {
src/core/ngx_resolver.c:2081:5:
2079. /* lock alloc mutex */
2080.
2081. p = ngx_alloc(size, r->log);
^
2082.
2083. /* unlock alloc mutex */
src/os/unix/ngx_alloc.c:17:1: start of procedure ngx_alloc()
15.
16.
17. void *
^
18. ngx_alloc(size_t size, ngx_log_t *log)
19. {
src/os/unix/ngx_alloc.c:22:5:
20. void *p;
21.
22. p = malloc(size);
^
23. if (p == NULL) {
24. ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
src/os/unix/ngx_alloc.c:23:9: Taking true branch
21.
22. p = malloc(size);
23. if (p == NULL) {
^
24. ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
25. "malloc(%uz) failed", size);
src/os/unix/ngx_alloc.c:24:9: Taking true branch
22. p = malloc(size);
23. if (p == NULL) {
24. ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
^
25. "malloc(%uz) failed", size);
26. }
src/os/unix/ngx_alloc.c:30:5:
28. ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);
29.
30. return p;
^
31. }
32.
src/os/unix/ngx_alloc.c:31:1: return from a call to ngx_alloc
29.
30. return p;
31. }
^
32.
33.
src/core/ngx_resolver.c:2085:5:
2083. /* unlock alloc mutex */
2084.
2085. return p;
^
2086. }
2087.
src/core/ngx_resolver.c:2086:1: return from a call to ngx_resolver_alloc
2084.
2085. return p;
2086. }
^
2087.
2088.
src/core/ngx_resolver.c:2147:5:
2145. dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t));
2146.
2147. j = ngx_random() % n;
^
2148.
2149. if (j == 0) {
src/core/ngx_resolver.c:2149:9: Taking true branch
2147. j = ngx_random() % n;
2148.
2149. if (j == 0) {
^
2150. ngx_memcpy(dst, src, n * sizeof(in_addr_t));
2151. return dst;
src/core/ngx_resolver.c:2150:9:
2148.
2149. if (j == 0) {
2150. ngx_memcpy(dst, src, n * sizeof(in_addr_t));
^
2151. return dst;
2152. }
| https://github.com/nginx/nginx/blob/74ad4494a66d7ea5201c37f6628707404df723fe/src/core/ngx_resolver.c/#L2150 |
d2a_code_trace_data_45324 | static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
int frame_size)
{
AVCodecContext *enc;
int frame_number;
double ti1, bitrate, avg_bitrate;
if (!vstats_file) {
vstats_file = fopen(vstats_filename, "w");
if (!vstats_file) {
perror("fopen");
ffmpeg_exit(1);
}
}
enc = ost->st->codec;
if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
frame_number = ost->frame_number;
fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
if (enc->flags&CODEC_FLAG_PSNR)
fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
fprintf(vstats_file,"f_size= %6d ", frame_size);
ti1 = ost->sync_opts * av_q2d(enc->time_base);
if (ti1 < 0.01)
ti1 = 0.01;
bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0;
avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0;
fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
(double)video_size / 1024, ti1, bitrate, avg_bitrate);
fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type));
}
}
ffmpeg.c:1272: error: Null Dereference
pointer `vstats_file` last assigned on line 1262 could be null and is dereferenced by call to `fprintf()` at line 1272, column 9.
ffmpeg.c:1253:1: start of procedure do_video_stats()
1251. }
1252.
1253. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
^
1254. int frame_size)
1255. {
ffmpeg.c:1261:10: Taking true branch
1259.
1260. /* this is executed just the first time do_video_stats is called */
1261. if (!vstats_file) {
^
1262. vstats_file = fopen(vstats_filename, "w");
1263. if (!vstats_file) {
ffmpeg.c:1262:9:
1260. /* this is executed just the first time do_video_stats is called */
1261. if (!vstats_file) {
1262. vstats_file = fopen(vstats_filename, "w");
^
1263. if (!vstats_file) {
1264. perror("fopen");
ffmpeg.c:1263:14: Taking true branch
1261. if (!vstats_file) {
1262. vstats_file = fopen(vstats_filename, "w");
1263. if (!vstats_file) {
^
1264. perror("fopen");
1265. ffmpeg_exit(1);
ffmpeg.c:1264:13:
1262. vstats_file = fopen(vstats_filename, "w");
1263. if (!vstats_file) {
1264. perror("fopen");
^
1265. ffmpeg_exit(1);
1266. }
ffmpeg.c:1265:13: Skipping ffmpeg_exit(): empty list of specs
1263. if (!vstats_file) {
1264. perror("fopen");
1265. ffmpeg_exit(1);
^
1266. }
1267. }
ffmpeg.c:1269:5:
1267. }
1268.
1269. enc = ost->st->codec;
^
1270. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1271. frame_number = ost->frame_number;
ffmpeg.c:1270:9: Taking true branch
1268.
1269. enc = ost->st->codec;
1270. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
^
1271. frame_number = ost->frame_number;
1272. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
ffmpeg.c:1271:9:
1269. enc = ost->st->codec;
1270. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1271. frame_number = ost->frame_number;
^
1272. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
1273. if (enc->flags&CODEC_FLAG_PSNR)
ffmpeg.c:1272:9:
1270. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1271. frame_number = ost->frame_number;
1272. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
^
1273. if (enc->flags&CODEC_FLAG_PSNR)
1274. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
| https://github.com/libav/libav/blob/771339ca206468636a64a6041852068be2da3dd2/ffmpeg.c/#L1272 |
d2a_code_trace_data_45325 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:811: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`.
Showing all 27 steps of the trace
test/bntest.c:785:1: Parameter `ctx->stack.depth`
783. }
784.
785. > int test_mont(BIO *bp, BN_CTX *ctx)
786. {
787. BIGNUM *a, *b, *c, *d, *A, *B;
test/bntest.c:805:9: Call
803.
804. BN_zero(n);
805. if (BN_MONT_CTX_set(mont, n, ctx)) {
^
806. fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n");
807. return 0;
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;
test/bntest.c:811:9: Call
809.
810. BN_set_word(n, 16);
811. if (BN_MONT_CTX_set(mont, n, ctx)) {
^
812. fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n");
813. return 0;
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`
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_45326 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/sm2/sm2_sign.c:202: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add`.
Showing all 20 steps of the trace
crypto/sm2/sm2_sign.c:174:9: Call
172. BN_CTX_start(ctx);
173.
174. t = BN_CTX_get(ctx);
^
175. x1 = BN_CTX_get(ctx);
176.
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:364:15: Assignment
362. a->neg = 0;
363. a->d[0] = w;
364. a->top = (w ? 1 : 0);
^
365. bn_check_top(a);
366. return 1;
crypto/bn/bn_lib.c:364:5: Assignment
362. a->neg = 0;
363. a->d[0] = w;
364. a->top = (w ? 1 : 0);
^
365. bn_check_top(a);
366. return 1;
crypto/sm2/sm2_sign.c:202:9: Call
200. goto done;
201.
202. if (BN_mod_add(t, r, s, order, ctx) == 0)
^
203. goto done;
204.
crypto/bn/bn_mod.c:28:1: Parameter `*r->d`
26. }
27.
28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
29. BN_CTX *ctx)
30. {
crypto/bn/bn_mod.c:31:10: Call
29. BN_CTX *ctx)
30. {
31. if (!BN_add(r, a, b))
^
32. return 0;
33. return BN_nnmod(r, r, m, ctx);
crypto/bn/bn_add.c:14:1: Parameter `*r->d`
12.
13. /* r can == a or b */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int a_neg = a->neg, ret;
crypto/bn/bn_add.c:40:18: Call
38.
39. if (BN_ucmp(a, b) < 0) {
40. if (!BN_usub(r, b, a))
^
41. return 0;
42. r->neg = 1;
crypto/bn/bn_add.c:107:1: Parameter `*r->d`
105.
106. /* unsigned subtraction of b from a, a must be larger than b. */
107. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
108. {
109. int max, min, dif;
crypto/bn/bn_add.c:125:9: Call
123. }
124.
125. if (bn_wexpand(r, max) == NULL)
^
126. return 0;
127.
crypto/bn/bn_lib.c:910:1: Parameter `*a->d`
908. }
909.
910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:912:37: Call
910. BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
913. }
914.
crypto/bn/bn_lib.c:246:1: Parameter `*b->d`
244. */
245.
246. > BIGNUM *bn_expand2(BIGNUM *b, int words)
247. {
248. bn_check_top(b);
crypto/bn/bn_lib.c:251:23: Call
249.
250. if (words > b->dmax) {
251. BN_ULONG *a = bn_expand_internal(b, words);
^
252. if (!a)
253. return NULL;
crypto/bn/bn_lib.c:208:1: <Offset trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `b->top`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: <Length trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `*b->d`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add`
231. assert(b->top <= words);
232. if (b->top > 0)
233. memcpy(a, b->d, sizeof(*a) * b->top);
^
234.
235. return a;
| https://github.com/openssl/openssl/blob/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_lib.c/#L233 |
d2a_code_trace_data_45327 | uint32
TIFFNumberOfStrips(TIFF* tif)
{
TIFFDirectory *td = &tif->tif_dir;
uint32 nstrips;
nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
nstrips = multiply_32(tif, nstrips, (uint32)td->td_samplesperpixel,
"TIFFNumberOfStrips");
return (nstrips);
}
tools/tiff2ps.c:708: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `TIFFNumberOfStrips`.
tools/tiff2ps.c:685:1: Parameter `tif->tif_dir.td_rowsperstrip`
683.
684. /* returns the sequence number of the page processed */
685. int
^
686. TIFF2PS(FILE* fd, TIFF* tif,
687. double pw, double ph, double lm, double bm, int cnt)
tools/tiff2ps.c:708:21: Call
706. oy = 0;
707. do {
708. tf_numberstrips = TIFFNumberOfStrips(tif);
^
709. TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP,
710. &tf_rowsperstrip);
libtiff/tif_strip.c:86:1: <LHS trace>
84. * Compute how many strips are in an image.
85. */
86. uint32
^
87. TIFFNumberOfStrips(TIFF* tif)
88. {
libtiff/tif_strip.c:86:1: Parameter `tif->tif_dir.td_rowsperstrip`
84. * Compute how many strips are in an image.
85. */
86. uint32
^
87. TIFFNumberOfStrips(TIFF* tif)
88. {
libtiff/tif_strip.c:92:13: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TIFFNumberOfStrips`
90. uint32 nstrips;
91.
92. nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
^
93. TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
94. if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_strip.c/#L92 |
d2a_code_trace_data_45328 | static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a)
{
return constant_time_msb_32(~a & (a - 1));
}
crypto/ec/curve448/curve448.c:334: error: INTEGER_OVERFLOW_L2
([0, `*enc`] - 1):unsigned32 by call to `constant_time_is_zero_32`.
Showing all 5 steps of the trace
crypto/ec/curve448/curve448.c:320:1: Parameter `*enc`
318. }
319.
320. > c448_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio(
321. curve448_point_t p,
322. const uint8_t enc[EDDSA_448_PUBLIC_BYTES])
crypto/ec/curve448/curve448.c:334:13: Call
332.
333. succ = gf_deserialize(p->y, enc2, 1, 0);
334. succ &= word_is_zero(enc2[EDDSA_448_PRIVATE_BYTES - 1]);
^
335.
336. gf_sqr(p->x, p->y);
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, *enc] - 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_45329 | 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/pem/pem_lib.c:436: error: INTEGER_OVERFLOW_L2
(0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`.
Showing all 8 steps of the trace
crypto/pem/pem_lib.c:392:1: Parameter `cipher->cipher->block_size`
390. }
391.
392. > int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
393. pem_password_cb *callback, void *u)
394. {
crypto/pem/pem_lib.c:436:14: Call
434. ok = EVP_DecryptInit_ex(ctx, cipher->cipher, NULL, key, &(cipher->iv[0]));
435. if (ok)
436. ok = EVP_DecryptUpdate(ctx, data, &ilen, data, ilen);
^
437. if (ok) {
438. /* Squirrel away the length of data decrypted so far. */
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_DecryptUpdate`
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_45330 | static ossl_inline void constant_time_lookup(void *RESTRICT out_,
const void *table_,
word_t elem_bytes,
word_t n_table,
word_t idx)
{
big_register_t big_one = br_set_to_mask(1), big_i = br_set_to_mask(idx);
unsigned char *out = (unsigned char *)out_;
const unsigned char *table = (const unsigned char *)table_;
word_t j, k;
# ifndef HAS_UNALIGNED_STRUCTS
unsigned char maskc;
# endif
memset(out, 0, elem_bytes);
for (j = 0; j < n_table; j++, big_i -= big_one) {
big_register_t br_mask = br_is_zero(big_i);
word_t mask;
# ifndef HAS_UNALIGNED_STRUCTS
maskc = (unsigned char)br_mask;
# endif
for (k = 0; k <= elem_bytes - sizeof(big_register_t);
k += sizeof(big_register_t)) {
if (elem_bytes % sizeof(big_register_t)) {
# ifdef HAS_UNALIGNED_STRUCTS
((unaligned_br_t *)(out + k))->unaligned |=
br_mask
& ((const unaligned_br_t *)
(&table[k + j * elem_bytes]))->unaligned;
# else
size_t i;
for (i = 0; i < sizeof(big_register_t); i++)
out[k + i] |= maskc
& ((unsigned char *) table)
[k + (j * elem_bytes) + i];
# endif
} else {
*(big_register_t *)(out + k) |=
br_mask
& *(const big_register_t *)(&table[k + j * elem_bytes]);
}
}
mask = word_is_zero(idx ^ j);
# ifndef HAS_UNALIGNED_STRUCTS
maskc = (unsigned char)mask;
# endif
if (elem_bytes % sizeof(big_register_t) >= sizeof(word_t)) {
for (; k <= elem_bytes - sizeof(word_t); k += sizeof(word_t)) {
if (elem_bytes % sizeof(word_t)) {
# ifdef HAS_UNALIGNED_STRUCTS
*(word_t *)(out + k) |=
mask
& ((const unaligned_word_t *)
(&table[k + j * elem_bytes]))->unaligned;
# else
size_t i;
for (i = 0; i < sizeof(word_t); i++)
out[k + i] |= maskc
& ((unsigned char *)table)
[k + (j * elem_bytes) + i];
# endif
} else {
*(word_t *)(out + k) |=
mask
& *(const word_t *)(&table[k + j * elem_bytes]);
}
}
}
if (elem_bytes % sizeof(word_t)) {
for (; k < elem_bytes; k += 1) {
out[k] |= mask & table[k + j * elem_bytes];
}
}
}
}
crypto/ec/curve448/constant_time.h:182: error: INTEGER_OVERFLOW_L2
([0, `idx`] - 1):unsigned64 by call to `word_is_zero`.
Showing all 9 steps of the trace
crypto/ec/curve448/constant_time.h:164:1: Parameter `idx`
162. * The table and output must not alias.
163. */
164. > static ossl_inline void constant_time_lookup(void *RESTRICT out_,
165. const void *table_,
166. word_t elem_bytes,
crypto/ec/curve448/constant_time.h:170:57: Call
168. word_t idx)
169. {
170. big_register_t big_one = br_set_to_mask(1), big_i = br_set_to_mask(idx);
^
171.
172. /* Can't do pointer arithmetic on void * */
crypto/ec/curve448/word.h:152:1: Parameter `x`
150. typedef uint32_t big_register_t;
151.
152. > static ossl_inline big_register_t br_set_to_mask(mask_t x)
153. {
154. return (big_register_t) x;
crypto/ec/curve448/word.h:154:5: Assignment
152. static ossl_inline big_register_t br_set_to_mask(mask_t x)
153. {
154. return (big_register_t) x;
^
155. }
156. # endif
crypto/ec/curve448/constant_time.h:170:5: Assignment
168. word_t idx)
169. {
170. big_register_t big_one = br_set_to_mask(1), big_i = br_set_to_mask(idx);
^
171.
172. /* Can't do pointer arithmetic on void * */
crypto/ec/curve448/constant_time.h:182:34: Call
180. memset(out, 0, elem_bytes);
181. for (j = 0; j < n_table; j++, big_i -= big_one) {
182. big_register_t br_mask = br_is_zero(big_i);
^
183. word_t mask;
184.
crypto/ec/curve448/arch_32/arch_intrinsics.h:18:1: <LHS trace>
16. # define ARCH_WORD_BITS 32
17.
18. > static ossl_inline uint32_t word_is_zero(uint32_t a)
19. {
20. /* let's hope the compiler isn't clever enough to optimize this. */
crypto/ec/curve448/arch_32/arch_intrinsics.h:18:1: Parameter `a`
16. # define ARCH_WORD_BITS 32
17.
18. > static ossl_inline uint32_t word_is_zero(uint32_t a)
19. {
20. /* let's hope the compiler isn't clever enough to optimize this. */
crypto/ec/curve448/arch_32/arch_intrinsics.h:21:5: Binary operation: ([0, idx] - 1):unsigned64 by call to `word_is_zero`
19. {
20. /* let's hope the compiler isn't clever enough to optimize this. */
21. return (((uint64_t)a) - 1) >> 32;
^
22. }
23.
| https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/constant_time.h/#L182 |
d2a_code_trace_data_45331 | static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
{
int err_printed = 0;
while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) {
if (ac->output_configured < OC_LOCKED && !err_printed) {
av_log(ac->avccontext, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n");
err_printed = 1;
}
elem_id++;
}
if (elem_id == MAX_ELEM_ID)
return NULL;
ac->tags_seen_this_frame[type][elem_id] = 1;
if (ac->tag_che_map[type][elem_id]) {
return ac->tag_che_map[type][elem_id];
}
if (ac->tags_mapped >= tags_per_config[ac->m4ac.chan_config]) {
return NULL;
}
switch (ac->m4ac.chan_config) {
case 7:
if (ac->tags_mapped == 3 && type == TYPE_CPE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
}
case 6:
if (ac->tags_mapped == tags_per_config[ac->m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
ac->tags_mapped++;
return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
}
case 5:
if (ac->tags_mapped == 2 && type == TYPE_CPE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
}
case 4:
if (ac->tags_mapped == 2 && ac->m4ac.chan_config == 4 && type == TYPE_SCE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
}
case 3:
case 2:
if (ac->tags_mapped == (ac->m4ac.chan_config != 2) && type == TYPE_CPE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
} else if (ac->m4ac.chan_config == 2) {
return NULL;
}
case 1:
if (!ac->tags_mapped && type == TYPE_SCE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0];
}
default:
return NULL;
}
}
libavcodec/aac.c:142: error: Buffer Overrun L2
Offset: [`elem_id`, max(16, `elem_id`)] Size: 16.
libavcodec/aac.c:114:1: <Offset trace>
112. static const char overread_err[] = "Input buffer exhausted before END element found\n";
113.
114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
^
115. {
116. /* Some buggy encoders appear to set all elem_ids to zero and rely on
libavcodec/aac.c:114:1: Parameter `elem_id`
112. static const char overread_err[] = "Input buffer exhausted before END element found\n";
113.
114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
^
115. {
116. /* Some buggy encoders appear to set all elem_ids to zero and rely on
libavcodec/aac.c:114:1: <Length trace>
112. static const char overread_err[] = "Input buffer exhausted before END element found\n";
113.
114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
^
115. {
116. /* Some buggy encoders appear to set all elem_ids to zero and rely on
libavcodec/aac.c:114:1: Parameter `ac->tag_che_map[*][*]`
112. static const char overread_err[] = "Input buffer exhausted before END element found\n";
113.
114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
^
115. {
116. /* Some buggy encoders appear to set all elem_ids to zero and rely on
libavcodec/aac.c:142:20: Array access: Offset: [elem_id, max(16, elem_id)] Size: 16
140. if (ac->tags_mapped == 3 && type == TYPE_CPE) {
141. ac->tags_mapped++;
142. return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
^
143. }
144. case 6:
| https://github.com/libav/libav/blob/76561924cf3d9789653dc72d696f119862616891/libavcodec/aac.c/#L142 |
d2a_code_trace_data_45332 | static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)
{
const char *servername;
const unsigned char *p;
size_t len, remaining;
HANDSHAKE_EX_DATA *ex_data =
(HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
&remaining) ||
remaining <= 2)
return 0;
len = (*(p++) << 8);
len += *(p++);
if (len + 2 != remaining)
return 0;
remaining = len;
if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
return 0;
remaining--;
if (remaining <= 2)
return 0;
len = (*(p++) << 8);
len += *(p++);
if (len + 2 > remaining)
return 0;
remaining = len;
servername = (const char *)p;
if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
SSL_CTX *new_ctx = arg;
SSL_set_SSL_CTX(s, new_ctx);
SSL_clear_options(s, 0xFFFFFFFFL);
SSL_set_options(s, SSL_CTX_get_options(new_ctx));
ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
return 1;
} else if (len == strlen("server1") &&
strncmp(servername, "server1", len) == 0) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return 1;
} else if (ignore) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return 1;
}
return 0;
}
test/handshake_helper.c:199: error: NULL_DEREFERENCE
pointer `ex_data` last assigned on line 147 could be null and is dereferenced at line 199, column 9.
Showing all 28 steps of the trace
test/handshake_helper.c:142:1: start of procedure client_hello_select_server_ctx()
140. }
141.
142. > static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)
143. {
144. const char *servername;
test/handshake_helper.c:147:5:
145. const unsigned char *p;
146. size_t len, remaining;
147. > HANDSHAKE_EX_DATA *ex_data =
148. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
149.
ssl/ssl_lib.c:4014:1: start of procedure SSL_get_ex_data()
4012. }
4013.
4014. > void *SSL_get_ex_data(const SSL *s, int idx)
4015. {
4016. return CRYPTO_get_ex_data(&s->ex_data, idx);
ssl/ssl_lib.c:4016:5:
4014. void *SSL_get_ex_data(const SSL *s, int idx)
4015. {
4016. > return CRYPTO_get_ex_data(&s->ex_data, idx);
4017. }
4018.
crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data()
391. * particular index in the class used by this variable
392. */
393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
394. {
395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:395:9: Taking true branch
393. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
394. {
395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
396. return NULL;
397. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:396:9:
394. {
395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
396. > return NULL;
397. return sk_void_value(ad->sk, idx);
398. }
crypto/ex_data.c:398:1: return from a call to CRYPTO_get_ex_data
396. return NULL;
397. return sk_void_value(ad->sk, idx);
398. > }
ssl/ssl_lib.c:4017:1: return from a call to SSL_get_ex_data
4015. {
4016. return CRYPTO_get_ex_data(&s->ex_data, idx);
4017. > }
4018.
4019. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
test/handshake_helper.c:154:10: Taking false branch
152. * was written, so parsing the normal case is a bit complex.
153. */
154. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
^
155. &remaining) ||
156. remaining <= 2)
test/handshake_helper.c:156:9: Taking false branch
154. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
155. &remaining) ||
156. remaining <= 2)
^
157. return 0;
158. /* Extract the length of the supplied list of names. */
test/handshake_helper.c:159:5:
157. return 0;
158. /* Extract the length of the supplied list of names. */
159. > len = (*(p++) << 8);
160. len += *(p++);
161. if (len + 2 != remaining)
test/handshake_helper.c:160:5:
158. /* Extract the length of the supplied list of names. */
159. len = (*(p++) << 8);
160. > len += *(p++);
161. if (len + 2 != remaining)
162. return 0;
test/handshake_helper.c:161:9: Taking false branch
159. len = (*(p++) << 8);
160. len += *(p++);
161. if (len + 2 != remaining)
^
162. return 0;
163. remaining = len;
test/handshake_helper.c:163:5:
161. if (len + 2 != remaining)
162. return 0;
163. > remaining = len;
164. /*
165. * The list in practice only has a single element, so we only consider
test/handshake_helper.c:168:9: Taking false branch
166. * the first one.
167. */
168. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
^
169. return 0;
170. remaining--;
test/handshake_helper.c:168:27: Taking false branch
166. * the first one.
167. */
168. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
^
169. return 0;
170. remaining--;
test/handshake_helper.c:170:5:
168. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
169. return 0;
170. > remaining--;
171. /* Now we can finally pull out the byte array with the actual hostname. */
172. if (remaining <= 2)
test/handshake_helper.c:172:9: Taking false branch
170. remaining--;
171. /* Now we can finally pull out the byte array with the actual hostname. */
172. if (remaining <= 2)
^
173. return 0;
174. len = (*(p++) << 8);
test/handshake_helper.c:174:5:
172. if (remaining <= 2)
173. return 0;
174. > len = (*(p++) << 8);
175. len += *(p++);
176. if (len + 2 > remaining)
test/handshake_helper.c:175:5:
173. return 0;
174. len = (*(p++) << 8);
175. > len += *(p++);
176. if (len + 2 > remaining)
177. return 0;
test/handshake_helper.c:176:9: Taking false branch
174. len = (*(p++) << 8);
175. len += *(p++);
176. if (len + 2 > remaining)
^
177. return 0;
178. remaining = len;
test/handshake_helper.c:178:5:
176. if (len + 2 > remaining)
177. return 0;
178. > remaining = len;
179. servername = (const char *)p;
180.
test/handshake_helper.c:179:5:
177. return 0;
178. remaining = len;
179. > servername = (const char *)p;
180.
181. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
test/handshake_helper.c:181:9: Taking false branch
179. servername = (const char *)p;
180.
181. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
^
182. SSL_CTX *new_ctx = arg;
183. SSL_set_SSL_CTX(s, new_ctx);
test/handshake_helper.c:194:16: Taking false branch
192. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
193. return 1;
194. } else if (len == strlen("server1") &&
^
195. strncmp(servername, "server1", len) == 0) {
196. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
test/handshake_helper.c:198:16: Taking true branch
196. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
197. return 1;
198. } else if (ignore) {
^
199. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
200. return 1;
test/handshake_helper.c:199:9:
197. return 1;
198. } else if (ignore) {
199. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
200. return 1;
201. }
| https://github.com/openssl/openssl/blob/e43e6b1951de931ca500c6964496e76651332f5e/test/handshake_helper.c/#L199 |
d2a_code_trace_data_45333 | 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/mpc8.c:266: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `mpc8_get_mod_golomb`.
libavcodec/mpc8.c:263:5: Call
261. }
262. bitstream_init(bc, buf, buf_size * 8);
263. bitstream_skip(bc, c->last_bits_used & 7);
^
264.
265. if(keyframe)
libavcodec/bitstream.h:241:1: Parameter `n`
239.
240. /* Skip n bits in the buffer. */
241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
^
242. {
243. if (n <= bc->bits_left)
libavcodec/bitstream.h:244:9: Call
242. {
243. if (n <= bc->bits_left)
244. skip_remaining(bc, n);
^
245. else {
246. n -= bc->bits_left;
libavcodec/bitstream.h:230:1: Parameter `n`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:237:5: Assignment
235. bc->bits <<= n;
236. #endif
237. bc->bits_left -= n;
^
238. }
239.
libavcodec/mpc8.c:266:19: Call
264.
265. if(keyframe)
266. maxband = mpc8_get_mod_golomb(bc, c->maxbands + 1);
^
267. else{
268. maxband = c->last_max_band + bitstream_read_vlc(bc, band_vlc.table, MPC8_BANDS_BITS, 2);
libavcodec/mpc8.c:76:1: Parameter `bc->bits_left`
74. }
75.
76. static inline int mpc8_get_mod_golomb(BitstreamContext *bc, int m)
^
77. {
78. if(mpc8_cnk_len[0][m] < 1) return 0;
libavcodec/mpc8.c:79:12: Call
77. {
78. if(mpc8_cnk_len[0][m] < 1) return 0;
79. return mpc8_dec_base(bc, 1, m + 1);
^
80. }
81.
libavcodec/mpc8.c:46:1: Parameter `bc->bits_left`
44. static const int quant_offsets[6] = { MPC8_Q5_OFFSET, MPC8_Q6_OFFSET, MPC8_Q7_OFFSET, MPC8_Q8_OFFSET };
45.
46. static inline int mpc8_dec_base(BitstreamContext *bc, int k, int n)
^
47. {
48. int len = mpc8_cnk_len[k-1][n-1] - 1;
libavcodec/mpc8.c:52:31: Call
50.
51. if (code >= mpc8_cnk_lost[k-1][n-1])
52. code = ((code << 1) | bitstream_read_bit(bc)) - mpc8_cnk_lost[k - 1][n - 1];
^
53.
54. return code;
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 `mpc8_get_mod_golomb`
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_45334 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_gf2m.c:1018: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqr_arr`.
Showing all 13 steps of the trace
crypto/bn/bn_gf2m.c:983:1: Parameter `ctx->stack.depth`
981. * 0. Uses algorithms A.4.7 and A.4.6 from IEEE P1363.
982. */
983. > int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[],
984. BN_CTX *ctx)
985. {
crypto/bn/bn_gf2m.c:997:5: Call
995. }
996.
997. BN_CTX_start(ctx);
^
998. a = BN_CTX_get(ctx);
999. z = 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_gf2m.c:1018:18: Call
1016. goto err;
1017. for (j = 1; j <= (p[0] - 1) / 2; j++) {
1018. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
^
1019. goto err;
1020. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
crypto/bn/bn_gf2m.c:489:1: Parameter `ctx->stack.depth`
487.
488. /* Square a, reduce the result mod p, and store it in a. r could be a. */
489. > int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
490. BN_CTX *ctx)
491. {
crypto/bn/bn_gf2m.c:496:5: Call
494.
495. bn_check_top(a);
496. BN_CTX_start(ctx);
^
497. if ((s = BN_CTX_get(ctx)) == NULL)
498. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gf2m.c:514:5: Call
512. ret = 1;
513. err:
514. BN_CTX_end(ctx);
^
515. return ret;
516. }
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:274:1: <LHS trace>
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:274:1: Parameter `st->depth`
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqr_arr`
274. static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
^
277. }
278.
| https://github.com/openssl/openssl/blob/f3021aca4a154c2ff9bd0030f7974eb6a719550d/crypto/bn/bn_ctx.c/#L276 |
d2a_code_trace_data_45335 | int BN_set_word(BIGNUM *a, BN_ULONG w)
{
bn_check_top(a);
if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
return (0);
a->neg = 0;
a->d[0] = w;
a->top = (w ? 1 : 0);
bn_check_top(a);
return (1);
}
crypto/dh/dh_check.c:165: error: BUFFER_OVERRUN_L3
Offset: 0 Size: [0, 8388607] by call to `BN_mod_exp`.
Showing all 11 steps of the trace
crypto/dh/dh_check.c:153:11: Call
151. goto err;
152. BN_CTX_start(ctx);
153. tmp = BN_CTX_get(ctx);
^
154. if (tmp == NULL || !BN_set_word(tmp, 1))
155. goto err;
crypto/bn/bn_ctx.c:283:5: Call
281. }
282. /* OK, make sure the returned bignum is "zero" */
283. BN_zero(ret);
^
284. ctx->used++;
285. CTXDBG_RET(ctx, ret);
crypto/bn/bn_lib.c:520:1: Parameter `*a->d`
518. }
519.
520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
521. {
522. bn_check_top(a);
crypto/dh/dh_check.c:165:14: Call
163. if (dh->q != NULL) {
164. /* Check pub_key^q == 1 mod p */
165. if (!BN_mod_exp(tmp, pub_key, dh->q, dh->p, ctx))
^
166. goto err;
167. if (!BN_is_one(tmp))
crypto/bn/bn_exp.c:190:1: Parameter `*r->d`
188. }
189.
190. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
191. BN_CTX *ctx)
192. {
crypto/bn/bn_exp.c:247:19: Call
245. && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) {
246. BN_ULONG A = a->d[0];
247. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
^
248. } else
249. # endif
crypto/bn/bn_exp.c:1151:1: Parameter `*rr->d`
1149. }
1150.
1151. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
1152. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
1153. {
crypto/bn/bn_exp.c:1198:13: Call
1196. if (BN_is_one(m)) {
1197. ret = 1;
1198. BN_zero(rr);
^
1199. } else {
1200. ret = BN_one(rr);
crypto/bn/bn_lib.c:520:1: <Length trace>
518. }
519.
520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
521. {
522. bn_check_top(a);
crypto/bn/bn_lib.c:520:1: Parameter `*a->d`
518. }
519.
520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
521. {
522. bn_check_top(a);
crypto/bn/bn_lib.c:526:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_mod_exp`
524. return (0);
525. a->neg = 0;
526. a->d[0] = w;
^
527. a->top = (w ? 1 : 0);
528. bn_check_top(a);
| https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_lib.c/#L526 |
d2a_code_trace_data_45336 | static rgbConvFn findRgbConvFn(SwsContext *c)
{
const enum AVPixelFormat srcFormat = c->srcFormat;
const enum AVPixelFormat dstFormat = c->dstFormat;
const int srcId = c->srcFormatBpp;
const int dstId = c->dstFormatBpp;
rgbConvFn conv = NULL;
const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
#define IS_NOT_NE(bpp, desc) \
(((bpp + 7) >> 3) == 2 && \
(!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN))
if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst))
return NULL;
#define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst)
if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) {
if ( CONV_IS(ABGR, RGBA)
|| CONV_IS(ARGB, BGRA)
|| CONV_IS(BGRA, ARGB)
|| CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210;
else if (CONV_IS(ABGR, ARGB)
|| CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321;
else if (CONV_IS(ABGR, BGRA)
|| CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230;
else if (CONV_IS(BGRA, RGBA)
|| CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;
else if (CONV_IS(BGRA, ABGR)
|| CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;
} else
if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
switch (srcId | (dstId << 16)) {
case 0x000F000C: conv = rgb12to15; break;
case 0x000F0010: conv = rgb16to15; break;
case 0x000F0018: conv = rgb24to15; break;
case 0x000F0020: conv = rgb32to15; break;
case 0x0010000F: conv = rgb15to16; break;
case 0x00100018: conv = rgb24to16; break;
case 0x00100020: conv = rgb32to16; break;
case 0x0018000F: conv = rgb15to24; break;
case 0x00180010: conv = rgb16to24; break;
case 0x00180020: conv = rgb32to24; break;
case 0x0020000F: conv = rgb15to32; break;
case 0x00200010: conv = rgb16to32; break;
case 0x00200018: conv = rgb24to32; break;
}
} else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
switch (srcId | (dstId << 16)) {
case 0x000C000C: conv = rgb12tobgr12; break;
case 0x000F000F: conv = rgb15tobgr15; break;
case 0x000F0010: conv = rgb16tobgr15; break;
case 0x000F0018: conv = rgb24tobgr15; break;
case 0x000F0020: conv = rgb32tobgr15; break;
case 0x0010000F: conv = rgb15tobgr16; break;
case 0x00100010: conv = rgb16tobgr16; break;
case 0x00100018: conv = rgb24tobgr16; break;
case 0x00100020: conv = rgb32tobgr16; break;
case 0x0018000F: conv = rgb15tobgr24; break;
case 0x00180010: conv = rgb16tobgr24; break;
case 0x00180018: conv = rgb24tobgr24; break;
case 0x00180020: conv = rgb32tobgr24; break;
case 0x0020000F: conv = rgb15tobgr32; break;
case 0x00200010: conv = rgb16tobgr32; break;
case 0x00200018: conv = rgb24tobgr32; break;
}
}
return conv;
}
libswscale/swscale_unscaled.c:568: error: Null Dereference
pointer `desc_dst` last assigned on line 561 could be null and is dereferenced at line 568, column 39.
libswscale/swscale_unscaled.c:553:1: start of procedure findRgbConvFn()
551. /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
552. typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);
553. static rgbConvFn findRgbConvFn(SwsContext *c)
^
554. {
555. const enum AVPixelFormat srcFormat = c->srcFormat;
libswscale/swscale_unscaled.c:555:5:
553. static rgbConvFn findRgbConvFn(SwsContext *c)
554. {
555. const enum AVPixelFormat srcFormat = c->srcFormat;
^
556. const enum AVPixelFormat dstFormat = c->dstFormat;
557. const int srcId = c->srcFormatBpp;
libswscale/swscale_unscaled.c:556:5:
554. {
555. const enum AVPixelFormat srcFormat = c->srcFormat;
556. const enum AVPixelFormat dstFormat = c->dstFormat;
^
557. const int srcId = c->srcFormatBpp;
558. const int dstId = c->dstFormatBpp;
libswscale/swscale_unscaled.c:557:5:
555. const enum AVPixelFormat srcFormat = c->srcFormat;
556. const enum AVPixelFormat dstFormat = c->dstFormat;
557. const int srcId = c->srcFormatBpp;
^
558. const int dstId = c->dstFormatBpp;
559. rgbConvFn conv = NULL;
libswscale/swscale_unscaled.c:558:5:
556. const enum AVPixelFormat dstFormat = c->dstFormat;
557. const int srcId = c->srcFormatBpp;
558. const int dstId = c->dstFormatBpp;
^
559. rgbConvFn conv = NULL;
560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
libswscale/swscale_unscaled.c:559:5:
557. const int srcId = c->srcFormatBpp;
558. const int dstId = c->dstFormatBpp;
559. rgbConvFn conv = NULL;
^
560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
561. const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
libswscale/swscale_unscaled.c:560:5:
558. const int dstId = c->dstFormatBpp;
559. rgbConvFn conv = NULL;
560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
^
561. const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
562.
libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get()
1466. }
1467.
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1470:9: Taking false branch
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1470:24: Taking false branch
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1472:5:
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
^
1473. }
1474.
libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
1473. }
^
1474.
1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libswscale/swscale_unscaled.c:561:5:
559. rgbConvFn conv = NULL;
560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
561. const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
^
562.
563. #define IS_NOT_NE(bpp, desc) \
libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get()
1466. }
1467.
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1470:9: Taking false branch
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1470:24: Taking true branch
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1471:9:
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1471. return NULL;
^
1472. return &av_pix_fmt_descriptors[pix_fmt];
1473. }
libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
1473. }
^
1474.
1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libswscale/swscale_unscaled.c:568:9: Taking false branch
566.
567. /* if this is non-native rgb444/555/565, don't handle it here. */
568. if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst))
^
569. return NULL;
570.
libswscale/swscale_unscaled.c:568:39: Taking true branch
566.
567. /* if this is non-native rgb444/555/565, don't handle it here. */
568. if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst))
^
569. return NULL;
570.
| https://github.com/libav/libav/blob/0a14fefd68cc18ce3252edff8a05ee9b3945b694/libswscale/swscale_unscaled.c/#L568 |
d2a_code_trace_data_45337 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:124: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_nnmod`.
Showing all 16 steps of the trace
crypto/ec/ecdsa_ossl.c:33:1: Parameter `ctx_in->stack.depth`
31. }
32.
33. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
34. BIGNUM **kinvp, BIGNUM **rp,
35. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:86:22: Call
84. do {
85. if (dgst != NULL) {
86. if (!BN_generate_dsa_nonce(k, order,
^
87. EC_KEY_get0_private_key(eckey),
88. dgst, dlen, ctx)) {
crypto/bn/bn_rand.c:205:1: Parameter `ctx->stack.depth`
203. * used.
204. */
205. > int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
206. const BIGNUM *priv, const unsigned char *message,
207. size_t message_len, BN_CTX *ctx)
crypto/ec/ecdsa_ossl.c:124:14: Call
122. }
123. #endif
124. if (!BN_nnmod(r, X, order, ctx)) {
^
125. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
126. goto err;
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:190:5: Call
188. }
189.
190. BN_CTX_start(ctx);
^
191. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
192. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_div.c:411:5: Call
409. if (no_branch)
410. bn_correct_top(res);
411. BN_CTX_end(ctx);
^
412. return 1;
413. err:
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:274:1: <Offset trace>
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:274:1: Parameter `st->depth`
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:274:1: <Length trace>
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:274:1: Parameter `*st->indexes`
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:276:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_nnmod`
274. static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
^
277. }
278.
| https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_ctx.c/#L276 |
d2a_code_trace_data_45338 | DECLAREcpFunc(cpContig2SeparateByRow)
{
tsize_t scanlinesizein = TIFFScanlineSize(in);
tsize_t scanlinesizeout = TIFFScanlineSize(out);
tdata_t inbuf;
tdata_t outbuf;
register uint8 *inp, *outp;
register uint32 n;
uint32 row;
tsample_t s;
inbuf = _TIFFmalloc(scanlinesizein);
outbuf = _TIFFmalloc(scanlinesizeout);
if (!inbuf || !outbuf)
return 0;
_TIFFmemset(inbuf, 0, scanlinesizein);
_TIFFmemset(outbuf, 0, scanlinesizeout);
for (s = 0; s < spp; s++) {
for (row = 0; row < imagelength; row++) {
if (TIFFReadScanline(in, inbuf, row, 0) < 0
&& !ignore) {
TIFFError(TIFFFileName(in),
"Error, can't read scanline %lu",
(unsigned long) row);
goto bad;
}
inp = ((uint8*)inbuf) + s;
outp = (uint8*)outbuf;
for (n = imagewidth; n-- > 0;) {
*outp++ = *inp;
inp += spp;
}
if (TIFFWriteScanline(out, outbuf, row, s) < 0) {
TIFFError(TIFFFileName(out),
"Error, can't write scanline %lu",
(unsigned long) row);
goto bad;
}
}
}
if (inbuf) _TIFFfree(inbuf);
if (outbuf) _TIFFfree(outbuf);
return 1;
bad:
if (inbuf) _TIFFfree(inbuf);
if (outbuf) _TIFFfree(outbuf);
return 0;
}
tools/tiffcp.c:1062: error: Memory Leak
memory dynamically allocated by call to `_TIFFmalloc()` at line 1061, column 11 is not reachable after line 1062, column 7.
tools/tiffcp.c:1049:1: start of procedure cpContig2SeparateByRow()
1047. * Contig -> separate by row.
1048. */
1049. DECLAREcpFunc(cpContig2SeparateByRow)
^
1050. {
1051. tsize_t scanlinesizein = TIFFScanlineSize(in);
tools/tiffcp.c:1051:2:
1049. DECLAREcpFunc(cpContig2SeparateByRow)
1050. {
1051. tsize_t scanlinesizein = TIFFScanlineSize(in);
^
1052. tsize_t scanlinesizeout = TIFFScanlineSize(out);
1053. tdata_t inbuf;
libtiff/tif_strip.c:321:1: start of procedure TIFFScanlineSize()
319. return(scanline_size);
320. }
321. tmsize_t
^
322. TIFFScanlineSize(TIFF* tif)
323. {
libtiff/tif_strip.c:324:2:
322. TIFFScanlineSize(TIFF* tif)
323. {
324. static const char module[] = "TIFFScanlineSize";
^
325. uint64 m;
326. tmsize_t n;
libtiff/tif_strip.c:327:2: Skipping TIFFScanlineSize64(): empty list of specs
325. uint64 m;
326. tmsize_t n;
327. m=TIFFScanlineSize64(tif);
^
328. n=(tmsize_t)m;
329. if ((uint64)n!=m)
libtiff/tif_strip.c:328:2:
326. tmsize_t n;
327. m=TIFFScanlineSize64(tif);
328. n=(tmsize_t)m;
^
329. if ((uint64)n!=m)
330. {
libtiff/tif_strip.c:329:6: Taking false branch
327. m=TIFFScanlineSize64(tif);
328. n=(tmsize_t)m;
329. if ((uint64)n!=m)
^
330. {
331. TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow");
libtiff/tif_strip.c:334:2:
332. n=0;
333. }
334. return(n);
^
335. }
336.
libtiff/tif_strip.c:335:1: return from a call to TIFFScanlineSize
333. }
334. return(n);
335. }
^
336.
337. /*
tools/tiffcp.c:1052:2:
1050. {
1051. tsize_t scanlinesizein = TIFFScanlineSize(in);
1052. tsize_t scanlinesizeout = TIFFScanlineSize(out);
^
1053. tdata_t inbuf;
1054. tdata_t outbuf;
libtiff/tif_strip.c:321:1: start of procedure TIFFScanlineSize()
319. return(scanline_size);
320. }
321. tmsize_t
^
322. TIFFScanlineSize(TIFF* tif)
323. {
libtiff/tif_strip.c:324:2:
322. TIFFScanlineSize(TIFF* tif)
323. {
324. static const char module[] = "TIFFScanlineSize";
^
325. uint64 m;
326. tmsize_t n;
libtiff/tif_strip.c:327:2: Skipping TIFFScanlineSize64(): empty list of specs
325. uint64 m;
326. tmsize_t n;
327. m=TIFFScanlineSize64(tif);
^
328. n=(tmsize_t)m;
329. if ((uint64)n!=m)
libtiff/tif_strip.c:328:2:
326. tmsize_t n;
327. m=TIFFScanlineSize64(tif);
328. n=(tmsize_t)m;
^
329. if ((uint64)n!=m)
330. {
libtiff/tif_strip.c:329:6: Taking false branch
327. m=TIFFScanlineSize64(tif);
328. n=(tmsize_t)m;
329. if ((uint64)n!=m)
^
330. {
331. TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow");
libtiff/tif_strip.c:334:2:
332. n=0;
333. }
334. return(n);
^
335. }
336.
libtiff/tif_strip.c:335:1: return from a call to TIFFScanlineSize
333. }
334. return(n);
335. }
^
336.
337. /*
tools/tiffcp.c:1060:2:
1058. tsample_t s;
1059.
1060. inbuf = _TIFFmalloc(scanlinesizein);
^
1061. outbuf = _TIFFmalloc(scanlinesizeout);
1062. if (!inbuf || !outbuf)
libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc()
251. #endif
252.
253. void*
^
254. _TIFFmalloc(tmsize_t s)
255. {
libtiff/tif_unix.c:256:2:
254. _TIFFmalloc(tmsize_t s)
255. {
256. return (malloc((size_t) s));
^
257. }
258.
libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc
255. {
256. return (malloc((size_t) s));
257. }
^
258.
259. void
tools/tiffcp.c:1061:2:
1059.
1060. inbuf = _TIFFmalloc(scanlinesizein);
1061. outbuf = _TIFFmalloc(scanlinesizeout);
^
1062. if (!inbuf || !outbuf)
1063. return 0;
libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc()
251. #endif
252.
253. void*
^
254. _TIFFmalloc(tmsize_t s)
255. {
libtiff/tif_unix.c:256:2:
254. _TIFFmalloc(tmsize_t s)
255. {
256. return (malloc((size_t) s));
^
257. }
258.
libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc
255. {
256. return (malloc((size_t) s));
257. }
^
258.
259. void
tools/tiffcp.c:1062:7: Taking true branch
1060. inbuf = _TIFFmalloc(scanlinesizein);
1061. outbuf = _TIFFmalloc(scanlinesizeout);
1062. if (!inbuf || !outbuf)
^
1063. return 0;
1064. _TIFFmemset(inbuf, 0, scanlinesizein);
| https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiffcp.c/#L1062 |
d2a_code_trace_data_45339 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/bn/bn_prime.c:456: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_add`.
Showing all 28 steps of the trace
crypto/bn/bn_prime.c:440:10: Call
438.
439. /* we now have a random number 'rand' to test. */
440. if (!BN_lshift1(p, q))
^
441. goto err;
442. if (!BN_add_word(p, 1))
crypto/bn/bn_shift.c:14:1: Parameter `a->top`
12. #include "bn_lcl.h"
13.
14. > int BN_lshift1(BIGNUM *r, const BIGNUM *a)
15. {
16. register BN_ULONG *ap, *rp, t, c;
crypto/bn/bn_shift.c:26:9: Assignment
24. if (bn_wexpand(r, a->top + 1) == NULL)
25. return 0;
26. r->top = a->top;
^
27. } else {
28. if (bn_wexpand(r, a->top + 1) == NULL)
crypto/bn/bn_prime.c:442:10: Call
440. if (!BN_lshift1(p, q))
441. goto err;
442. if (!BN_add_word(p, 1))
^
443. goto err;
444.
crypto/bn/bn_word.c:98:1: Parameter `a->top`
96. }
97.
98. > int BN_add_word(BIGNUM *a, BN_ULONG w)
99. {
100. BN_ULONG l;
crypto/bn/bn_prime.c:451:25: Call
449. * check that for p and q gcd(p-1,primes) == 1 (except for 2)
450. */
451. BN_ULONG pmod = BN_mod_word(p, (BN_ULONG)primes[i]);
^
452. BN_ULONG qmod = BN_mod_word(q, (BN_ULONG)primes[i]);
453. if (pmod == (BN_ULONG)-1 || qmod == (BN_ULONG)-1)
crypto/bn/bn_word.c:13:1: Parameter `a->top`
11. #include "bn_lcl.h"
12.
13. > BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w)
14. {
15. #ifndef BN_LLONG
crypto/bn/bn_prime.c:456:18: Call
454. goto err;
455. if (pmod == 0 || qmod == 0) {
456. if (!BN_add(p, p, padd))
^
457. goto err;
458. if (!BN_add(q, q, qadd))
crypto/bn/bn_add.c:14:1: Parameter `r->top`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:23:15: Call
21. if (a->neg == b->neg) {
22. r_neg = a->neg;
23. ret = BN_uadd(r, a, b);
^
24. } else {
25. cmp_res = BN_ucmp(a, b);
crypto/bn/bn_add.c:76:1: Parameter `r->top`
74.
75. /* unsigned add of b to a, r can be equal to a or b. */
76. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
77. {
78. int max, min, dif;
crypto/bn/bn_add.c:96:9: Call
94. dif = max - min;
95.
96. if (bn_wexpand(r, max + 1) == NULL)
^
97. return 0;
98.
crypto/bn/bn_lib.c:960:1: Parameter `a->top`
958. }
959.
960. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:962:37: Call
960. BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
963. }
964.
crypto/bn/bn_lib.c:245:1: Parameter `b->top`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `words`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:224:13: Call
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:224:9: Assignment
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_add`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232 |
d2a_code_trace_data_45340 | void ff_celp_circ_addf(float *out, const float *in,
const float *lagged, int lag, float fac, int n)
{
int k;
for (k = 0; k < lag; k++)
out[k] = in[k] + fac * lagged[n + k - lag];
for (; k < n; k++)
out[k] = in[k] + fac * lagged[ k - lag];
}
libavcodec/amrnbdec.c:1015: error: Buffer Overrun L2
Offset: [1, 77] Size: 2 by call to `anti_sparseness`.
libavcodec/amrnbdec.c:966:9: Call
964. const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];
965.
966. decode_pitch_vector(p, amr_subframe, subframe);
^
967.
968. decode_fixed_sparse(&fixed_sparse, amr_subframe->pulses,
libavcodec/amrnbdec.c:381:9: Call
379.
380. if (p->cur_frame_mode == MODE_12k2) {
381. decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac,
^
382. amr_subframe->p_lag, p->pitch_lag_int,
383. subframe);
libavcodec/amrnbdec.c:354:1: Parameter `pitch_index`
352. * Like ff_decode_pitch_lag(), but with 1/6 resolution
353. */
354. static void decode_pitch_lag_1_6(int *lag_int, int *lag_frac, int pitch_index,
^
355. const int prev_lag_int, const int subframe)
356. {
libavcodec/amrnbdec.c:359:13: Assignment
357. if (subframe == 0 || subframe == 2) {
358. if (pitch_index < 463) {
359. *lag_int = (pitch_index + 107) * 10923 >> 16;
^
360. *lag_frac = pitch_index - *lag_int * 6 + 105;
361. } else {
libavcodec/amrnbdec.c:391:5: Assignment
389. mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6));
390.
391. p->pitch_lag_int = pitch_lag_int; // store previous lag in a uint8_t
^
392.
393. pitch_lag_frac <<= (p->cur_frame_mode != MODE_12k2);
libavcodec/amrnbdec.c:978:9: Call
976. &fixed_gain_factor);
977.
978. pitch_sharpening(p, subframe, p->cur_frame_mode, &fixed_sparse);
^
979.
980. if (fixed_sparse.pitch_lag == 0) {
libavcodec/amrnbdec.c:533:1: Parameter `p->pitch_lag_int`
531. * @param fixed_sparse sparse respresentation of the fixed vector
532. */
533. static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode,
^
534. AMRFixed *fixed_sparse)
535. {
libavcodec/amrnbdec.c:542:5: Assignment
540. p->beta = FFMIN(p->pitch_gain[4], 1.0);
541.
542. fixed_sparse->pitch_lag = p->pitch_lag_int;
^
543. fixed_sparse->pitch_fac = p->beta;
544.
libavcodec/amrnbdec.c:1015:30: Call
1013. p->lsf_avg, p->cur_frame_mode);
1014.
1015. synth_fixed_vector = anti_sparseness(p, &fixed_sparse, p->fixed_vector,
^
1016. synth_fixed_gain, spare_vector);
1017.
libavcodec/amrnbdec.c:700:1: Parameter `fixed_sparse->pitch_lag`
698. * @param out space for modified vector if necessary
699. */
700. static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse,
^
701. const float *fixed_vector,
702. float fixed_gain, float *out)
libavcodec/amrnbdec.c:741:9: Call
739. if (p->cur_frame_mode != MODE_7k4 && p->cur_frame_mode < MODE_10k2
740. && ir_filter_nr < 2) {
741. apply_ir_filter(out, fixed_sparse,
^
742. (p->cur_frame_mode == MODE_7k95 ?
743. ir_filters_lookup_MODE_7k95 :
libavcodec/amrnbdec.c:653:1: Parameter `*filter`
651. * out[n] = sum(i,0,len-1){ in[i] * filter[(len + n - i)%len] }
652. */
653. static void apply_ir_filter(float *out, const AMRFixed *in,
^
654. const float *filter)
655. {
libavcodec/amrnbdec.c:663:9: Call
661.
662. if (lag < AMR_SUBFRAME_SIZE) {
663. ff_celp_circ_addf(filter1, filter, filter, lag, fac,
^
664. AMR_SUBFRAME_SIZE);
665.
libavcodec/celp_filters.c:48:1: <Offset trace>
46. }
47.
48. void ff_celp_circ_addf(float *out, const float *in,
^
49. const float *lagged, int lag, float fac, int n)
50. {
libavcodec/celp_filters.c:48:1: Parameter `lag`
46. }
47.
48. void ff_celp_circ_addf(float *out, const float *in,
^
49. const float *lagged, int lag, float fac, int n)
50. {
libavcodec/celp_filters.c:48:1: <Length trace>
46. }
47.
48. void ff_celp_circ_addf(float *out, const float *in,
^
49. const float *lagged, int lag, float fac, int n)
50. {
libavcodec/celp_filters.c:48:1: Parameter `*lagged`
46. }
47.
48. void ff_celp_circ_addf(float *out, const float *in,
^
49. const float *lagged, int lag, float fac, int n)
50. {
libavcodec/celp_filters.c:53:32: Array access: Offset: [1, 77] Size: 2 by call to `anti_sparseness`
51. int k;
52. for (k = 0; k < lag; k++)
53. out[k] = in[k] + fac * lagged[n + k - lag];
^
54. for (; k < n; k++)
55. out[k] = in[k] + fac * lagged[ k - lag];
| https://github.com/libav/libav/blob/2ba65879b5853b49bbefb75346fd73c8645bccea/libavcodec/celp_filters.c/#L53 |
d2a_code_trace_data_45341 | void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
test/lhash_test.c:223: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `lh_int_delete`.
Showing all 10 steps of the trace
test/lhash_test.c:205:9: Call
203. }
204. *p = 3 * i + 1;
205. lh_int_insert(h, p);
^
206. }
207.
test/lhash_test.c:34:1: Parameter `lh->num_items`
32. #endif
33.
34. > DEFINE_LHASH_OF(int);
35.
36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,
test/lhash_test.c:34:1: Call
32. #endif
33.
34. > DEFINE_LHASH_OF(int);
35.
36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,
crypto/lhash/lhash.c:70:1: Parameter `lh->num_items`
68. }
69.
70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
71. {
72. unsigned long hash;
test/lhash_test.c:223:18: Call
221. const int j = (7 * i + 4) % n * 3 + 1;
222.
223. if ((p = lh_int_delete(h, &j)) == NULL) {
^
224. fprintf(stderr, "test lhash stress delete %d\n", i);
225. goto end;
test/lhash_test.c:34:1: Parameter `lh->num_items`
32. #endif
33.
34. > DEFINE_LHASH_OF(int);
35.
36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,
test/lhash_test.c:34:1: Call
32. #endif
33.
34. > DEFINE_LHASH_OF(int);
35.
36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `lh_int_delete`
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/9998b32cb63b0bdd3d014abfa1d70e9a2c20a283/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_45342 | static void opt_input_ts_scale(const char *arg)
{
unsigned int stream;
double scale;
char *p;
stream = strtol(arg, &p, 0);
if (*p)
p++;
scale= strtod(p, &p);
if(stream >= MAX_STREAMS)
ffmpeg_exit(1);
input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
input_files_ts_scale[nb_input_files][stream]= scale;
}
ffmpeg.c:3034: error: Null Dereference
pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3033 could be null and is dereferenced at line 3034, column 5.
ffmpeg.c:3019:1: start of procedure opt_input_ts_scale()
3017. }
3018.
3019. static void opt_input_ts_scale(const char *arg)
^
3020. {
3021. unsigned int stream;
ffmpeg.c:3025:5:
3023. char *p;
3024.
3025. stream = strtol(arg, &p, 0);
^
3026. if (*p)
3027. p++;
ffmpeg.c:3026:9: Taking true branch
3024.
3025. stream = strtol(arg, &p, 0);
3026. if (*p)
^
3027. p++;
3028. scale= strtod(p, &p);
ffmpeg.c:3027:9:
3025. stream = strtol(arg, &p, 0);
3026. if (*p)
3027. p++;
^
3028. scale= strtod(p, &p);
3029.
ffmpeg.c:3028:5:
3026. if (*p)
3027. p++;
3028. scale= strtod(p, &p);
^
3029.
3030. if(stream >= MAX_STREAMS)
ffmpeg.c:3030:8: Taking true branch
3028. scale= strtod(p, &p);
3029.
3030. if(stream >= MAX_STREAMS)
^
3031. ffmpeg_exit(1);
3032.
ffmpeg.c:3031:9: Skipping ffmpeg_exit(): empty list of specs
3029.
3030. if(stream >= MAX_STREAMS)
3031. ffmpeg_exit(1);
^
3032.
3033. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
ffmpeg.c:3033:5:
3031. ffmpeg_exit(1);
3032.
3033. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
^
3034. input_files_ts_scale[nb_input_files][stream]= scale;
3035. }
ffmpeg.c:511:1: start of procedure grow_array()
509.
510. /* similar to ff_dynarray_add() and av_fast_realloc() */
511. static void *grow_array(void *array, int elem_size, int *size, int new_size)
^
512. {
513. if (new_size >= INT_MAX / elem_size) {
ffmpeg.c:513:9: Taking true branch
511. static void *grow_array(void *array, int elem_size, int *size, int new_size)
512. {
513. if (new_size >= INT_MAX / elem_size) {
^
514. fprintf(stderr, "Array too big.\n");
515. ffmpeg_exit(1);
ffmpeg.c:514:9:
512. {
513. if (new_size >= INT_MAX / elem_size) {
514. fprintf(stderr, "Array too big.\n");
^
515. ffmpeg_exit(1);
516. }
ffmpeg.c:515:9: Skipping ffmpeg_exit(): empty list of specs
513. if (new_size >= INT_MAX / elem_size) {
514. fprintf(stderr, "Array too big.\n");
515. ffmpeg_exit(1);
^
516. }
517. if (*size < new_size) {
ffmpeg.c:517:9: Taking true branch
515. ffmpeg_exit(1);
516. }
517. if (*size < new_size) {
^
518. uint8_t *tmp = av_realloc(array, new_size*elem_size);
519. if (!tmp) {
ffmpeg.c:518:9:
516. }
517. if (*size < new_size) {
518. uint8_t *tmp = av_realloc(array, new_size*elem_size);
^
519. if (!tmp) {
520. fprintf(stderr, "Could not alloc buffer.\n");
libavutil/mem.c:117:1: start of procedure av_realloc()
115. }
116.
117. void *av_realloc(void *ptr, size_t size)
^
118. {
119. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:124:8: Taking false branch
122.
123. /* let's disallow possible ambiguous cases */
124. if(size > (INT_MAX-16) )
^
125. return NULL;
126.
libavutil/mem.c:133:5:
131. return (char*)realloc((char*)ptr - diff, size + diff) + diff;
132. #else
133. return realloc(ptr, size);
^
134. #endif
135. }
libavutil/mem.c:135:1: return from a call to av_realloc
133. return realloc(ptr, size);
134. #endif
135. }
^
136.
137. void av_free(void *ptr)
ffmpeg.c:519:14: Taking true branch
517. if (*size < new_size) {
518. uint8_t *tmp = av_realloc(array, new_size*elem_size);
519. if (!tmp) {
^
520. fprintf(stderr, "Could not alloc buffer.\n");
521. ffmpeg_exit(1);
ffmpeg.c:520:13:
518. uint8_t *tmp = av_realloc(array, new_size*elem_size);
519. if (!tmp) {
520. fprintf(stderr, "Could not alloc buffer.\n");
^
521. ffmpeg_exit(1);
522. }
ffmpeg.c:521:13: Skipping ffmpeg_exit(): empty list of specs
519. if (!tmp) {
520. fprintf(stderr, "Could not alloc buffer.\n");
521. ffmpeg_exit(1);
^
522. }
523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
ffmpeg.c:523:9:
521. ffmpeg_exit(1);
522. }
523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
^
524. *size = new_size;
525. return tmp;
ffmpeg.c:524:9:
522. }
523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
524. *size = new_size;
^
525. return tmp;
526. }
ffmpeg.c:525:9:
523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
524. *size = new_size;
525. return tmp;
^
526. }
527. return array;
ffmpeg.c:528:1: return from a call to grow_array
526. }
527. return array;
528. }
^
529.
530. static void choose_sample_fmt(AVStream *st, AVCodec *codec)
ffmpeg.c:3034:5:
3032.
3033. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
3034. input_files_ts_scale[nb_input_files][stream]= scale;
^
3035. }
3036.
| https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L3034 |
d2a_code_trace_data_45343 | static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
{
int i, j;
for (i = 0, j = k - 1; i < j; i++, j--) {
int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
cof[j] += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20);
cof[i] += tmp1;
}
if (i == j)
cof[i] += ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
cof[k] = par[k];
}
libavcodec/alsdec.c:884: error: Integer Overflow L2
([0, -1+max(1, `*bd->opt_order`)] - 1):unsigned32 by call to `parcor_to_lpc`.
libavcodec/alsdec.c:877:14: Assignment
875. // reconstruct all samples from residuals
876. if (bd->ra_block) {
877. for (smp = 0; smp < opt_order; smp++) {
^
878. y = 1 << 19;
879.
libavcodec/alsdec.c:884:13: Call
882.
883. *raw_samples++ -= y >> 20;
884. parcor_to_lpc(smp, quant_cof, lpc_cof);
^
885. }
886. } else {
libavcodec/alsdec.c:481:1: <LHS trace>
479. /** Convert PARCOR coefficient k to direct filter coefficient.
480. */
481. static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
^
482. {
483. int i, j;
libavcodec/alsdec.c:481:1: Parameter `k`
479. /** Convert PARCOR coefficient k to direct filter coefficient.
480. */
481. static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
^
482. {
483. int i, j;
libavcodec/alsdec.c:485:17: Binary operation: ([0, -1+max(1, *bd->opt_order)] - 1):unsigned32 by call to `parcor_to_lpc`
483. int i, j;
484.
485. for (i = 0, j = k - 1; i < j; i++, j--) {
^
486. int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
487. cof[j] += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20);
| https://github.com/libav/libav/blob/3cf8db9447a6c77550033acea84e30be2af7ad2c/libavcodec/alsdec.c/#L485 |
d2a_code_trace_data_45344 | static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
{
BN_ULONG ret = 0;
int wordpos;
wordpos = bitpos / BN_BITS2;
bitpos %= BN_BITS2;
if (wordpos >= 0 && wordpos < a->top) {
ret = a->d[wordpos] & BN_MASK2;
if (bitpos) {
ret >>= bitpos;
if (++wordpos < a->top)
ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
}
}
return ret & BN_MASK2;
}
crypto/srp/srp_vfy.c:730: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp`.
Showing all 14 steps of the trace
crypto/srp/srp_vfy.c:715:19: Call
713. goto err;
714.
715. salttmp = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
^
716. if (salttmp == NULL)
717. goto err;
crypto/bn/bn_lib.c:389:9: Assignment
387. n = len;
388. if (n == 0) {
389. ret->top = 0;
^
390. return ret;
391. }
crypto/srp/srp_vfy.c:730:10: Call
728. goto err;
729.
730. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
^
731. BN_clear_free(*verifier);
732. goto err;
crypto/bn/bn_exp.c:89:1: Parameter `*p->d`
87. }
88.
89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
90. BN_CTX *ctx)
91. {
crypto/bn/bn_exp.c:144:19: Call
142. } else
143. # endif
144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
^
145. } else
146. #endif
crypto/bn/bn_exp.c:296:1: Parameter `*p->d`
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:592:1: Parameter `*p->d`
590. * http://www.daemonology.net/hyperthreading-considered-harmful/)
591. */
592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
593. const BIGNUM *m, BN_CTX *ctx,
594. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:1057:18: Call
1055. wmask = (1 << window0) - 1;
1056. bits -= window0;
1057. wvalue = bn_get_bits(p, bits) & wmask;
^
1058. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
1059. window))
crypto/bn/bn_exp.c:472:1: <Offset trace>
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:472:1: Parameter `a->top`
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:472:1: <Length trace>
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:472:1: Parameter `*a->d`
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:484:24: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp`
482. ret >>= bitpos;
483. if (++wordpos < a->top)
484. ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
^
485. }
486. }
| https://github.com/openssl/openssl/blob/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_exp.c/#L484 |
d2a_code_trace_data_45345 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max)
{
const unsigned char *p = *pp;
unsigned long ret = 0;
int i;
if (max-- < 1)
return 0;
if (*p == 0x80) {
*inf = 1;
p++;
} else {
*inf = 0;
i = *p & 0x7f;
if (*p++ & 0x80) {
if (max < i + 1)
return 0;
while (i > 0 && *p == 0) {
p++;
i--;
}
if (i > (int)sizeof(long))
return 0;
while (i > 0) {
ret <<= 8;
ret |= *p++;
i--;
}
if (ret > LONG_MAX)
return 0;
} else
ret = i;
}
*pp = p;
*rl = (long)ret;
return 1;
}
crypto/pem/pem_pkey.c:42: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO`.
Showing all 27 steps of the trace
crypto/pem/pem_pkey.c:35:10: Call
33. EVP_PKEY *ret = NULL;
34.
35. if (!PEM_bytes_read_bio_secmem(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp,
^
36. cb, u))
37. return NULL;
crypto/pem/pem_lib.c:287:1: Parameter `**pdata`
285. }
286.
287. > int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm,
288. const char *name, BIO *bp, pem_password_cb *cb,
289. void *u) {
crypto/pem/pem_lib.c:290:12: Call
288. const char *name, BIO *bp, pem_password_cb *cb,
289. void *u) {
290. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u,
^
291. PEM_FLAG_SECURE | PEM_FLAG_EAY_COMPATIBLE);
292. }
crypto/pem/pem_lib.c:237:1: Parameter `**pdata`
235. }
236.
237. > static int pem_bytes_read_bio_flags(unsigned char **pdata, long *plen,
238. char **pnm, const char *name, BIO *bp,
239. pem_password_cb *cb, void *u,
crypto/pem/pem_pkey.c:38:5: Assignment
36. cb, u))
37. return NULL;
38. p = data;
^
39.
40. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
crypto/pem/pem_pkey.c:42:17: Call
40. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
41. PKCS8_PRIV_KEY_INFO *p8inf;
42. p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
^
43. if (!p8inf)
44. goto p8err;
crypto/asn1/p8_pkey.c:36:1: Parameter `**in`
34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
35.
36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
37.
38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
crypto/asn1/p8_pkey.c:36:1: Call
34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
35.
36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
37.
38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
crypto/asn1/tasn_dec.c:95:1: Parameter `**in`
93. */
94.
95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
96. const unsigned char **in, long len,
97. const ASN1_ITEM *it)
crypto/asn1/tasn_dec.c:104:9: Call
102. pval = &ptmpval;
103. asn1_tlc_clear_nc(&c);
104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
^
105. return *pval;
106. return NULL;
crypto/asn1/tasn_dec.c:109:1: Parameter `**in`
107. }
108.
109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
110. const ASN1_ITEM *it,
111. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:114:10: Call
112. {
113. int rv;
114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx);
^
115. if (rv <= 0)
116. ASN1_item_ex_free(pval, it);
crypto/asn1/tasn_dec.c:125:1: Parameter `**in`
123. */
124.
125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
126. long len, const ASN1_ITEM *it,
127. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:169:9: Assignment
167.
168. case ASN1_ITYPE_MSTRING:
169. p = *in;
^
170. /* Just read in tag and class */
171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
crypto/asn1/tasn_dec.c:171:15: Call
169. p = *in;
170. /* Just read in tag and class */
171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
^
172. &p, len, -1, 0, 1, ctx);
173. if (!ret) {
crypto/asn1/tasn_dec.c:1060:1: Parameter `**in`
1058. */
1059.
1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
1061. char *inf, char *cst,
1062. const unsigned char **in, long len,
crypto/asn1/tasn_dec.c:1069:5: Assignment
1067. long plen;
1068. const unsigned char *p, *q;
1069. p = *in;
^
1070. q = p;
1071.
crypto/asn1/tasn_dec.c:1079:13: Call
1077. p += ctx->hdrlen;
1078. } else {
1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
^
1080. if (ctx) {
1081. ctx->ret = i;
crypto/asn1/asn1_lib.c:44:1: Parameter `**pp`
42. }
43.
44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
45. int *pclass, long omax)
46. {
crypto/asn1/asn1_lib.c:49:5: Assignment
47. int i, ret;
48. long l;
49. const unsigned char *p = *pp;
^
50. int tag, xclass, inf;
51. long max = omax;
crypto/asn1/asn1_lib.c:78:9: Assignment
76. } else {
77. tag = i;
78. p++;
^
79. if (--max == 0)
80. goto err;
crypto/asn1/asn1_lib.c:84:10: Call
82. *ptag = tag;
83. *pclass = xclass;
84. if (!asn1_get_length(&p, &inf, plength, max))
^
85. goto err;
86.
crypto/asn1/asn1_lib.c:112:1: <Length trace>
110. * are stored most significant digit first.
111. */
112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
113. long max)
114. {
crypto/asn1/asn1_lib.c:112:1: Parameter `**pp`
110. * are stored most significant digit first.
111. */
112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
113. long max)
114. {
crypto/asn1/asn1_lib.c:115:5: Assignment
113. long max)
114. {
115. const unsigned char *p = *pp;
^
116. unsigned long ret = 0;
117. int i;
crypto/asn1/asn1_lib.c:127:14: Assignment
125. *inf = 0;
126. i = *p & 0x7f;
127. if (*p++ & 0x80) {
^
128. if (max < i + 1)
129. return 0;
crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO`
129. return 0;
130. /* Skip leading zeroes */
131. while (i > 0 && *p == 0) {
^
132. p++;
133. i--;
| https://github.com/openssl/openssl/blob/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/asn1/asn1_lib.c/#L131 |
d2a_code_trace_data_45346 | static int vp3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
static int counter = 0;
int i;
init_get_bits(&gb, buf, buf_size * 8);
if (s->theora && get_bits1(&gb))
{
av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
return -1;
}
s->keyframe = !get_bits1(&gb);
if (!s->theora)
skip_bits(&gb, 1);
for (i = 0; i < 3; i++)
s->last_qps[i] = s->qps[i];
s->nqps=0;
do{
s->qps[s->nqps++]= get_bits(&gb, 6);
} while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb));
for (i = s->nqps; i < 3; i++)
s->qps[i] = -1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
s->keyframe?"key":"", counter, s->qps[0]);
counter++;
if (s->qps[0] != s->last_qps[0])
init_loop_filter(s);
for (i = 0; i < s->nqps; i++)
if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
init_dequantizer(s, i);
if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
return buf_size;
s->current_frame.reference = 3;
s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
if (avctx->get_buffer(avctx, &s->current_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
if (s->keyframe) {
if (!s->theora)
{
skip_bits(&gb, 4);
skip_bits(&gb, 4);
if (s->version)
{
s->version = get_bits(&gb, 5);
if (counter == 1)
av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
}
}
if (s->version || s->theora)
{
if (get_bits1(&gb))
av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2);
}
} else {
if (!s->golden_frame.data[0]) {
av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n");
s->golden_frame.reference = 3;
s->golden_frame.pict_type = FF_I_TYPE;
if (avctx->get_buffer(avctx, &s->golden_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
s->last_frame = s->golden_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
}
s->current_frame.qscale_table= s->qscale_table;
s->current_frame.qstride= 0;
memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
if (unpack_superblocks(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
goto error;
}
if (unpack_modes(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
goto error;
}
if (unpack_vectors(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
goto error;
}
if (unpack_block_qpis(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
goto error;
}
if (unpack_dct_coeffs(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
goto error;
}
for (i = 0; i < 3; i++) {
int height = s->height >> (i && s->chroma_y_shift);
if (s->flipped_image)
s->data_offset[i] = 0;
else
s->data_offset[i] = (height-1) * s->current_frame.linesize[i];
}
s->last_slice_end = 0;
for (i = 0; i < s->c_superblock_height; i++)
render_slice(s, i);
for (i = 0; i < 3; i++) {
int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1;
apply_loop_filter(s, i, row, row+1);
}
vp3_draw_horiz_band(s, s->height);
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->current_frame;
if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY)
avctx->release_buffer(avctx, &s->last_frame);
s->last_frame= s->current_frame;
if (s->keyframe) {
if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
s->golden_frame = s->current_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
s->current_frame.data[0]= NULL;
return buf_size;
error:
if (s->current_frame.data[0])
avctx->release_buffer(avctx, &s->current_frame);
return -1;
}
libavcodec/vp3.c:1722: error: Null Dereference
pointer `&gb->buffer` last assigned on line 1714 could be null and is dereferenced by call to `get_bits1()` at line 1722, column 20.
libavcodec/vp3.c:1703:1: start of procedure vp3_decode_frame()
1701. * This is the ffmpeg/libavcodec API frame decode function.
1702. */
1703. static int vp3_decode_frame(AVCodecContext *avctx,
^
1704. void *data, int *data_size,
1705. AVPacket *avpkt)
libavcodec/vp3.c:1707:5:
1705. AVPacket *avpkt)
1706. {
1707. const uint8_t *buf = avpkt->data;
^
1708. int buf_size = avpkt->size;
1709. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1708:5:
1706. {
1707. const uint8_t *buf = avpkt->data;
1708. int buf_size = avpkt->size;
^
1709. Vp3DecodeContext *s = avctx->priv_data;
1710. GetBitContext gb;
libavcodec/vp3.c:1709:5:
1707. const uint8_t *buf = avpkt->data;
1708. int buf_size = avpkt->size;
1709. Vp3DecodeContext *s = avctx->priv_data;
^
1710. GetBitContext gb;
1711. static int counter = 0;
libavcodec/vp3.c:1711:5:
1709. Vp3DecodeContext *s = avctx->priv_data;
1710. GetBitContext gb;
1711. static int counter = 0;
^
1712. int i;
1713.
libavcodec/vp3.c:1714:5:
1712. int i;
1713.
1714. init_get_bits(&gb, buf, buf_size * 8);
^
1715.
1716. if (s->theora && get_bits1(&gb))
libavcodec/get_bits.h:473:1: start of procedure init_get_bits()
471. * responsible for checking for the buffer end yourself (take advantage of the padding)!
472. */
473. static inline void init_get_bits(GetBitContext *s,
^
474. const uint8_t *buffer, int bit_size)
475. {
libavcodec/get_bits.h:476:5:
474. const uint8_t *buffer, int bit_size)
475. {
476. int buffer_size= (bit_size+7)>>3;
^
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
libavcodec/get_bits.h:477:8: Taking true branch
475. {
476. int buffer_size= (bit_size+7)>>3;
477. if(buffer_size < 0 || bit_size < 0) {
^
478. buffer_size = bit_size = 0;
479. buffer = NULL;
libavcodec/get_bits.h:478:9:
476. int buffer_size= (bit_size+7)>>3;
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
^
479. buffer = NULL;
480. }
libavcodec/get_bits.h:479:9:
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
479. buffer = NULL;
^
480. }
481.
libavcodec/get_bits.h:482:5:
480. }
481.
482. s->buffer= buffer;
^
483. s->size_in_bits= bit_size;
484. s->buffer_end= buffer + buffer_size;
libavcodec/get_bits.h:483:5:
481.
482. s->buffer= buffer;
483. s->size_in_bits= bit_size;
^
484. s->buffer_end= buffer + buffer_size;
485. #ifdef ALT_BITSTREAM_READER
libavcodec/get_bits.h:484:5:
482. s->buffer= buffer;
483. s->size_in_bits= bit_size;
484. s->buffer_end= buffer + buffer_size;
^
485. #ifdef ALT_BITSTREAM_READER
486. s->index=0;
libavcodec/get_bits.h:486:5:
484. s->buffer_end= buffer + buffer_size;
485. #ifdef ALT_BITSTREAM_READER
486. s->index=0;
^
487. #elif defined LIBMPEG2_BITSTREAM_READER
488. s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
libavcodec/get_bits.h:496:1: return from a call to init_get_bits
494. skip_bits_long(s, 0);
495. #endif
496. }
^
497.
498. static inline void align_get_bits(GetBitContext *s)
libavcodec/vp3.c:1716:9: Taking false branch
1714. init_get_bits(&gb, buf, buf_size * 8);
1715.
1716. if (s->theora && get_bits1(&gb))
^
1717. {
1718. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/vp3.c:1722:20:
1720. }
1721.
1722. s->keyframe = !get_bits1(&gb);
^
1723. if (!s->theora)
1724. skip_bits(&gb, 1);
libavcodec/get_bits.h:393:1: start of procedure get_bits1()
391. }
392.
393. static inline unsigned int get_bits1(GetBitContext *s){
^
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
libavcodec/get_bits.h:395:5:
393. static inline unsigned int get_bits1(GetBitContext *s){
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
^
396. uint8_t result= s->buffer[ index>>3 ];
397. #ifdef ALT_BITSTREAM_READER_LE
libavcodec/get_bits.h:396:5:
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
396. uint8_t result= s->buffer[ index>>3 ];
^
397. #ifdef ALT_BITSTREAM_READER_LE
398. result>>= (index&0x07);
| https://github.com/libav/libav/blob/5ae092ee34bd8a174306abdd5cd8bf6eea4a2f8e/libavcodec/vp3.c/#L1722 |
d2a_code_trace_data_45347 | static void unpack_input(const unsigned char *input, unsigned int *output)
{
unsigned int outbuffer[28];
unsigned short inbuffer[10];
unsigned int x;
unsigned int *ptr;
for (x=0;x<20;x+=2)
inbuffer[x/2]=(input[x]<<8)+input[x+1];
ptr=outbuffer;
*(ptr++)=27;
*(ptr++)=(inbuffer[0]>>10)&0x3f;
*(ptr++)=(inbuffer[0]>>5)&0x1f;
*(ptr++)=inbuffer[0]&0x1f;
*(ptr++)=(inbuffer[1]>>12)&0xf;
*(ptr++)=(inbuffer[1]>>8)&0xf;
*(ptr++)=(inbuffer[1]>>5)&7;
*(ptr++)=(inbuffer[1]>>2)&7;
*(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
*(ptr++)=(inbuffer[2]>>12)&7;
*(ptr++)=(inbuffer[2]>>10)&3;
*(ptr++)=(inbuffer[2]>>5)&0x1f;
*(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
*(ptr++)=(inbuffer[3]>>6)&0xff;
*(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1);
*(ptr++)=(inbuffer[4]>>8)&0x7f;
*(ptr++)=(inbuffer[4]>>1)&0x7f;
*(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
*(ptr++)=(inbuffer[5]>>2)&0x7f;
*(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
*(ptr++)=(inbuffer[6]>>4)&0x7f;
*(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
*(ptr++)=(inbuffer[7]>>5)&0x7f;
*(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
*(ptr++)=(inbuffer[8]>>7)&0x7f;
*(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
*(ptr++)=(inbuffer[9]>>8)&0x7f;
*(ptr++)=(inbuffer[9]>>1)&0x7f;
*(output++)=outbuffer[11];
for (x=1;x<11;*(output++)=outbuffer[x++]);
ptr=outbuffer+12;
for (x=0;x<16;x+=4)
{
*(output++)=ptr[x];
*(output++)=ptr[x+2];
*(output++)=ptr[x+3];
*(output++)=ptr[x+1];
}
}
libavcodec/ra144.c:273: error: Uninitialized Value
The value read from inbuffer[_] was never initialized.
libavcodec/ra144.c:273:3:
271. *(ptr++)=(inbuffer[1]>>12)&0xf;
272. *(ptr++)=(inbuffer[1]>>8)&0xf;
273. *(ptr++)=(inbuffer[1]>>5)&7;
^
274. *(ptr++)=(inbuffer[1]>>2)&7;
275. *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L273 |
d2a_code_trace_data_45348 | void
ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
{
size_t size;
uintptr_t slab, m, *bitmap;
ngx_uint_t n, type, slot, shift, map;
ngx_slab_page_t *slots, *page;
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0, "slab free: %p", p);
if ((u_char *) p < pool->start || (u_char *) p > pool->end) {
ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): outside of pool");
goto fail;
}
n = ((u_char *) p - pool->start) >> ngx_pagesize_shift;
page = &pool->pages[n];
slab = page->slab;
type = page->prev & NGX_SLAB_PAGE_MASK;
switch (type) {
case NGX_SLAB_SMALL:
shift = slab & NGX_SLAB_SHIFT_MASK;
size = 1 << shift;
if ((uintptr_t) p & (size - 1)) {
goto wrong_chunk;
}
n = ((uintptr_t) p & (ngx_pagesize - 1)) >> shift;
m = (uintptr_t) 1 << (n & (sizeof(uintptr_t) * 8 - 1));
n /= (sizeof(uintptr_t) * 8);
bitmap = (uintptr_t *) ((uintptr_t) p & ~(ngx_pagesize - 1));
if (bitmap[n] & m) {
if (page->next == NULL) {
slots = (ngx_slab_page_t *)
((u_char *) pool + sizeof(ngx_slab_pool_t));
slot = shift - pool->min_shift;
page->next = slots[slot].next;
slots[slot].next = page;
page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_SMALL;
page->next->prev = (uintptr_t) page | NGX_SLAB_SMALL;
}
bitmap[n] &= ~m;
n = (1 << (ngx_pagesize_shift - shift)) / 8 / (1 << shift);
if (n == 0) {
n = 1;
}
if (bitmap[0] & ~(((uintptr_t) 1 << n) - 1)) {
goto done;
}
map = (1 << (ngx_pagesize_shift - shift)) / (sizeof(uintptr_t) * 8);
for (n = 1; n < map; n++) {
if (bitmap[n]) {
goto done;
}
}
ngx_slab_free_pages(pool, page, 1);
goto done;
}
goto chunk_already_free;
case NGX_SLAB_EXACT:
m = (uintptr_t) 1 <<
(((uintptr_t) p & (ngx_pagesize - 1)) >> ngx_slab_exact_shift);
size = ngx_slab_exact_size;
if ((uintptr_t) p & (size - 1)) {
goto wrong_chunk;
}
if (slab & m) {
if (slab == NGX_SLAB_BUSY) {
slots = (ngx_slab_page_t *)
((u_char *) pool + sizeof(ngx_slab_pool_t));
slot = ngx_slab_exact_shift - pool->min_shift;
page->next = slots[slot].next;
slots[slot].next = page;
page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_EXACT;
page->next->prev = (uintptr_t) page | NGX_SLAB_EXACT;
}
page->slab &= ~m;
if (page->slab) {
goto done;
}
ngx_slab_free_pages(pool, page, 1);
goto done;
}
goto chunk_already_free;
case NGX_SLAB_BIG:
shift = slab & NGX_SLAB_SHIFT_MASK;
size = 1 << shift;
if ((uintptr_t) p & (size - 1)) {
goto wrong_chunk;
}
m = (uintptr_t) 1 << ((((uintptr_t) p & (ngx_pagesize - 1)) >> shift)
+ NGX_SLAB_MAP_SHIFT);
if (slab & m) {
if (page->next == NULL) {
slots = (ngx_slab_page_t *)
((u_char *) pool + sizeof(ngx_slab_pool_t));
slot = shift - pool->min_shift;
page->next = slots[slot].next;
slots[slot].next = page;
page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_BIG;
page->next->prev = (uintptr_t) page | NGX_SLAB_BIG;
}
page->slab &= ~m;
if (page->slab & NGX_SLAB_MAP_MASK) {
goto done;
}
ngx_slab_free_pages(pool, page, 1);
goto done;
}
goto chunk_already_free;
case NGX_SLAB_PAGE:
if ((uintptr_t) p & (ngx_pagesize - 1)) {
goto wrong_chunk;
}
if (slab == NGX_SLAB_PAGE_FREE) {
ngx_slab_error(pool, NGX_LOG_ALERT,
"ngx_slab_free(): page is already free");
goto fail;
}
if (slab == NGX_SLAB_PAGE_BUSY) {
ngx_slab_error(pool, NGX_LOG_ALERT,
"ngx_slab_free(): pointer to wrong page");
goto fail;
}
n = ((u_char *) p - pool->start) >> ngx_pagesize_shift;
size = slab & ~NGX_SLAB_PAGE_START;
ngx_slab_free_pages(pool, &pool->pages[n], size);
ngx_slab_junk(p, size << ngx_pagesize_shift);
return;
}
return;
done:
ngx_slab_junk(p, size);
return;
wrong_chunk:
ngx_slab_error(pool, NGX_LOG_ALERT,
"ngx_slab_free(): pointer to wrong chunk");
goto fail;
chunk_already_free:
ngx_slab_error(pool, NGX_LOG_ALERT,
"ngx_slab_free(): chunk is already free");
fail:
return;
}
src/http/modules/ngx_http_limit_req_module.c:445: error: Integer Overflow L2
([0, +oo] - [0, 15]):unsigned64 by call to `ngx_slab_free_locked`.
src/http/modules/ngx_http_limit_req_module.c:445:9: Call
443. ngx_rbtree_delete(ctx->rbtree, node);
444.
445. ngx_slab_free_locked(ctx->shpool, node);
^
446. }
447. }
src/core/ngx_slab.c:412:1: Parameter `pool->pages->slab`
410.
411.
412. void
^
413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
414. {
src/http/modules/ngx_http_limit_req_module.c:445:9: Call
443. ngx_rbtree_delete(ctx->rbtree, node);
444.
445. ngx_slab_free_locked(ctx->shpool, node);
^
446. }
447. }
src/core/ngx_slab.c:412:1: Parameter `pool->pages->slab`
410.
411.
412. void
^
413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
414. {
src/http/modules/ngx_http_limit_req_module.c:445:9: Call
443. ngx_rbtree_delete(ctx->rbtree, node);
444.
445. ngx_slab_free_locked(ctx->shpool, node);
^
446. }
447. }
src/core/ngx_slab.c:412:1: <LHS trace>
410.
411.
412. void
^
413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
414. {
src/core/ngx_slab.c:412:1: Global `ngx_pagesize_shift`
410.
411.
412. void
^
413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
414. {
src/core/ngx_slab.c:412:1: <RHS trace>
410.
411.
412. void
^
413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
414. {
src/core/ngx_slab.c:412:1: Parameter `pool->pages->slab`
410.
411.
412. void
^
413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
414. {
src/core/ngx_slab.c:429:5: Assignment
427. n = ((u_char *) p - pool->start) >> ngx_pagesize_shift;
428. page = &pool->pages[n];
429. slab = page->slab;
^
430. type = page->prev & NGX_SLAB_PAGE_MASK;
431.
src/core/ngx_slab.c:436:9: Assignment
434. case NGX_SLAB_SMALL:
435.
436. shift = slab & NGX_SLAB_SHIFT_MASK;
^
437. size = 1 << shift;
438.
src/core/ngx_slab.c:464:13: Binary operation: ([0, +oo] - [0, 15]):unsigned64 by call to `ngx_slab_free_locked`
462. bitmap[n] &= ~m;
463.
464. n = (1 << (ngx_pagesize_shift - shift)) / 8 / (1 << shift);
^
465.
466. if (n == 0) {
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_slab.c/#L464 |
d2a_code_trace_data_45349 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/bn/bn_mont.c:67: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, +oo] by call to `bn_sqr_fixed_top`.
Showing all 17 steps of the trace
crypto/bn/bn_mont.c:61:11: Call
59.
60. BN_CTX_start(ctx);
61. tmp = BN_CTX_get(ctx);
^
62. if (tmp == NULL)
63. goto err;
crypto/bn/bn_ctx.c:219:5: Call
217. }
218. /* OK, make sure the returned bignum is "zero" */
219. BN_zero(ret);
^
220. /* clear BN_FLG_CONSTTIME if leaked from previous frames */
221. ret->flags &= (~BN_FLG_CONSTTIME);
crypto/bn/bn_lib.c:359:1: Parameter `*a->d`
357. }
358.
359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
360. {
361. bn_check_top(a);
crypto/bn/bn_lib.c:362:9: Call
360. {
361. bn_check_top(a);
362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
363. return 0;
364. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_mont.c:67:14: Call
65. bn_check_top(tmp);
66. if (a == b) {
67. if (!bn_sqr_fixed_top(tmp, a, ctx))
^
68. goto err;
69. } else {
crypto/bn/bn_sqr.c:27:1: Parameter `*r->d`
25. }
26.
27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
28. {
29. int max, al;
crypto/bn/bn_sqr.c:49:9: Call
47.
48. max = 2 * al; /* Non-zero (from above) */
49. if (bn_wexpand(rr, max) == NULL)
^
50. goto err;
51.
crypto/bn/bn_lib.c:960:1: Parameter `*a->d`
958. }
959.
960. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:962:37: Call
960. BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
963. }
964.
crypto/bn/bn_lib.c:245:1: Parameter `*b->d`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `*b->d`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `bn_sqr_fixed_top`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232 |
d2a_code_trace_data_45350 | 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 xmin 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_45351 | 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:3994: error: Null Dereference
pointer `today` last assigned on line 3992 could be null and is dereferenced at line 3994, column 69.
avconv.c:3988:1: start of procedure opt_vstats()
3986. }
3987.
3988. static int opt_vstats(const char *opt, const char *arg)
^
3989. {
3990. char filename[40];
avconv.c:3991:5:
3989. {
3990. char filename[40];
3991. time_t today2 = time(NULL);
^
3992. struct tm *today = localtime(&today2);
3993.
avconv.c:3992:5:
3990. char filename[40];
3991. time_t today2 = time(NULL);
3992. struct tm *today = localtime(&today2);
^
3993.
3994. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
avconv.c:3994:5:
3992. struct tm *today = localtime(&today2);
3993.
3994. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
3995. today->tm_sec);
3996. return opt_vstats_file(opt, filename);
| https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/avconv.c/#L3994 |
d2a_code_trace_data_45352 | void
TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n)
{
register unsigned char* cp;
register unsigned char t;
assert(sizeof(uint16)==2);
while (n-- > 0) {
cp = (unsigned char*) wp;
t = cp[1]; cp[1] = cp[0]; cp[0] = t;
wp++;
}
}
libtiff/tif_dirwrite.c:1659: error: Buffer Overrun L3
Offset: [1, +oo] (⇐ [0, +oo] + 1) Size: [0, +oo] by call to `TIFFWriteDirectoryTagCheckedShortArray`.
libtiff/tif_dirwrite.c:1637:1: Parameter `tif->tif_dir.td_bitspersample`
1635. }
1636. #endif
1637. static int
^
1638. TIFFWriteDirectoryTagColormap(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
1639. {
libtiff/tif_dirwrite.c:1649:2: Assignment
1647. return(1);
1648. }
1649. m=(1<<tif->tif_dir.td_bitspersample);
^
1650. n=_TIFFmalloc(3*m*sizeof(uint16));
1651. if (n==NULL)
libtiff/tif_dirwrite.c:1650:4: Call
1648. }
1649. m=(1<<tif->tif_dir.td_bitspersample);
1650. n=_TIFFmalloc(3*m*sizeof(uint16));
^
1651. if (n==NULL)
1652. {
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:1650:2: Assignment
1648. }
1649. m=(1<<tif->tif_dir.td_bitspersample);
1650. n=_TIFFmalloc(3*m*sizeof(uint16));
^
1651. if (n==NULL)
1652. {
libtiff/tif_dirwrite.c:1659:4: Call
1657. _TIFFmemcpy(&n[m],tif->tif_dir.td_colormap[1],m*sizeof(uint16));
1658. _TIFFmemcpy(&n[2*m],tif->tif_dir.td_colormap[2],m*sizeof(uint16));
1659. o=TIFFWriteDirectoryTagCheckedShortArray(tif,ndir,dir,TIFFTAG_COLORMAP,3*m,n);
^
1660. _TIFFfree(n);
1661. return(o);
libtiff/tif_dirwrite.c:1830:1: Parameter `*value`
1828. }
1829.
1830. static int
^
1831. TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint16* value)
1832. {
libtiff/tif_dirwrite.c:1836:3: Call
1834. assert(sizeof(uint16)==2);
1835. if (tif->tif_flags&TIFF_SWAB)
1836. TIFFSwabArrayOfShort(value,count);
^
1837. return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SHORT,count,count*2,value));
1838. }
libtiff/tif_swab.c:72:1: <Length trace>
70.
71. #ifndef TIFFSwabArrayOfShort
72. void
^
73. TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n)
74. {
libtiff/tif_swab.c:72:1: Parameter `*wp`
70.
71. #ifndef TIFFSwabArrayOfShort
72. void
^
73. TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n)
74. {
libtiff/tif_swab.c:80:3: Assignment
78. /* XXX unroll loop some */
79. while (n-- > 0) {
80. cp = (unsigned char*) wp;
^
81. t = cp[1]; cp[1] = cp[0]; cp[0] = t;
82. wp++;
libtiff/tif_swab.c:81:7: Array access: Offset: [1, +oo] (⇐ [0, +oo] + 1) Size: [0, +oo] by call to `TIFFWriteDirectoryTagCheckedShortArray`
79. while (n-- > 0) {
80. cp = (unsigned char*) wp;
81. t = cp[1]; cp[1] = cp[0]; cp[0] = t;
^
82. wp++;
83. }
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L81 |
d2a_code_trace_data_45353 | static void init_dequant_tables(H264Context *h){
int i,x;
init_dequant4_coeff_table(h);
if(h->pps.transform_8x8_mode)
init_dequant8_coeff_table(h);
if(h->sps.transform_bypass){
for(i=0; i<6; i++)
for(x=0; x<16; x++)
h->dequant4_coeff[i][0][x] = 1<<6;
if(h->pps.transform_8x8_mode)
for(i=0; i<2; i++)
for(x=0; x<64; x++)
h->dequant8_coeff[i][0][x] = 1<<6;
}
}
libavcodec/h264.c:2085: error: Buffer Overrun L2
Offset: [0, 63] Size: 52.
libavcodec/h264.c:2084:21: <Offset trace>
2082. if(h->pps.transform_8x8_mode)
2083. for(i=0; i<2; i++)
2084. for(x=0; x<64; x++)
^
2085. h->dequant8_coeff[i][0][x] = 1<<6;
2086. }
libavcodec/h264.c:2084:21: Assignment
2082. if(h->pps.transform_8x8_mode)
2083. for(i=0; i<2; i++)
2084. for(x=0; x<64; x++)
^
2085. h->dequant8_coeff[i][0][x] = 1<<6;
2086. }
libavcodec/h264.c:2073:1: <Length trace>
2071. }
2072.
2073. static void init_dequant_tables(H264Context *h){
^
2074. int i,x;
2075. init_dequant4_coeff_table(h);
libavcodec/h264.c:2073:1: Parameter `(*h->dequant8_coeff[*])[*]`
2071. }
2072.
2073. static void init_dequant_tables(H264Context *h){
^
2074. int i,x;
2075. init_dequant4_coeff_table(h);
libavcodec/h264.c:2085:21: Array access: Offset: [0, 63] Size: 52
2083. for(i=0; i<2; i++)
2084. for(x=0; x<64; x++)
2085. h->dequant8_coeff[i][0][x] = 1<<6;
^
2086. }
2087. }
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2085 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.