id
stringlengths 25
25
| content
stringlengths 649
72.1k
| max_stars_repo_path
stringlengths 91
133
|
|---|---|---|
d2a_code_trace_data_44054
|
int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
const char *ok_chars, const char *cancel_chars,
int flags, char *result_buf)
{
char *prompt_copy = NULL;
char *action_desc_copy = NULL;
char *ok_chars_copy = NULL;
char *cancel_chars_copy = NULL;
if (prompt != NULL) {
prompt_copy = OPENSSL_strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (action_desc != NULL) {
action_desc_copy = OPENSSL_strdup(action_desc);
if (action_desc_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (ok_chars != NULL) {
ok_chars_copy = OPENSSL_strdup(ok_chars);
if (ok_chars_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (cancel_chars != NULL) {
cancel_chars_copy = OPENSSL_strdup(cancel_chars);
if (cancel_chars_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
ok_chars_copy, cancel_chars_copy, 1,
UIT_BOOLEAN, flags, result_buf);
err:
OPENSSL_free(prompt_copy);
OPENSSL_free(action_desc_copy);
OPENSSL_free(ok_chars_copy);
OPENSSL_free(cancel_chars_copy);
return -1;
}
crypto/ui/ui_lib.c:303: error: NULL_DEREFERENCE
pointer `cancel_chars_copy` last assigned on line 269 could be null and is dereferenced by call to `general_allocate_boolean()` at line 303, column 12.
Showing all 46 steps of the trace
crypto/ui/ui_lib.c:262:1: start of procedure UI_dup_input_boolean()
260. }
261.
262. > int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
263. const char *ok_chars, const char *cancel_chars,
264. int flags, char *result_buf)
crypto/ui/ui_lib.c:266:5:
264. int flags, char *result_buf)
265. {
266. > char *prompt_copy = NULL;
267. char *action_desc_copy = NULL;
268. char *ok_chars_copy = NULL;
crypto/ui/ui_lib.c:267:5:
265. {
266. char *prompt_copy = NULL;
267. > char *action_desc_copy = NULL;
268. char *ok_chars_copy = NULL;
269. char *cancel_chars_copy = NULL;
crypto/ui/ui_lib.c:268:5:
266. char *prompt_copy = NULL;
267. char *action_desc_copy = NULL;
268. > char *ok_chars_copy = NULL;
269. char *cancel_chars_copy = NULL;
270.
crypto/ui/ui_lib.c:269:5:
267. char *action_desc_copy = NULL;
268. char *ok_chars_copy = NULL;
269. > char *cancel_chars_copy = NULL;
270.
271. if (prompt != NULL) {
crypto/ui/ui_lib.c:271:9: Taking true branch
269. char *cancel_chars_copy = NULL;
270.
271. if (prompt != NULL) {
^
272. prompt_copy = OPENSSL_strdup(prompt);
273. if (prompt_copy == NULL) {
crypto/ui/ui_lib.c:272:9:
270.
271. if (prompt != NULL) {
272. > prompt_copy = OPENSSL_strdup(prompt);
273. if (prompt_copy == NULL) {
274. UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
crypto/o_str.c:15:1: start of procedure CRYPTO_strdup()
13. #include "internal/cryptlib.h"
14.
15. > char *CRYPTO_strdup(const char *str, const char* file, int line)
16. {
17. char *ret;
crypto/o_str.c:19:9: Taking false branch
17. char *ret;
18.
19. if (str == NULL)
^
20. return NULL;
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:21:5:
19. if (str == NULL)
20. return NULL;
21. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
23. strcpy(ret, str);
providers/fips/fipsprov.c:458:1: start of procedure CRYPTO_malloc()
456. }
457.
458. > void *CRYPTO_malloc(size_t num, const char *file, int line)
459. {
460. return c_CRYPTO_malloc(num, file, line);
providers/fips/fipsprov.c:460:5: Skipping __function_pointer__(): unresolved function pointer
458. void *CRYPTO_malloc(size_t num, const char *file, int line)
459. {
460. return c_CRYPTO_malloc(num, file, line);
^
461. }
462.
providers/fips/fipsprov.c:461:1: return from a call to CRYPTO_malloc
459. {
460. return c_CRYPTO_malloc(num, file, line);
461. > }
462.
463. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:22:9: Taking true branch
20. return NULL;
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
^
23. strcpy(ret, str);
24. return ret;
crypto/o_str.c:23:9:
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
23. > strcpy(ret, str);
24. return ret;
25. }
crypto/o_str.c:24:5:
22. if (ret != NULL)
23. strcpy(ret, str);
24. > return ret;
25. }
26.
crypto/o_str.c:25:1: return from a call to CRYPTO_strdup
23. strcpy(ret, str);
24. return ret;
25. > }
26.
27. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/ui/ui_lib.c:273:13: Taking false branch
271. if (prompt != NULL) {
272. prompt_copy = OPENSSL_strdup(prompt);
273. if (prompt_copy == NULL) {
^
274. UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
275. goto err;
crypto/ui/ui_lib.c:279:9: Taking true branch
277. }
278.
279. if (action_desc != NULL) {
^
280. action_desc_copy = OPENSSL_strdup(action_desc);
281. if (action_desc_copy == NULL) {
crypto/ui/ui_lib.c:280:9:
278.
279. if (action_desc != NULL) {
280. > action_desc_copy = OPENSSL_strdup(action_desc);
281. if (action_desc_copy == NULL) {
282. UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
crypto/o_str.c:15:1: start of procedure CRYPTO_strdup()
13. #include "internal/cryptlib.h"
14.
15. > char *CRYPTO_strdup(const char *str, const char* file, int line)
16. {
17. char *ret;
crypto/o_str.c:19:9: Taking false branch
17. char *ret;
18.
19. if (str == NULL)
^
20. return NULL;
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:21:5:
19. if (str == NULL)
20. return NULL;
21. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
23. strcpy(ret, str);
providers/fips/fipsprov.c:458:1: start of procedure CRYPTO_malloc()
456. }
457.
458. > void *CRYPTO_malloc(size_t num, const char *file, int line)
459. {
460. return c_CRYPTO_malloc(num, file, line);
providers/fips/fipsprov.c:460:5: Skipping __function_pointer__(): unresolved function pointer
458. void *CRYPTO_malloc(size_t num, const char *file, int line)
459. {
460. return c_CRYPTO_malloc(num, file, line);
^
461. }
462.
providers/fips/fipsprov.c:461:1: return from a call to CRYPTO_malloc
459. {
460. return c_CRYPTO_malloc(num, file, line);
461. > }
462.
463. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:22:9: Taking true branch
20. return NULL;
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
^
23. strcpy(ret, str);
24. return ret;
crypto/o_str.c:23:9:
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
23. > strcpy(ret, str);
24. return ret;
25. }
crypto/o_str.c:24:5:
22. if (ret != NULL)
23. strcpy(ret, str);
24. > return ret;
25. }
26.
crypto/o_str.c:25:1: return from a call to CRYPTO_strdup
23. strcpy(ret, str);
24. return ret;
25. > }
26.
27. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/ui/ui_lib.c:281:13: Taking false branch
279. if (action_desc != NULL) {
280. action_desc_copy = OPENSSL_strdup(action_desc);
281. if (action_desc_copy == NULL) {
^
282. UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
283. goto err;
crypto/ui/ui_lib.c:287:9: Taking true branch
285. }
286.
287. if (ok_chars != NULL) {
^
288. ok_chars_copy = OPENSSL_strdup(ok_chars);
289. if (ok_chars_copy == NULL) {
crypto/ui/ui_lib.c:288:9:
286.
287. if (ok_chars != NULL) {
288. > ok_chars_copy = OPENSSL_strdup(ok_chars);
289. if (ok_chars_copy == NULL) {
290. UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
crypto/o_str.c:15:1: start of procedure CRYPTO_strdup()
13. #include "internal/cryptlib.h"
14.
15. > char *CRYPTO_strdup(const char *str, const char* file, int line)
16. {
17. char *ret;
crypto/o_str.c:19:9: Taking false branch
17. char *ret;
18.
19. if (str == NULL)
^
20. return NULL;
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:21:5:
19. if (str == NULL)
20. return NULL;
21. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
23. strcpy(ret, str);
providers/fips/fipsprov.c:458:1: start of procedure CRYPTO_malloc()
456. }
457.
458. > void *CRYPTO_malloc(size_t num, const char *file, int line)
459. {
460. return c_CRYPTO_malloc(num, file, line);
providers/fips/fipsprov.c:460:5: Skipping __function_pointer__(): unresolved function pointer
458. void *CRYPTO_malloc(size_t num, const char *file, int line)
459. {
460. return c_CRYPTO_malloc(num, file, line);
^
461. }
462.
providers/fips/fipsprov.c:461:1: return from a call to CRYPTO_malloc
459. {
460. return c_CRYPTO_malloc(num, file, line);
461. > }
462.
463. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:22:9: Taking true branch
20. return NULL;
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
^
23. strcpy(ret, str);
24. return ret;
crypto/o_str.c:23:9:
21. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
22. if (ret != NULL)
23. > strcpy(ret, str);
24. return ret;
25. }
crypto/o_str.c:24:5:
22. if (ret != NULL)
23. strcpy(ret, str);
24. > return ret;
25. }
26.
crypto/o_str.c:25:1: return from a call to CRYPTO_strdup
23. strcpy(ret, str);
24. return ret;
25. > }
26.
27. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/ui/ui_lib.c:289:13: Taking false branch
287. if (ok_chars != NULL) {
288. ok_chars_copy = OPENSSL_strdup(ok_chars);
289. if (ok_chars_copy == NULL) {
^
290. UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
291. goto err;
crypto/ui/ui_lib.c:295:9: Taking false branch
293. }
294.
295. if (cancel_chars != NULL) {
^
296. cancel_chars_copy = OPENSSL_strdup(cancel_chars);
297. if (cancel_chars_copy == NULL) {
crypto/ui/ui_lib.c:303:5:
301. }
302.
303. > return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
304. ok_chars_copy, cancel_chars_copy, 1,
305. UIT_BOOLEAN, flags, result_buf);
|
https://github.com/openssl/openssl/blob/c3612970465d0a13f2fc5b47bc28ca18516a699d/crypto/ui/ui_lib.c/#L303
|
d2a_code_trace_data_44055
|
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
return 1;
}
ssl/statem/statem_srvr.c:1548: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_memcpy`.
Showing all 12 steps of the trace
ssl/statem/statem_srvr.c:1543:10: Call
1541. size_t sl, len;
1542.
1543. if (!WPACKET_put_bytes_u16(pkt, s->version)
^
1544. /*
1545. * Random stuff. Filling of the server_random takes place in
ssl/packet.c:261:1: Parameter `pkt->buf->length`
259. }
260.
261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
262. {
263. unsigned char *data;
ssl/statem/statem_srvr.c:1548:17: Call
1546. * tls_process_client_hello()
1547. */
1548. || !WPACKET_memcpy(pkt, s->s3->server_random, SSL3_RANDOM_SIZE)) {
^
1549. SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
1550. goto err;
ssl/packet.c:302:1: Parameter `pkt->written`
300. }
301.
302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
303. {
304. unsigned char *dest;
ssl/packet.c:309:10: Call
307. return 1;
308.
309. if (!WPACKET_allocate_bytes(pkt, len, &dest))
^
310. return 0;
311.
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:36:1: <LHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `pkt->buf->length`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: <RHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `len`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_memcpy`
44. return 0;
45.
46. if (pkt->buf->length - pkt->written < len) {
^
47. size_t newlen;
48. size_t reflen;
|
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/packet.c/#L46
|
d2a_code_trace_data_44056
|
void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
{
SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
ff_formats_ref, formats);
}
libavfilter/formats.c:391: error: Memory Leak
memory dynamically allocated by call to `ff_formats_ref()` at line 391, column 5 is not reachable after line 391, column 5.
libavfilter/formats.c:389:1: start of procedure ff_set_common_formats()
387. * freed.
388. */
389. void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
^
390. {
391. SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
libavfilter/formats.c:391:5: Loop condition is true. Entering loop body
389. void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
390. {
391. SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
^
392. ff_formats_ref, formats);
393. }
libavfilter/formats.c:391:5: Taking true branch
389. void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
390. {
391. SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
^
392. ff_formats_ref, formats);
393. }
libavfilter/formats.c:276:1: start of procedure ff_formats_ref()
274. }
275.
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
^
277. {
278. FORMATS_REF(f, ref);
libavfilter/formats.c:278:5:
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
277. {
278. FORMATS_REF(f, ref);
^
279. }
280.
libavutil/mem.c:117:1: start of procedure av_realloc()
115. }
116.
117. void *av_realloc(void *ptr, size_t size)
^
118. {
119. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:124:9: Taking false branch
122.
123. /* let's disallow possibly ambiguous cases */
124. if (size > (INT_MAX - 16))
^
125. return NULL;
126.
libavutil/mem.c:136:5:
134. return _aligned_realloc(ptr, size, 32);
135. #else
136. return realloc(ptr, size);
^
137. #endif
138. }
libavutil/mem.c:138:1: return from a call to av_realloc
136. return realloc(ptr, size);
137. #endif
138. }
^
139.
140. int av_reallocp(void *ptr, size_t size)
libavfilter/formats.c:278:5: Taking false branch
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
277. {
278. FORMATS_REF(f, ref);
^
279. }
280.
libavfilter/formats.c:278:5: Loop condition is false. Leaving loop
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
277. {
278. FORMATS_REF(f, ref);
^
279. }
280.
libavfilter/formats.c:279:1: return from a call to ff_formats_ref
277. {
278. FORMATS_REF(f, ref);
279. }
^
280.
281. #define FIND_REF_INDEX(ref, idx) \
libavfilter/formats.c:391:5: Loop condition is true. Entering loop body
389. void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
390. {
391. SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
^
392. ff_formats_ref, formats);
393. }
libavfilter/formats.c:391:5: Taking true branch
389. void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
390. {
391. SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
^
392. ff_formats_ref, formats);
393. }
libavfilter/formats.c:276:1: start of procedure ff_formats_ref()
274. }
275.
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
^
277. {
278. FORMATS_REF(f, ref);
libavfilter/formats.c:278:5:
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
277. {
278. FORMATS_REF(f, ref);
^
279. }
280.
libavutil/mem.c:117:1: start of procedure av_realloc()
115. }
116.
117. void *av_realloc(void *ptr, size_t size)
^
118. {
119. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:124:9: Taking true branch
122.
123. /* let's disallow possibly ambiguous cases */
124. if (size > (INT_MAX - 16))
^
125. return NULL;
126.
libavutil/mem.c:125:9:
123. /* let's disallow possibly ambiguous cases */
124. if (size > (INT_MAX - 16))
125. return NULL;
^
126.
127. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:138:1: return from a call to av_realloc
136. return realloc(ptr, size);
137. #endif
138. }
^
139.
140. int av_reallocp(void *ptr, size_t size)
libavfilter/formats.c:278:5: Taking true branch
276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
277. {
278. FORMATS_REF(f, ref);
^
279. }
280.
libavfilter/formats.c:279:1: return from a call to ff_formats_ref
277. {
278. FORMATS_REF(f, ref);
279. }
^
280.
281. #define FIND_REF_INDEX(ref, idx) \
|
https://github.com/libav/libav/blob/83847cc8fa97e0fc637a0962bafb837acdb6eacc/libavfilter/formats.c/#L391
|
d2a_code_trace_data_44057
|
static int opt_preset(const char *opt, const char *arg)
{
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
char *codec_name = *opt == 'v' ? video_codec_name :
*opt == 'a' ? audio_codec_name :
subtitle_codec_name;
if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
fprintf(stderr, "File for preset '%s' not found\n", arg);
ffmpeg_exit(1);
}
while(!feof(f)){
int e= fscanf(f, "%999[^\n]\n", line) - 1;
if(line[0] == '#' && !e)
continue;
e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
if(e){
fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
ffmpeg_exit(1);
}
if(!strcmp(tmp, "acodec")){
opt_audio_codec(tmp2);
}else if(!strcmp(tmp, "vcodec")){
opt_video_codec(tmp2);
}else if(!strcmp(tmp, "scodec")){
opt_subtitle_codec(tmp2);
}else if(!strcmp(tmp, "dcodec")){
opt_data_codec(tmp2);
}else if(opt_default(tmp, tmp2) < 0){
fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
ffmpeg_exit(1);
}
}
fclose(f);
return 0;
}
ffmpeg.c:4194: error: Null Dereference
pointer `f` last assigned on line 4189 could be null and is dereferenced by call to `feof()` at line 4194, column 12.
ffmpeg.c:4181:1: start of procedure opt_preset()
4179. }
4180.
4181. static int opt_preset(const char *opt, const char *arg)
^
4182. {
4183. FILE *f=NULL;
ffmpeg.c:4183:5:
4181. static int opt_preset(const char *opt, const char *arg)
4182. {
4183. FILE *f=NULL;
^
4184. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4185. char *codec_name = *opt == 'v' ? video_codec_name :
ffmpeg.c:4185:24: Condition is false
4183. FILE *f=NULL;
4184. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4185. char *codec_name = *opt == 'v' ? video_codec_name :
^
4186. *opt == 'a' ? audio_codec_name :
4187. subtitle_codec_name;
ffmpeg.c:4186:24: Condition is false
4184. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4185. char *codec_name = *opt == 'v' ? video_codec_name :
4186. *opt == 'a' ? audio_codec_name :
^
4187. subtitle_codec_name;
4188.
ffmpeg.c:4185:24:
4183. FILE *f=NULL;
4184. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4185. char *codec_name = *opt == 'v' ? video_codec_name :
^
4186. *opt == 'a' ? audio_codec_name :
4187. subtitle_codec_name;
ffmpeg.c:4185:5:
4183. FILE *f=NULL;
4184. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4185. char *codec_name = *opt == 'v' ? video_codec_name :
^
4186. *opt == 'a' ? audio_codec_name :
4187. subtitle_codec_name;
ffmpeg.c:4189:64: Condition is false
4187. subtitle_codec_name;
4188.
4189. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4190. fprintf(stderr, "File for preset '%s' not found\n", arg);
4191. ffmpeg_exit(1);
ffmpeg.c:4189:11: Taking true branch
4187. subtitle_codec_name;
4188.
4189. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4190. fprintf(stderr, "File for preset '%s' not found\n", arg);
4191. ffmpeg_exit(1);
ffmpeg.c:4190:9:
4188.
4189. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4190. fprintf(stderr, "File for preset '%s' not found\n", arg);
^
4191. ffmpeg_exit(1);
4192. }
ffmpeg.c:4191:9: Skipping ffmpeg_exit(): empty list of specs
4189. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4190. fprintf(stderr, "File for preset '%s' not found\n", arg);
4191. ffmpeg_exit(1);
^
4192. }
4193.
ffmpeg.c:4194:12:
4192. }
4193.
4194. while(!feof(f)){
^
4195. int e= fscanf(f, "%999[^\n]\n", line) - 1;
4196. if(line[0] == '#' && !e)
|
https://github.com/libav/libav/blob/5da116a3fde9013846bd7b385cdde5ce2951869c/ffmpeg.c/#L4194
|
d2a_code_trace_data_44058
|
static int do_multi(int multi)
{
int n;
int fd[2];
int *fds;
static char sep[] = ":";
fds = malloc(sizeof(*fds) * multi);
for (n = 0; n < multi; ++n) {
if (pipe(fd) == -1) {
BIO_printf(bio_err, "pipe failure\n");
exit(1);
}
fflush(stdout);
(void)BIO_flush(bio_err);
if (fork()) {
close(fd[1]);
fds[n] = fd[0];
} else {
close(fd[0]);
close(1);
if (dup(fd[1]) == -1) {
BIO_printf(bio_err, "dup failed\n");
exit(1);
}
close(fd[1]);
mr = 1;
usertime = 0;
free(fds);
return 0;
}
printf("Forked child %d\n", n);
}
for (n = 0; n < multi; ++n) {
FILE *f;
char buf[1024];
char *p;
f = fdopen(fds[n], "r");
while (fgets(buf, sizeof buf, f)) {
p = strchr(buf, '\n');
if (p)
*p = '\0';
if (buf[0] != '+') {
BIO_printf(bio_err, "Don't understand line '%s' from child %d\n",
buf, n);
continue;
}
printf("Got: %s from %d\n", buf, n);
if (strncmp(buf, "+F:", 3) == 0) {
int alg;
int j;
p = buf + 3;
alg = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
for (j = 0; j < SIZE_NUM; ++j)
results[alg][j] += atof(sstrsep(&p, sep));
} else if (strncmp(buf, "+F2:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
if (n)
rsa_results[k][0] = 1 / (1 / rsa_results[k][0] + 1 / d);
else
rsa_results[k][0] = d;
d = atof(sstrsep(&p, sep));
if (n)
rsa_results[k][1] = 1 / (1 / rsa_results[k][1] + 1 / d);
else
rsa_results[k][1] = d;
}
# ifndef OPENSSL_NO_DSA
else if (strncmp(buf, "+F3:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
if (n)
dsa_results[k][0] = 1 / (1 / dsa_results[k][0] + 1 / d);
else
dsa_results[k][0] = d;
d = atof(sstrsep(&p, sep));
if (n)
dsa_results[k][1] = 1 / (1 / dsa_results[k][1] + 1 / d);
else
dsa_results[k][1] = d;
}
# endif
# ifndef OPENSSL_NO_EC
else if (strncmp(buf, "+F4:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
if (n)
ecdsa_results[k][0] =
1 / (1 / ecdsa_results[k][0] + 1 / d);
else
ecdsa_results[k][0] = d;
d = atof(sstrsep(&p, sep));
if (n)
ecdsa_results[k][1] =
1 / (1 / ecdsa_results[k][1] + 1 / d);
else
ecdsa_results[k][1] = d;
} else if (strncmp(buf, "+F5:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
if (n)
ecdh_results[k][0] = 1 / (1 / ecdh_results[k][0] + 1 / d);
else
ecdh_results[k][0] = d;
}
# endif
else if (strncmp(buf, "+H:", 3) == 0) {
;
} else
BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n);
}
fclose(f);
}
free(fds);
return 1;
}
apps/speed.c:2916: error: NULL_DEREFERENCE
pointer `fds` last assigned on line 2906 could be null and is dereferenced at line 2916, column 13.
Showing all 19 steps of the trace
apps/speed.c:2899:1: start of procedure do_multi()
2897. }
2898.
2899. > static int do_multi(int multi)
2900. {
2901. int n;
apps/speed.c:2904:5:
2902. int fd[2];
2903. int *fds;
2904. > static char sep[] = ":";
2905.
2906. fds = malloc(sizeof(*fds) * multi);
apps/speed.c:2906:5:
2904. static char sep[] = ":";
2905.
2906. > fds = malloc(sizeof(*fds) * multi);
2907. for (n = 0; n < multi; ++n) {
2908. if (pipe(fd) == -1) {
apps/speed.c:2907:10:
2905.
2906. fds = malloc(sizeof(*fds) * multi);
2907. > for (n = 0; n < multi; ++n) {
2908. if (pipe(fd) == -1) {
2909. BIO_printf(bio_err, "pipe failure\n");
apps/speed.c:2907:17: Loop condition is true. Entering loop body
2905.
2906. fds = malloc(sizeof(*fds) * multi);
2907. for (n = 0; n < multi; ++n) {
^
2908. if (pipe(fd) == -1) {
2909. BIO_printf(bio_err, "pipe failure\n");
apps/speed.c:2908:13: Taking false branch
2906. fds = malloc(sizeof(*fds) * multi);
2907. for (n = 0; n < multi; ++n) {
2908. if (pipe(fd) == -1) {
^
2909. BIO_printf(bio_err, "pipe failure\n");
2910. exit(1);
apps/speed.c:2912:9:
2910. exit(1);
2911. }
2912. > fflush(stdout);
2913. (void)BIO_flush(bio_err);
2914. if (fork()) {
apps/speed.c:2913:15:
2911. }
2912. fflush(stdout);
2913. > (void)BIO_flush(bio_err);
2914. if (fork()) {
2915. close(fd[1]);
crypto/bio/bio_lib.c:327:1: start of procedure BIO_ctrl()
325. }
326.
327. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
328. {
329. long ret;
crypto/bio/bio_lib.c:332:9: Taking false branch
330. long (*cb) (BIO *, int, const char *, int, long, long);
331.
332. if (b == NULL)
^
333. return (0);
334.
crypto/bio/bio_lib.c:335:10: Taking false branch
333. return (0);
334.
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
337. return (-2);
crypto/bio/bio_lib.c:335:33: Taking true branch
333. return (0);
334.
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
337. return (-2);
crypto/bio/bio_lib.c:336:9: Skipping ERR_put_error(): empty list of specs
334.
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
^
337. return (-2);
338. }
crypto/bio/bio_lib.c:337:9:
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
337. > return (-2);
338. }
339.
crypto/bio/bio_lib.c:351:1: return from a call to BIO_ctrl
349. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
350. return (ret);
351. > }
352.
353. long BIO_callback_ctrl(BIO *b, int cmd,
apps/speed.c:2913:9:
2911. }
2912. fflush(stdout);
2913. > (void)BIO_flush(bio_err);
2914. if (fork()) {
2915. close(fd[1]);
apps/speed.c:2914:13: Taking true branch
2912. fflush(stdout);
2913. (void)BIO_flush(bio_err);
2914. if (fork()) {
^
2915. close(fd[1]);
2916. fds[n] = fd[0];
apps/speed.c:2915:13:
2913. (void)BIO_flush(bio_err);
2914. if (fork()) {
2915. > close(fd[1]);
2916. fds[n] = fd[0];
2917. } else {
apps/speed.c:2916:13:
2914. if (fork()) {
2915. close(fd[1]);
2916. > fds[n] = fd[0];
2917. } else {
2918. close(fd[0]);
|
https://github.com/openssl/openssl/blob/fb2141c773ab0c5dfc78cc97d2445362b8048389/apps/speed.c/#L2916
|
d2a_code_trace_data_44059
|
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:1164: error: Uninitialized Value
The value read from xmax was never initialized.
libavcodec/motion_est_template.c:1164:9:
1162. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
1163. }else{
1164. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
^
1165. //FIXME try some early stop
1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1164
|
d2a_code_trace_data_44060
|
static int read_uncompressed_sgi(unsigned char* out_buf, uint8_t* out_end,
const uint8_t *in_buf, const uint8_t *in_end, SgiState* s)
{
int x, y, z;
const uint8_t *ptr;
unsigned int offset = s->height * s->width;
if (offset * s->depth > in_end - in_buf) {
return -1;
}
for (y = s->height - 1; y >= 0; y--) {
out_end = out_buf + (y * s->linesize);
for (x = s->width; x > 0; x--) {
ptr = in_buf++;
for(z = 0; z < s->depth; z ++) {
bytestream_put_byte(&out_end, *ptr);
ptr += offset;
}
}
}
return 0;
}
libavcodec/sgidec.c:226: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `read_uncompressed_sgi`.
libavcodec/sgidec.c:175:17: Call
173. dimension = bytestream_get_be16(&in_buf);
174. s->width = bytestream_get_be16(&in_buf);
175. s->height = bytestream_get_be16(&in_buf);
^
176. s->depth = bytestream_get_be16(&in_buf);
177.
libavcodec/bytestream.h:49:1: Parameter `**b`
47. DEF (be32, 4, AV_RB32, AV_WB32)
48. DEF (be24, 3, AV_RB24, AV_WB24)
49. DEF (be16, 2, AV_RB16, AV_WB16)
^
50. DEF (byte, 1, AV_RB8 , AV_WB8 )
51.
libavcodec/bytestream.h:49:1: Assignment
47. DEF (be32, 4, AV_RB32, AV_WB32)
48. DEF (be24, 3, AV_RB24, AV_WB24)
49. DEF (be16, 2, AV_RB16, AV_WB16)
^
50. DEF (byte, 1, AV_RB8 , AV_WB8 )
51.
libavcodec/sgidec.c:175:5: Assignment
173. dimension = bytestream_get_be16(&in_buf);
174. s->width = bytestream_get_be16(&in_buf);
175. s->height = bytestream_get_be16(&in_buf);
^
176. s->depth = bytestream_get_be16(&in_buf);
177.
libavcodec/sgidec.c:226:15: Call
224. ret = read_rle_sgi(out_end, in_buf, in_end, s);
225. } else {
226. ret = read_uncompressed_sgi(out_buf, out_end, in_buf, in_end, s);
^
227. }
228.
libavcodec/sgidec.c:123:1: <LHS trace>
121. * @return 0 if read success, otherwise return -1.
122. */
123. static int read_uncompressed_sgi(unsigned char* out_buf, uint8_t* out_end,
^
124. const uint8_t *in_buf, const uint8_t *in_end, SgiState* s)
125. {
libavcodec/sgidec.c:123:1: Parameter `s->height`
121. * @return 0 if read success, otherwise return -1.
122. */
123. static int read_uncompressed_sgi(unsigned char* out_buf, uint8_t* out_end,
^
124. const uint8_t *in_buf, const uint8_t *in_end, SgiState* s)
125. {
libavcodec/sgidec.c:135:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `read_uncompressed_sgi`
133. }
134.
135. for (y = s->height - 1; y >= 0; y--) {
^
136. out_end = out_buf + (y * s->linesize);
137. for (x = s->width; x > 0; x--) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/sgidec.c/#L135
|
d2a_code_trace_data_44061
|
static int unix_open(URLContext *h, const char *filename, int flags)
{
UnixContext *s = h->priv_data;
int fd, ret;
av_strstart(filename, "unix:", &filename);
s->addr.sun_family = AF_UNIX;
av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));
if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)
return ff_neterrno();
if (s->listen) {
fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr,
sizeof(s->addr), s->timeout, h);
if (fd < 0) {
ret = fd;
goto fail;
}
} else {
ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr,
sizeof(s->addr), s->timeout, h);
if (ret < 0)
goto fail;
}
s->fd = fd;
return 0;
fail:
if (s->listen && ret != EADDRINUSE)
unlink(s->addr.sun_path);
if (fd >= 0)
closesocket(fd);
return ret;
}
libavformat/unix.c:78: error: Resource Leak
resource acquired by call to `ff_socket()` at line 74, column 15 is not released after line 78, column 9.
libavformat/unix.c:65:1: start of procedure unix_open()
63. };
64.
65. static int unix_open(URLContext *h, const char *filename, int flags)
^
66. {
67. UnixContext *s = h->priv_data;
libavformat/unix.c:67:5:
65. static int unix_open(URLContext *h, const char *filename, int flags)
66. {
67. UnixContext *s = h->priv_data;
^
68. int fd, ret;
69.
libavformat/unix.c:70:5: Skipping av_strstart(): empty list of specs
68. int fd, ret;
69.
70. av_strstart(filename, "unix:", &filename);
^
71. s->addr.sun_family = AF_UNIX;
72. av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));
libavformat/unix.c:71:5:
69.
70. av_strstart(filename, "unix:", &filename);
71. s->addr.sun_family = AF_UNIX;
^
72. av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));
73.
libavformat/unix.c:72:5:
70. av_strstart(filename, "unix:", &filename);
71. s->addr.sun_family = AF_UNIX;
72. av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));
^
73.
74. if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)
libavutil/avstring.c:81:1: start of procedure av_strlcpy()
79. }
80.
81. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
82. {
83. size_t len = 0;
libavutil/avstring.c:83:5:
81. size_t av_strlcpy(char *dst, const char *src, size_t size)
82. {
83. size_t len = 0;
^
84. while (++len < size && *src)
85. *dst++ = *src++;
libavutil/avstring.c:84:12: Loop condition is true. Entering loop body
82. {
83. size_t len = 0;
84. while (++len < size && *src)
^
85. *dst++ = *src++;
86. if (len <= size)
libavutil/avstring.c:84:28: Loop condition is false. Leaving loop
82. {
83. size_t len = 0;
84. while (++len < size && *src)
^
85. *dst++ = *src++;
86. if (len <= size)
libavutil/avstring.c:86:9: Taking true branch
84. while (++len < size && *src)
85. *dst++ = *src++;
86. if (len <= size)
^
87. *dst = 0;
88. return len + strlen(src) - 1;
libavutil/avstring.c:87:9:
85. *dst++ = *src++;
86. if (len <= size)
87. *dst = 0;
^
88. return len + strlen(src) - 1;
89. }
libavutil/avstring.c:88:5:
86. if (len <= size)
87. *dst = 0;
88. return len + strlen(src) - 1;
^
89. }
90.
libavutil/avstring.c:89:1: return from a call to av_strlcpy
87. *dst = 0;
88. return len + strlen(src) - 1;
89. }
^
90.
91. size_t av_strlcat(char *dst, const char *src, size_t size)
libavformat/unix.c:74:9:
72. av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));
73.
74. if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)
^
75. return ff_neterrno();
76.
libavformat/network.h:253:1: start of procedure ff_socket()
251. #endif
252.
253. static inline int ff_socket(int domain, int type, int protocol)
^
254. {
255. return socket(domain, type | SOCK_CLOEXEC, protocol);
libavformat/network.h:255:5:
253. static inline int ff_socket(int domain, int type, int protocol)
254. {
255. return socket(domain, type | SOCK_CLOEXEC, protocol);
^
256. }
257.
libavformat/network.h:256:1: return from a call to ff_socket
254. {
255. return socket(domain, type | SOCK_CLOEXEC, protocol);
256. }
^
257.
258. #endif /* AVFORMAT_NETWORK_H */
libavformat/unix.c:74:9: Taking false branch
72. av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));
73.
74. if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)
^
75. return ff_neterrno();
76.
libavformat/unix.c:77:9: Taking true branch
75. return ff_neterrno();
76.
77. if (s->listen) {
^
78. fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr,
79. sizeof(s->addr), s->timeout, h);
libavformat/unix.c:78:9:
76.
77. if (s->listen) {
78. fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr,
^
79. sizeof(s->addr), s->timeout, h);
80. if (fd < 0) {
libavformat/network.c:213:1: start of procedure ff_listen_bind()
211. }
212.
213. int ff_listen_bind(int fd, const struct sockaddr *addr,
^
214. socklen_t addrlen, int timeout, URLContext *h)
215. {
libavformat/network.c:217:5:
215. {
216. int ret;
217. int reuse = 1;
^
218. struct pollfd lp = { fd, POLLIN, 0 };
219. setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
libavformat/network.c:218:5:
216. int ret;
217. int reuse = 1;
218. struct pollfd lp = { fd, POLLIN, 0 };
^
219. setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
220. ret = bind(fd, addr, addrlen);
libavformat/network.c:219:5: Skipping setsockopt(): method has no implementation
217. int reuse = 1;
218. struct pollfd lp = { fd, POLLIN, 0 };
219. setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
^
220. ret = bind(fd, addr, addrlen);
221. if (ret)
libavformat/network.c:220:5: Skipping bind(): method has no implementation
218. struct pollfd lp = { fd, POLLIN, 0 };
219. setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
220. ret = bind(fd, addr, addrlen);
^
221. if (ret)
222. return ff_neterrno();
libavformat/network.c:221:9: Taking false branch
219. setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
220. ret = bind(fd, addr, addrlen);
221. if (ret)
^
222. return ff_neterrno();
223.
libavformat/network.c:224:5: Skipping listen(): method has no implementation
222. return ff_neterrno();
223.
224. ret = listen(fd, 1);
^
225. if (ret)
226. return ff_neterrno();
libavformat/network.c:225:9: Taking false branch
223.
224. ret = listen(fd, 1);
225. if (ret)
^
226. return ff_neterrno();
227.
libavformat/network.c:228:5:
226. return ff_neterrno();
227.
228. ret = ff_poll_interrupt(&lp, 1, timeout, &h->interrupt_callback);
^
229. if (ret < 0)
230. return ret;
libavformat/network.c:192:1: start of procedure ff_poll_interrupt()
190. }
191.
192. static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
^
193. AVIOInterruptCB *cb)
194. {
libavformat/network.c:195:5:
193. AVIOInterruptCB *cb)
194. {
195. int runs = timeout / POLLING_TIME;
^
196. int ret = 0;
197.
libavformat/network.c:196:5:
194. {
195. int runs = timeout / POLLING_TIME;
196. int ret = 0;
^
197.
198. do {
libavformat/network.c:199:13:
197.
198. do {
199. if (ff_check_interrupt(cb))
^
200. return AVERROR_EXIT;
201. ret = poll(p, nfds, POLLING_TIME);
libavformat/avio.c:369:1: start of procedure ff_check_interrupt()
367. }
368.
369. int ff_check_interrupt(AVIOInterruptCB *cb)
^
370. {
371. int ret;
libavformat/avio.c:372:9: Taking true branch
370. {
371. int ret;
372. if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
^
373. return ret;
374. return 0;
libavformat/avio.c:372:15: Taking true branch
370. {
371. int ret;
372. if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
^
373. return ret;
374. return 0;
libavformat/avio.c:372:32: Taking false branch
370. {
371. int ret;
372. if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
^
373. return ret;
374. return 0;
libavformat/avio.c:374:5:
372. if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
373. return ret;
374. return 0;
^
375. }
libavformat/avio.c:375:1: return from a call to ff_check_interrupt
373. return ret;
374. return 0;
375. }
^
libavformat/network.c:199:13: Taking false branch
197.
198. do {
199. if (ff_check_interrupt(cb))
^
200. return AVERROR_EXIT;
201. ret = poll(p, nfds, POLLING_TIME);
libavformat/network.c:201:9: Skipping poll(): method has no implementation
199. if (ff_check_interrupt(cb))
200. return AVERROR_EXIT;
201. ret = poll(p, nfds, POLLING_TIME);
^
202. if (ret != 0)
203. break;
libavformat/network.c:202:13: Taking true branch
200. return AVERROR_EXIT;
201. ret = poll(p, nfds, POLLING_TIME);
202. if (ret != 0)
^
203. break;
204. } while (timeout < 0 || runs-- > 0);
libavformat/network.c:206:10: Taking false branch
204. } while (timeout < 0 || runs-- > 0);
205.
206. if (!ret)
^
207. return AVERROR(ETIMEDOUT);
208. if (ret < 0)
libavformat/network.c:208:9: Taking true branch
206. if (!ret)
207. return AVERROR(ETIMEDOUT);
208. if (ret < 0)
^
209. return AVERROR(errno);
210. return ret;
libavformat/network.c:209:9:
207. return AVERROR(ETIMEDOUT);
208. if (ret < 0)
209. return AVERROR(errno);
^
210. return ret;
211. }
libavformat/network.c:211:1: return from a call to ff_poll_interrupt
209. return AVERROR(errno);
210. return ret;
211. }
^
212.
213. int ff_listen_bind(int fd, const struct sockaddr *addr,
libavformat/network.c:229:9: Taking true branch
227.
228. ret = ff_poll_interrupt(&lp, 1, timeout, &h->interrupt_callback);
229. if (ret < 0)
^
230. return ret;
231.
libavformat/network.c:230:9:
228. ret = ff_poll_interrupt(&lp, 1, timeout, &h->interrupt_callback);
229. if (ret < 0)
230. return ret;
^
231.
232. ret = accept(fd, NULL, NULL);
libavformat/network.c:240:1: return from a call to ff_listen_bind
238. ff_socket_nonblock(ret, 1);
239. return ret;
240. }
^
241.
242. int ff_listen_connect(int fd, const struct sockaddr *addr,
|
https://github.com/libav/libav/blob/43bacd5b7d3d265a77cd29d8abb131057796aecc/libavformat/unix.c/#L78
|
d2a_code_trace_data_44062
|
static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){
RMContext *rm = s->priv_data;
ByteIOContext *pb = s->pb;
int len, num, res, i;
AVStream *st;
uint32_t state=0xFFFFFFFF;
while(!url_feof(pb)){
*pos= url_ftell(pb);
if(rm->remaining_len > 0){
num= rm->current_stream;
len= rm->remaining_len;
*timestamp = AV_NOPTS_VALUE;
*flags= 0;
}else{
state= (state<<8) + get_byte(pb);
if(state == MKBETAG('I', 'N', 'D', 'X')){
len = get_be16(pb) - 6;
if(len<0)
continue;
goto skip;
}
if(state > (unsigned)0xFFFF || state < 12)
continue;
len=state;
state= 0xFFFFFFFF;
num = get_be16(pb);
*timestamp = get_be32(pb);
res= get_byte(pb);
*flags = get_byte(pb);
len -= 12;
}
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (num == st->id)
break;
}
if (i == s->nb_streams) {
skip:
url_fskip(pb, len);
rm->remaining_len -= len;
continue;
}
*stream_index= i;
return len;
}
return -1;
}
libavformat/rmdec.c:411: error: Integer Overflow L1
([1099511627520, +oo] + [0, +oo]):unsigned32.
libavformat/rmdec.c:401:5: <LHS trace>
399. int len, num, res, i;
400. AVStream *st;
401. uint32_t state=0xFFFFFFFF;
^
402.
403. while(!url_feof(pb)){
libavformat/rmdec.c:401:5: Assignment
399. int len, num, res, i;
400. AVStream *st;
401. uint32_t state=0xFFFFFFFF;
^
402.
403. while(!url_feof(pb)){
libavformat/rmdec.c:411:33: <RHS trace>
409. *flags= 0;
410. }else{
411. state= (state<<8) + get_byte(pb);
^
412.
413. if(state == MKBETAG('I', 'N', 'D', 'X')){
libavformat/rmdec.c:411:33: Call
409. *flags= 0;
410. }else{
411. state= (state<<8) + get_byte(pb);
^
412.
413. if(state == MKBETAG('I', 'N', 'D', 'X')){
libavformat/aviobuf.c:348:13: Assignment
346. return *s->buf_ptr++;
347. else
348. return 0;
^
349. }
350. }
libavformat/rmdec.c:411:13: Binary operation: ([1099511627520, +oo] + [0, +oo]):unsigned32
409. *flags= 0;
410. }else{
411. state= (state<<8) + get_byte(pb);
^
412.
413. if(state == MKBETAG('I', 'N', 'D', 'X')){
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/rmdec.c/#L411
|
d2a_code_trace_data_44063
|
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{
int max, min, dif;
BN_ULONG t1, t2, borrow, *rp;
const BN_ULONG *ap, *bp;
bn_check_top(a);
bn_check_top(b);
max = a->top;
min = b->top;
dif = max - min;
if (dif < 0) {
BNerr(BN_F_BN_USUB, BN_R_ARG2_LT_ARG3);
return 0;
}
if (bn_wexpand(r, max) == NULL)
return 0;
ap = a->d;
bp = b->d;
rp = r->d;
borrow = bn_sub_words(rp, ap, bp, min);
ap += min;
rp += min;
while (dif) {
dif--;
t1 = *(ap++);
t2 = (t1 - borrow) & BN_MASK2;
*(rp++) = t2;
borrow &= (t1 == 0);
}
while (max && *--rp == 0)
max--;
r->top = max;
r->neg = 0;
bn_pollute(r);
return 1;
}
crypto/sm2/sm2_sign.c:135: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_add`.
Showing all 10 steps of the trace
crypto/sm2/sm2_sign.c:135:28: Call
133. continue;
134.
135. if (!BN_add(s, dA, BN_value_one())
^
136. || !BN_mod_inverse(s, s, order, ctx)
137. || !BN_mod_mul(tmp, dA, r, order, ctx)
crypto/bn/bn_lib.c:84:9: Assignment
82. static const BN_ULONG data_one = 1L;
83. static const BIGNUM const_one =
84. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
^
85.
86. return &const_one;
crypto/sm2/sm2_sign.c:135:14: Call
133. continue;
134.
135. if (!BN_add(s, dA, BN_value_one())
^
136. || !BN_mod_inverse(s, s, order, ctx)
137. || !BN_mod_mul(tmp, dA, r, order, ctx)
crypto/bn/bn_add.c:14:1: Parameter `b->top`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:28:19: Call
26. if (cmp_res > 0) {
27. r_neg = a->neg;
28. ret = BN_usub(r, a, b);
^
29. } else if (cmp_res < 0) {
30. r_neg = b->neg;
crypto/bn/bn_add.c:125:1: <Length trace>
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/bn/bn_add.c:125:1: Parameter `b->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/bn/bn_add.c:135:5: Assignment
133.
134. max = a->top;
135. min = b->top;
^
136. dif = max - min;
137.
crypto/bn/bn_add.c:152:5: Assignment
150. borrow = bn_sub_words(rp, ap, bp, min);
151. ap += min;
152. rp += min;
^
153.
154. while (dif) {
crypto/bn/bn_add.c:158:9: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_add`
156. t1 = *(ap++);
157. t2 = (t1 - borrow) & BN_MASK2;
158. *(rp++) = t2;
^
159. borrow &= (t1 == 0);
160. }
|
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_add.c/#L158
|
d2a_code_trace_data_44064
|
static int do_multi(int multi, int size_num)
{
int n;
int fd[2];
int *fds;
static char sep[] = ":";
fds = malloc(sizeof(*fds) * multi);
for (n = 0; n < multi; ++n) {
if (pipe(fd) == -1) {
BIO_printf(bio_err, "pipe failure\n");
exit(1);
}
fflush(stdout);
(void)BIO_flush(bio_err);
if (fork()) {
close(fd[1]);
fds[n] = fd[0];
} else {
close(fd[0]);
close(1);
if (dup(fd[1]) == -1) {
BIO_printf(bio_err, "dup failed\n");
exit(1);
}
close(fd[1]);
mr = 1;
usertime = 0;
free(fds);
return 0;
}
printf("Forked child %d\n", n);
}
for (n = 0; n < multi; ++n) {
FILE *f;
char buf[1024];
char *p;
f = fdopen(fds[n], "r");
while (fgets(buf, sizeof(buf), f)) {
p = strchr(buf, '\n');
if (p)
*p = '\0';
if (buf[0] != '+') {
BIO_printf(bio_err,
"Don't understand line '%s' from child %d\n", buf,
n);
continue;
}
printf("Got: %s from %d\n", buf, n);
if (strncmp(buf, "+F:", 3) == 0) {
int alg;
int j;
p = buf + 3;
alg = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
for (j = 0; j < size_num; ++j)
results[alg][j] += atof(sstrsep(&p, sep));
} else if (strncmp(buf, "+F2:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
rsa_results[k][0] += d;
d = atof(sstrsep(&p, sep));
rsa_results[k][1] += d;
}
# ifndef OPENSSL_NO_DSA
else if (strncmp(buf, "+F3:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
dsa_results[k][0] += d;
d = atof(sstrsep(&p, sep));
dsa_results[k][1] += d;
}
# endif
# ifndef OPENSSL_NO_EC
else if (strncmp(buf, "+F4:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
ecdsa_results[k][0] += d;
d = atof(sstrsep(&p, sep));
ecdsa_results[k][1] += d;
} else if (strncmp(buf, "+F5:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
ecdh_results[k][0] += d;
}
# endif
else if (strncmp(buf, "+H:", 3) == 0) {
;
} else
BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf,
n);
}
fclose(f);
}
free(fds);
return 1;
}
apps/speed.c:3135: error: NULL_DEREFERENCE
pointer `fds` last assigned on line 3125 could be null and is dereferenced at line 3135, column 13.
Showing all 19 steps of the trace
apps/speed.c:3118:1: start of procedure do_multi()
3116. }
3117.
3118. > static int do_multi(int multi, int size_num)
3119. {
3120. int n;
apps/speed.c:3123:5:
3121. int fd[2];
3122. int *fds;
3123. > static char sep[] = ":";
3124.
3125. fds = malloc(sizeof(*fds) * multi);
apps/speed.c:3125:5:
3123. static char sep[] = ":";
3124.
3125. > fds = malloc(sizeof(*fds) * multi);
3126. for (n = 0; n < multi; ++n) {
3127. if (pipe(fd) == -1) {
apps/speed.c:3126:10:
3124.
3125. fds = malloc(sizeof(*fds) * multi);
3126. > for (n = 0; n < multi; ++n) {
3127. if (pipe(fd) == -1) {
3128. BIO_printf(bio_err, "pipe failure\n");
apps/speed.c:3126:17: Loop condition is true. Entering loop body
3124.
3125. fds = malloc(sizeof(*fds) * multi);
3126. for (n = 0; n < multi; ++n) {
^
3127. if (pipe(fd) == -1) {
3128. BIO_printf(bio_err, "pipe failure\n");
apps/speed.c:3127:13: Taking false branch
3125. fds = malloc(sizeof(*fds) * multi);
3126. for (n = 0; n < multi; ++n) {
3127. if (pipe(fd) == -1) {
^
3128. BIO_printf(bio_err, "pipe failure\n");
3129. exit(1);
apps/speed.c:3131:9:
3129. exit(1);
3130. }
3131. > fflush(stdout);
3132. (void)BIO_flush(bio_err);
3133. if (fork()) {
apps/speed.c:3132:15:
3130. }
3131. fflush(stdout);
3132. > (void)BIO_flush(bio_err);
3133. if (fork()) {
3134. close(fd[1]);
crypto/bio/bio_lib.c:511:1: start of procedure BIO_ctrl()
509. }
510.
511. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
512. {
513. long ret;
crypto/bio/bio_lib.c:515:9: Taking false branch
513. long ret;
514.
515. if (b == NULL)
^
516. return 0;
517.
crypto/bio/bio_lib.c:518:10: Taking false branch
516. return 0;
517.
518. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
519. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
520. return -2;
crypto/bio/bio_lib.c:518:33: Taking true branch
516. return 0;
517.
518. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
519. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
520. return -2;
crypto/bio/bio_lib.c:519:9: Skipping ERR_put_error(): empty list of specs
517.
518. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
519. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
^
520. return -2;
521. }
crypto/bio/bio_lib.c:520:9:
518. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
519. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
520. > return -2;
521. }
522.
crypto/bio/bio_lib.c:536:1: return from a call to BIO_ctrl
534.
535. return ret;
536. > }
537.
538. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
apps/speed.c:3132:9:
3130. }
3131. fflush(stdout);
3132. > (void)BIO_flush(bio_err);
3133. if (fork()) {
3134. close(fd[1]);
apps/speed.c:3133:13: Taking true branch
3131. fflush(stdout);
3132. (void)BIO_flush(bio_err);
3133. if (fork()) {
^
3134. close(fd[1]);
3135. fds[n] = fd[0];
apps/speed.c:3134:13:
3132. (void)BIO_flush(bio_err);
3133. if (fork()) {
3134. > close(fd[1]);
3135. fds[n] = fd[0];
3136. } else {
apps/speed.c:3135:13:
3133. if (fork()) {
3134. close(fd[1]);
3135. > fds[n] = fd[0];
3136. } else {
3137. close(fd[0]);
|
https://github.com/openssl/openssl/blob/dab2cd68e7cc304c9b1a4e7cee18a98711771a53/apps/speed.c/#L3135
|
d2a_code_trace_data_44065
|
static int encode_thread(AVCodecContext *c, void *arg){
MpegEncContext *s= arg;
int mb_x, mb_y, pdif = 0;
int i, j;
MpegEncContext best_s, backup_s;
uint8_t bit_buf[2][MAX_MB_BYTES];
uint8_t bit_buf2[2][MAX_MB_BYTES];
uint8_t bit_buf_tex[2][MAX_MB_BYTES];
PutBitContext pb[2], pb2[2], tex_pb[2];
ff_check_alignment();
for(i=0; i<2; i++){
init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES);
init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES);
init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES);
}
s->last_bits= put_bits_count(&s->pb);
s->mv_bits=0;
s->misc_bits=0;
s->i_tex_bits=0;
s->p_tex_bits=0;
s->i_count=0;
s->f_count=0;
s->b_count=0;
s->skip_count=0;
for(i=0; i<3; i++){
s->last_dc[i] = 128 << s->intra_dc_precision;
s->current_picture.error[i] = 0;
}
s->mb_skip_run = 0;
memset(s->last_mv, 0, sizeof(s->last_mv));
s->last_mv_dir = 0;
switch(s->codec_id){
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_FLV1:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER)
s->gob_index = ff_h263_get_gob_height(s);
break;
case CODEC_ID_MPEG4:
if(ENABLE_MPEG4_ENCODER && s->partitioned_frame)
ff_mpeg4_init_partitions(s);
break;
}
s->resync_mb_x=0;
s->resync_mb_y=0;
s->first_slice_line = 1;
s->ptr_lastgob = s->pb.buf;
for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
s->mb_x=0;
s->mb_y= mb_y;
ff_set_qscale(s, s->qscale);
ff_init_block_index(s);
for(mb_x=0; mb_x < s->mb_width; mb_x++) {
int xy= mb_y*s->mb_stride + mb_x;
int mb_type= s->mb_type[xy];
int dmin= INT_MAX;
int dir;
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
if(s->data_partitioning){
if( s->pb2 .buf_end - s->pb2 .buf - (put_bits_count(&s-> pb2)>>3) < MAX_MB_BYTES
|| s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
}
s->mb_x = mb_x;
s->mb_y = mb_y;
ff_update_block_index(s);
if(ENABLE_H261_ENCODER && s->codec_id == CODEC_ID_H261){
ff_h261_reorder_mb_index(s);
xy= s->mb_y*s->mb_stride + s->mb_x;
mb_type= s->mb_type[xy];
}
if(s->rtp_mode){
int current_packet_size, is_gob_start;
current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0;
if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
switch(s->codec_id){
case CODEC_ID_H263:
case CODEC_ID_H263P:
if(!s->h263_slice_structured)
if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0;
break;
case CODEC_ID_MPEG2VIDEO:
if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1;
case CODEC_ID_MPEG1VIDEO:
if(s->mb_skip_run) is_gob_start=0;
break;
}
if(is_gob_start){
if(s->start_mb_y != mb_y || mb_x!=0){
write_slice_end(s);
if(ENABLE_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){
ff_mpeg4_init_partitions(s);
}
}
assert((put_bits_count(&s->pb)&7) == 0);
current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob;
if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){
int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y;
int d= 100 / s->avctx->error_rate;
if(r % d == 0){
current_packet_size=0;
#ifndef ALT_BITSTREAM_WRITER
s->pb.buf_ptr= s->ptr_lastgob;
#endif
assert(pbBufPtr(&s->pb) == s->ptr_lastgob);
}
}
if (s->avctx->rtp_callback){
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x;
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb);
}
switch(s->codec_id){
case CODEC_ID_MPEG4:
if (ENABLE_MPEG4_ENCODER) {
ff_mpeg4_encode_video_packet_header(s);
ff_mpeg4_clean_buffers(s);
}
break;
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) {
ff_mpeg1_encode_slice_header(s);
ff_mpeg1_clean_buffers(s);
}
break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER)
h263_encode_gob_header(s, mb_y);
break;
}
if(s->flags&CODEC_FLAG_PASS1){
int bits= put_bits_count(&s->pb);
s->misc_bits+= bits - s->last_bits;
s->last_bits= bits;
}
s->ptr_lastgob += current_packet_size;
s->first_slice_line=1;
s->resync_mb_x=mb_x;
s->resync_mb_y=mb_y;
}
}
if( (s->resync_mb_x == s->mb_x)
&& s->resync_mb_y+1 == s->mb_y){
s->first_slice_line=0;
}
s->mb_skipped=0;
s->dquant=0;
if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){
int next_block=0;
int pb_bits_count, pb2_bits_count, tex_pb_bits_count;
copy_context_before_encode(&backup_s, s, -1);
backup_s.pb= s->pb;
best_s.data_partitioning= s->data_partitioning;
best_s.partitioned_frame= s->partitioned_frame;
if(s->data_partitioning){
backup_s.pb2= s->pb2;
backup_s.tex_pb= s->tex_pb;
}
if(mb_type&CANDIDATE_MB_TYPE_INTER){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = s->p_mv_table[xy][0];
s->mv[0][0][1] = s->p_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_INTER_I){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->p_field_select_table[i][xy];
s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_INTER4V){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_8X8;
s->mb_intra= 0;
for(i=0; i<4; i++){
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_FORWARD){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){
s->mv_dir = MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[1][0][0] = s->b_back_mv_table[xy][0];
s->mv[1][0][1] = s->b_back_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_BIDIR){
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){
s->mv_dir = MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(dir=0; dir<2; dir++){
for(i=0; i<2; i++){
j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
}
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_INTRA){
s->mv_dir = 0;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 1;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
if(s->h263_pred || s->h263_aic){
if(best_s.mb_intra)
s->mbintra_table[mb_x + mb_y*s->mb_stride]=1;
else
ff_clean_intra_table_entries(s);
}
}
if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){
if(best_s.mv_type==MV_TYPE_16X16){
const int last_qp= backup_s.qscale;
int qpi, qp, dc[6];
DCTELEM ac[6][16];
const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0;
static const int dquant_tab[4]={-1,1,-2,2};
assert(backup_s.dquant == 0);
s->mv_dir= best_s.mv_dir;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= best_s.mb_intra;
s->mv[0][0][0] = best_s.mv[0][0][0];
s->mv[0][0][1] = best_s.mv[0][0][1];
s->mv[1][0][0] = best_s.mv[1][0][0];
s->mv[1][0][1] = best_s.mv[1][0][1];
qpi = s->pict_type == FF_B_TYPE ? 2 : 0;
for(; qpi<4; qpi++){
int dquant= dquant_tab[qpi];
qp= last_qp + dquant;
if(qp < s->avctx->qmin || qp > s->avctx->qmax)
continue;
backup_s.dquant= dquant;
if(s->mb_intra && s->dc_val[0]){
for(i=0; i<6; i++){
dc[i]= s->dc_val[0][ s->block_index[i] ];
memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16);
}
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb,
&dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]);
if(best_s.qscale != qp){
if(s->mb_intra && s->dc_val[0]){
for(i=0; i<6; i++){
s->dc_val[0][ s->block_index[i] ]= dc[i];
memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16);
}
}
}
}
}
}
if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){
int mx= s->b_direct_mv_table[xy][0];
int my= s->b_direct_mv_table[xy][1];
backup_s.dquant = 0;
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
s->mb_intra= 0;
ff_mpeg4_set_direct_mv(s, mx, my);
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, mx, my);
}
if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){
backup_s.dquant = 0;
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
s->mb_intra= 0;
ff_mpeg4_set_direct_mv(s, 0, 0);
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){
int coded=0;
for(i=0; i<6; i++)
coded |= s->block_last_index[i];
if(coded){
int mx,my;
memcpy(s->mv, best_s.mv, sizeof(s->mv));
if(ENABLE_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){
mx=my=0;
ff_mpeg4_set_direct_mv(s, mx, my);
}else if(best_s.mv_dir&MV_DIR_BACKWARD){
mx= s->mv[1][0][0];
my= s->mv[1][0][1];
}else{
mx= s->mv[0][0][0];
my= s->mv[0][0][1];
}
s->mv_dir= best_s.mv_dir;
s->mv_type = best_s.mv_type;
s->mb_intra= 0;
backup_s.dquant= 0;
s->skipdct=1;
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb,
&dmin, &next_block, mx, my);
s->skipdct=0;
}
}
s->current_picture.qscale_table[xy]= best_s.qscale;
copy_context_after_encode(s, &best_s, -1);
pb_bits_count= put_bits_count(&s->pb);
flush_put_bits(&s->pb);
ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count);
s->pb= backup_s.pb;
if(s->data_partitioning){
pb2_bits_count= put_bits_count(&s->pb2);
flush_put_bits(&s->pb2);
ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count);
s->pb2= backup_s.pb2;
tex_pb_bits_count= put_bits_count(&s->tex_pb);
flush_put_bits(&s->tex_pb);
ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count);
s->tex_pb= backup_s.tex_pb;
}
s->last_bits= put_bits_count(&s->pb);
if (ENABLE_ANY_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE)
ff_h263_update_motion_val(s);
if(next_block==0){
s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16);
s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8);
s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8);
}
if(s->avctx->mb_decision == FF_MB_DECISION_BITS)
MPV_decode_mb(s, s->block);
} else {
int motion_x = 0, motion_y = 0;
s->mv_type=MV_TYPE_16X16;
switch(mb_type){
case CANDIDATE_MB_TYPE_INTRA:
s->mv_dir = 0;
s->mb_intra= 1;
motion_x= s->mv[0][0][0] = 0;
motion_y= s->mv[0][0][1] = 0;
break;
case CANDIDATE_MB_TYPE_INTER:
s->mv_dir = MV_DIR_FORWARD;
s->mb_intra= 0;
motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0];
motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_INTER_I:
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->p_field_select_table[i][xy];
s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
}
break;
case CANDIDATE_MB_TYPE_INTER4V:
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_8X8;
s->mb_intra= 0;
for(i=0; i<4; i++){
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
}
break;
case CANDIDATE_MB_TYPE_DIRECT:
if (ENABLE_MPEG4_ENCODER) {
s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT;
s->mb_intra= 0;
motion_x=s->b_direct_mv_table[xy][0];
motion_y=s->b_direct_mv_table[xy][1];
ff_mpeg4_set_direct_mv(s, motion_x, motion_y);
}
break;
case CANDIDATE_MB_TYPE_DIRECT0:
if (ENABLE_MPEG4_ENCODER) {
s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT;
s->mb_intra= 0;
ff_mpeg4_set_direct_mv(s, 0, 0);
}
break;
case CANDIDATE_MB_TYPE_BIDIR:
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mb_intra= 0;
s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_BACKWARD:
s->mv_dir = MV_DIR_BACKWARD;
s->mb_intra= 0;
motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0];
motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_FORWARD:
s->mv_dir = MV_DIR_FORWARD;
s->mb_intra= 0;
motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_FORWARD_I:
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
}
break;
case CANDIDATE_MB_TYPE_BACKWARD_I:
s->mv_dir = MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
}
break;
case CANDIDATE_MB_TYPE_BIDIR_I:
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(dir=0; dir<2; dir++){
for(i=0; i<2; i++){
j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
}
}
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n");
}
encode_mb(s, motion_x, motion_y);
s->last_mv_dir = s->mv_dir;
if (ENABLE_ANY_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE)
ff_h263_update_motion_val(s);
MPV_decode_mb(s, s->block);
}
if(s->mb_intra ){
s->p_mv_table[xy][0]=0;
s->p_mv_table[xy][1]=0;
}
if(s->flags&CODEC_FLAG_PSNR){
int w= 16;
int h= 16;
if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
s->current_picture.error[0] += sse(
s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
s->dest[0], w, h, s->linesize);
s->current_picture.error[1] += sse(
s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,
s->dest[1], w>>1, h>>1, s->uvlinesize);
s->current_picture.error[2] += sse(
s, s->new_picture .data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,
s->dest[2], w>>1, h>>1, s->uvlinesize);
}
if(s->loop_filter){
if(ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263)
ff_h263_loop_filter(s);
}
}
}
if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE)
msmpeg4_encode_ext_header(s);
write_slice_end(s);
if (s->avctx->rtp_callback) {
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
pdif = pbBufPtr(&s->pb) - s->ptr_lastgob;
emms_c();
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
}
return 0;
}
libavcodec/mpegvideo_enc.c:2334: error: Uninitialized Value
The value read from best_s.mv_type was never initialized.
libavcodec/mpegvideo_enc.c:2334:24:
2332.
2333. if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){
2334. if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD
^
2335. const int last_qp= backup_s.qscale;
2336. int qpi, qp, dc[6];
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L2334
|
d2a_code_trace_data_44066
|
static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){
if(block->type & BLOCK_INTRA){
int x, y;
const int color = block->color[plane_index];
const int color4= color*0x01010101;
if(b_w==32){
for(y=0; y < b_h; y++){
*(uint32_t*)&dst[0 + y*stride]= color4;
*(uint32_t*)&dst[4 + y*stride]= color4;
*(uint32_t*)&dst[8 + y*stride]= color4;
*(uint32_t*)&dst[12+ y*stride]= color4;
*(uint32_t*)&dst[16+ y*stride]= color4;
*(uint32_t*)&dst[20+ y*stride]= color4;
*(uint32_t*)&dst[24+ y*stride]= color4;
*(uint32_t*)&dst[28+ y*stride]= color4;
}
}else if(b_w==16){
for(y=0; y < b_h; y++){
*(uint32_t*)&dst[0 + y*stride]= color4;
*(uint32_t*)&dst[4 + y*stride]= color4;
*(uint32_t*)&dst[8 + y*stride]= color4;
*(uint32_t*)&dst[12+ y*stride]= color4;
}
}else if(b_w==8){
for(y=0; y < b_h; y++){
*(uint32_t*)&dst[0 + y*stride]= color4;
*(uint32_t*)&dst[4 + y*stride]= color4;
}
}else if(b_w==4){
for(y=0; y < b_h; y++){
*(uint32_t*)&dst[0 + y*stride]= color4;
}
}else{
for(y=0; y < b_h; y++){
for(x=0; x < b_w; x++){
dst[x + y*stride]= color;
}
}
}
}else{
uint8_t *src= s->last_picture[block->ref].data[plane_index];
const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
int mx= block->mx*scale;
int my= block->my*scale;
const int dx= mx&15;
const int dy= my&15;
const int tab_index= 3 - (b_w>>2) + (b_w>>4);
sx += (mx>>4) - (HTAPS_MAX/2-1);
sy += (my>>4) - (HTAPS_MAX/2-1);
src += sx + sy*stride;
if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
|| (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
src= tmp + MB_SIZE;
}
assert(b_w>1 && b_h>1);
assert((tab_index>=0 && tab_index<4) || b_w==32);
if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc )
mc_block(&s->plane[plane_index], dst, src, tmp, stride, b_w, b_h, dx, dy);
else if(b_w==32){
int y;
for(y=0; y<b_h; y+=16){
s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride, src + 3 + (y+3)*stride,stride);
s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 + y*stride, src + 19 + (y+3)*stride,stride);
}
}else if(b_w==b_h)
s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src + 3 + 3*stride,stride);
else if(b_w==2*b_h){
s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst ,src + 3 + 3*stride,stride);
s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h + 3*stride,stride);
}else{
assert(2*b_w==b_h);
s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst ,src + 3 + 3*stride ,stride);
s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride);
}
}
}
libavcodec/snow.c:2370: error: Buffer Overrun L2
Offset: [0, 18] Size: 16.
libavcodec/snow.c:2302:1: <Offset trace>
2300. mca( 8, 8,8)
2301.
2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){
^
2303. if(block->type & BLOCK_INTRA){
2304. int x, y;
libavcodec/snow.c:2302:1: Parameter `s->mv_scale`
2300. mca( 8, 8,8)
2301.
2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){
^
2303. if(block->type & BLOCK_INTRA){
2304. int x, y;
libavcodec/snow.c:2343:26: Assignment
2341. }else{
2342. uint8_t *src= s->last_picture[block->ref].data[plane_index];
2343. const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
^
2344. int mx= block->mx*scale;
2345. int my= block->my*scale;
libavcodec/snow.c:2343:9: Assignment
2341. }else{
2342. uint8_t *src= s->last_picture[block->ref].data[plane_index];
2343. const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
^
2344. int mx= block->mx*scale;
2345. int my= block->my*scale;
libavcodec/snow.c:2344:9: Assignment
2342. uint8_t *src= s->last_picture[block->ref].data[plane_index];
2343. const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
2344. int mx= block->mx*scale;
^
2345. int my= block->my*scale;
2346. const int dx= mx&15;
libavcodec/snow.c:2346:9: Assignment
2344. int mx= block->mx*scale;
2345. int my= block->my*scale;
2346. const int dx= mx&15;
^
2347. const int dy= my&15;
2348. const int tab_index= 3 - (b_w>>2) + (b_w>>4);
libavcodec/snow.c:2302:1: <Length trace>
2300. mca( 8, 8,8)
2301.
2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){
^
2303. if(block->type & BLOCK_INTRA){
2304. int x, y;
libavcodec/snow.c:2302:1: Parameter `s->dsp.put_h264_qpel_pixels_tab[*][*]`
2300. mca( 8, 8,8)
2301.
2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){
^
2303. if(block->type & BLOCK_INTRA){
2304. int x, y;
libavcodec/snow.c:2370:13: Array access: Offset: [0, 18] Size: 16
2368. }
2369. }else if(b_w==b_h)
2370. s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src + 3 + 3*stride,stride);
^
2371. else if(b_w==2*b_h){
2372. s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst ,src + 3 + 3*stride,stride);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/snow.c/#L2370
|
d2a_code_trace_data_44067
|
static int opt_streamid(const char *opt, const char *arg)
{
int idx;
char *p;
char idx_str[16];
strncpy(idx_str, arg, sizeof(idx_str));
idx_str[sizeof(idx_str)-1] = '\0';
p = strchr(idx_str, ':');
if (!p) {
fprintf(stderr,
"Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
arg, opt);
ffmpeg_exit(1);
}
*p++ = '\0';
idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
return 0;
}
ffmpeg.c:3679: error: Null Dereference
pointer `p` last assigned on line 3679 could be null and is dereferenced at line 3679, column 5.
ffmpeg.c:3664:1: start of procedure opt_streamid()
3662.
3663. /* arg format is "output-stream-index:streamid-value". */
3664. static int opt_streamid(const char *opt, const char *arg)
^
3665. {
3666. int idx;
ffmpeg.c:3670:5:
3668. char idx_str[16];
3669.
3670. strncpy(idx_str, arg, sizeof(idx_str));
^
3671. idx_str[sizeof(idx_str)-1] = '\0';
3672. p = strchr(idx_str, ':');
ffmpeg.c:3671:5:
3669.
3670. strncpy(idx_str, arg, sizeof(idx_str));
3671. idx_str[sizeof(idx_str)-1] = '\0';
^
3672. p = strchr(idx_str, ':');
3673. if (!p) {
ffmpeg.c:3672:5:
3670. strncpy(idx_str, arg, sizeof(idx_str));
3671. idx_str[sizeof(idx_str)-1] = '\0';
3672. p = strchr(idx_str, ':');
^
3673. if (!p) {
3674. fprintf(stderr,
ffmpeg.c:3673:10: Taking true branch
3671. idx_str[sizeof(idx_str)-1] = '\0';
3672. p = strchr(idx_str, ':');
3673. if (!p) {
^
3674. fprintf(stderr,
3675. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
ffmpeg.c:3674:9:
3672. p = strchr(idx_str, ':');
3673. if (!p) {
3674. fprintf(stderr,
^
3675. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3676. arg, opt);
ffmpeg.c:3677:9: Skipping ffmpeg_exit(): empty list of specs
3675. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3676. arg, opt);
3677. ffmpeg_exit(1);
^
3678. }
3679. *p++ = '\0';
ffmpeg.c:3679:5:
3677. ffmpeg_exit(1);
3678. }
3679. *p++ = '\0';
^
3680. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3681. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
|
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L3679
|
d2a_code_trace_data_44068
|
DECLAREcpFunc(cpSeparate2ContigByRow)
{
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 (row = 0; row < imagelength; row++) {
for (s = 0; s < spp; s++) {
if (TIFFReadScanline(in, inbuf, row, s) < 0
&& !ignore) {
TIFFError(TIFFFileName(in),
"Error, can't read scanline %lu",
(unsigned long) row);
goto bad;
}
inp = (uint8*)inbuf;
outp = ((uint8*)outbuf) + s;
for (n = imagewidth; n-- > 0;) {
*outp = *inp++;
outp += spp;
}
}
if (TIFFWriteScanline(out, outbuf, row, 0) < 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:1115: error: Memory Leak
memory dynamically allocated by call to `_TIFFmalloc()` at line 1114, column 11 is not reachable after line 1115, column 7.
tools/tiffcp.c:1102:1: start of procedure cpSeparate2ContigByRow()
1100. * Separate -> contig by row.
1101. */
1102. DECLAREcpFunc(cpSeparate2ContigByRow)
^
1103. {
1104. tsize_t scanlinesizein = TIFFScanlineSize(in);
tools/tiffcp.c:1104:2:
1102. DECLAREcpFunc(cpSeparate2ContigByRow)
1103. {
1104. tsize_t scanlinesizein = TIFFScanlineSize(in);
^
1105. tsize_t scanlinesizeout = TIFFScanlineSize(out);
1106. 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:1105:2:
1103. {
1104. tsize_t scanlinesizein = TIFFScanlineSize(in);
1105. tsize_t scanlinesizeout = TIFFScanlineSize(out);
^
1106. tdata_t inbuf;
1107. 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:1113:2:
1111. tsample_t s;
1112.
1113. inbuf = _TIFFmalloc(scanlinesizein);
^
1114. outbuf = _TIFFmalloc(scanlinesizeout);
1115. 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:1114:2:
1112.
1113. inbuf = _TIFFmalloc(scanlinesizein);
1114. outbuf = _TIFFmalloc(scanlinesizeout);
^
1115. if (!inbuf || !outbuf)
1116. 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:1115:7: Taking true branch
1113. inbuf = _TIFFmalloc(scanlinesizein);
1114. outbuf = _TIFFmalloc(scanlinesizeout);
1115. if (!inbuf || !outbuf)
^
1116. return 0;
1117. _TIFFmemset(inbuf, 0, scanlinesizein);
|
https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiffcp.c/#L1115
|
d2a_code_trace_data_44069
|
static int mtu_test(SSL_CTX *ctx, const char *cs, int no_etm)
{
SSL *srvr_ssl = NULL, *clnt_ssl = NULL;
BIO *sc_bio = NULL;
int i;
size_t s;
size_t mtus[30];
unsigned char buf[600];
int rv = 0;
memset(buf, 0x5a, sizeof(buf));
if (create_ssl_objects(ctx, ctx, &srvr_ssl, &clnt_ssl, NULL, NULL) != 1)
goto out;
if (no_etm)
SSL_set_options(srvr_ssl, SSL_OP_NO_ENCRYPT_THEN_MAC);
if (SSL_set_cipher_list(srvr_ssl, cs) != 1 ||
SSL_set_cipher_list(clnt_ssl, cs) != 1) {
ERR_print_errors_fp(stdout);
goto out;
}
sc_bio = SSL_get_rbio(srvr_ssl);
if (create_ssl_connection(clnt_ssl, srvr_ssl) != 1)
goto out;
if (debug)
printf("Channel established\n");
for (i = 0; i < 30; i++) {
SSL_set_mtu(clnt_ssl, 500 + i);
mtus[i] = DTLS_get_data_mtu(clnt_ssl);
if (debug)
printf("%s%s payload MTU for record mtu %d = %"OSSLzu"\n",
cs, no_etm ? "-noEtM":"", 500 + i, mtus[i]);
if (mtus[i] == 0) {
fprintf(stderr,
"payload MTU failed with record MTU %d for %s\n",
500 + i, cs);
goto out;
}
}
SSL_set_mtu(clnt_ssl, 1000);
for (s = mtus[0]; s <= mtus[29]; s++) {
size_t reclen;
if (SSL_write(clnt_ssl, buf, s) != (int)s) {
ERR_print_errors_fp(stdout);
goto out;
}
reclen = BIO_read(sc_bio, buf, sizeof(buf));
if (debug)
printf("record %"OSSLzu" for payload %"OSSLzu"\n", reclen, s);
for (i = 0; i < 30; i++) {
if (s <= mtus[i] && reclen > (size_t)(500 + i)) {
fprintf(stderr,
"%s: Payload MTU %"OSSLzu" reported for record MTU %d\n"
"but sending a payload of %"OSSLzu" made a record of %"OSSLzu"(too large)\n",
cs, mtus[i], 500 + i, s, reclen);
goto out;
}
if (s > mtus[i] && reclen <= (size_t)(500 + i)) {
fprintf(stderr,
"%s: Payload MTU %"OSSLzu" reported for record MTU %d\n"
"but sending a payload of %"OSSLzu" made a record of %"OSSLzu" (too small)\n",
cs, mtus[i], 500 + i, s, reclen);
goto out;
}
}
}
rv = 1;
if (SSL_USE_ETM(clnt_ssl))
rv = 2;
out:
SSL_free(clnt_ssl);
SSL_free(srvr_ssl);
return rv;
}
test/dtls_mtu_test.c:114: error: UNINITIALIZED_VALUE
The value read from mtus[_] was never initialized.
Showing all 1 steps of the trace
test/dtls_mtu_test.c:114:17:
112. /* DTLS_get_data_mtu() with record MTU 500+i returned mtus[i] ... */
113.
114. > if (s <= mtus[i] && reclen > (size_t)(500 + i)) {
115. /* We sent a packet smaller than or equal to mtus[j] and
116. * that made a record *larger* than the record MTU 500+j! */
|
https://github.com/openssl/openssl/blob/8aefa08cfbc7db7cc10765ee9684090e37983f45/test/dtls_mtu_test.c/#L114
|
d2a_code_trace_data_44070
|
static int cert_status_cb(SSL *s, void *arg)
{
tlsextstatusctx *srctx = arg;
BIO *err = srctx->err;
char *host, *port, *path;
int use_ssl;
unsigned char *rspder = NULL;
int rspderlen;
STACK_OF(OPENSSL_STRING) *aia = NULL;
X509 *x = NULL;
X509_STORE_CTX inctx;
X509_OBJECT obj;
OCSP_REQUEST *req = NULL;
OCSP_RESPONSE *resp = NULL;
OCSP_CERTID *id = NULL;
STACK_OF(X509_EXTENSION) *exts;
int ret = SSL_TLSEXT_ERR_NOACK;
int i;
#if 0
STACK_OF(OCSP_RESPID) *ids;
SSL_get_tlsext_status_ids(s, &ids);
BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids));
#endif
if (srctx->verbose)
BIO_puts(err, "cert_status: callback called\n");
x = SSL_get_certificate(s);
aia = X509_get1_ocsp(x);
if (aia)
{
if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
&host, &port, &path, &use_ssl))
{
BIO_puts(err, "cert_status: can't parse AIA URL\n");
goto err;
}
if (srctx->verbose)
BIO_printf(err, "cert_status: AIA URL: %s\n",
sk_OPENSSL_STRING_value(aia, 0));
}
else
{
if (!srctx->host)
{
BIO_puts(srctx->err, "cert_status: no AIA and no default responder URL\n");
goto done;
}
host = srctx->host;
path = srctx->path;
port = srctx->port;
use_ssl = srctx->use_ssl;
}
if (!X509_STORE_CTX_init(&inctx,
SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)),
NULL, NULL))
goto err;
if (X509_STORE_get_by_subject(&inctx,X509_LU_X509,
X509_get_issuer_name(x),&obj) <= 0)
{
BIO_puts(err, "cert_status: Can't retrieve issuer certificate.\n");
X509_STORE_CTX_cleanup(&inctx);
goto done;
}
req = OCSP_REQUEST_new();
if (!req)
goto err;
id = OCSP_cert_to_id(NULL, x, obj.data.x509);
X509_free(obj.data.x509);
X509_STORE_CTX_cleanup(&inctx);
if (!id)
goto err;
if (!OCSP_request_add0_id(req, id))
goto err;
id = NULL;
SSL_get_tlsext_status_exts(s, &exts);
for (i = 0; i < sk_X509_EXTENSION_num(exts); i++)
{
X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i);
if (!OCSP_REQUEST_add_ext(req, ext, -1))
goto err;
}
resp = process_responder(err, req, host, path, port, use_ssl, NULL,
srctx->timeout);
if (!resp)
{
BIO_puts(err, "cert_status: error querying responder\n");
goto done;
}
rspderlen = i2d_OCSP_RESPONSE(resp, &rspder);
if (rspderlen <= 0)
goto err;
SSL_set_tlsext_status_ocsp_resp(s, rspder, rspderlen);
if (srctx->verbose)
{
BIO_puts(err, "cert_status: ocsp response sent:\n");
OCSP_RESPONSE_print(err, resp, 2);
}
ret = SSL_TLSEXT_ERR_OK;
done:
if (ret != SSL_TLSEXT_ERR_OK)
ERR_print_errors(err);
if (aia)
{
OPENSSL_free(host);
OPENSSL_free(path);
OPENSSL_free(port);
X509_email_free(aia);
}
if (id)
OCSP_CERTID_free(id);
if (req)
OCSP_REQUEST_free(req);
if (resp)
OCSP_RESPONSE_free(resp);
return ret;
err:
ret = SSL_TLSEXT_ERR_ALERT_FATAL;
goto done;
}
apps/s_server.c:745: error: NULL_DEREFERENCE
pointer `x` last assigned on line 744 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 745, column 8.
Showing all 31 steps of the trace
apps/s_server.c:718:1: start of procedure cert_status_cb()
716. */
717.
718. > static int cert_status_cb(SSL *s, void *arg)
719. {
720. tlsextstatusctx *srctx = arg;
apps/s_server.c:720:2:
718. static int cert_status_cb(SSL *s, void *arg)
719. {
720. > tlsextstatusctx *srctx = arg;
721. BIO *err = srctx->err;
722. char *host, *port, *path;
apps/s_server.c:721:2:
719. {
720. tlsextstatusctx *srctx = arg;
721. > BIO *err = srctx->err;
722. char *host, *port, *path;
723. int use_ssl;
apps/s_server.c:724:2:
722. char *host, *port, *path;
723. int use_ssl;
724. > unsigned char *rspder = NULL;
725. int rspderlen;
726. STACK_OF(OPENSSL_STRING) *aia = NULL;
apps/s_server.c:726:2:
724. unsigned char *rspder = NULL;
725. int rspderlen;
726. > STACK_OF(OPENSSL_STRING) *aia = NULL;
727. X509 *x = NULL;
728. X509_STORE_CTX inctx;
apps/s_server.c:727:2:
725. int rspderlen;
726. STACK_OF(OPENSSL_STRING) *aia = NULL;
727. > X509 *x = NULL;
728. X509_STORE_CTX inctx;
729. X509_OBJECT obj;
apps/s_server.c:730:2:
728. X509_STORE_CTX inctx;
729. X509_OBJECT obj;
730. > OCSP_REQUEST *req = NULL;
731. OCSP_RESPONSE *resp = NULL;
732. OCSP_CERTID *id = NULL;
apps/s_server.c:731:2:
729. X509_OBJECT obj;
730. OCSP_REQUEST *req = NULL;
731. > OCSP_RESPONSE *resp = NULL;
732. OCSP_CERTID *id = NULL;
733. STACK_OF(X509_EXTENSION) *exts;
apps/s_server.c:732:2:
730. OCSP_REQUEST *req = NULL;
731. OCSP_RESPONSE *resp = NULL;
732. > OCSP_CERTID *id = NULL;
733. STACK_OF(X509_EXTENSION) *exts;
734. int ret = SSL_TLSEXT_ERR_NOACK;
apps/s_server.c:734:2:
732. OCSP_CERTID *id = NULL;
733. STACK_OF(X509_EXTENSION) *exts;
734. > int ret = SSL_TLSEXT_ERR_NOACK;
735. int i;
736. #if 0
apps/s_server.c:741:6: Taking true branch
739. BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids));
740. #endif
741. if (srctx->verbose)
^
742. BIO_puts(err, "cert_status: callback called\n");
743. /* Build up OCSP query from server certificate */
apps/s_server.c:742:3:
740. #endif
741. if (srctx->verbose)
742. > BIO_puts(err, "cert_status: callback called\n");
743. /* Build up OCSP query from server certificate */
744. x = SSL_get_certificate(s);
crypto/bio/bio_lib.c:257:1: start of procedure BIO_puts()
255. }
256.
257. > int BIO_puts(BIO *b, const char *in)
258. {
259. int i;
crypto/bio/bio_lib.c:262:7: Taking false branch
260. long (*cb)(BIO *,int,const char *,int,long,long);
261.
262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
^
263. {
264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD);
crypto/bio/bio_lib.c:262:22: Taking false branch
260. long (*cb)(BIO *,int,const char *,int,long,long);
261.
262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
^
263. {
264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD);
crypto/bio/bio_lib.c:262:45: Taking false branch
260. long (*cb)(BIO *,int,const char *,int,long,long);
261.
262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
^
263. {
264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD);
crypto/bio/bio_lib.c:268:2:
266. }
267.
268. > cb=b->callback;
269.
270. if ((cb != NULL) &&
crypto/bio/bio_lib.c:270:7: Taking false branch
268. cb=b->callback;
269.
270. if ((cb != NULL) &&
^
271. ((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0))
272. return(i);
crypto/bio/bio_lib.c:274:7: Taking false branch
272. return(i);
273.
274. if (!b->init)
^
275. {
276. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED);
crypto/bio/bio_lib.c:280:2: Skipping __function_pointer__(): unresolved function pointer
278. }
279.
280. i=b->method->bputs(b,in);
^
281.
282. if (i > 0) b->num_write+=(unsigned long)i;
crypto/bio/bio_lib.c:282:6: Taking true branch
280. i=b->method->bputs(b,in);
281.
282. if (i > 0) b->num_write+=(unsigned long)i;
^
283.
284. if (cb != NULL)
crypto/bio/bio_lib.c:282:13:
280. i=b->method->bputs(b,in);
281.
282. > if (i > 0) b->num_write+=(unsigned long)i;
283.
284. if (cb != NULL)
crypto/bio/bio_lib.c:284:6: Taking false branch
282. if (i > 0) b->num_write+=(unsigned long)i;
283.
284. if (cb != NULL)
^
285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0,
286. 0L,(long)i);
crypto/bio/bio_lib.c:287:2:
285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0,
286. 0L,(long)i);
287. > return(i);
288. }
289.
crypto/bio/bio_lib.c:288:2: return from a call to BIO_puts
286. 0L,(long)i);
287. return(i);
288. }
^
289.
290. int BIO_gets(BIO *b, char *in, int inl)
apps/s_server.c:744:2:
742. BIO_puts(err, "cert_status: callback called\n");
743. /* Build up OCSP query from server certificate */
744. > x = SSL_get_certificate(s);
745. aia = X509_get1_ocsp(x);
746. if (aia)
ssl/ssl_lib.c:2740:1: start of procedure SSL_get_certificate()
2738.
2739. /* Fix this function so that it takes an optional type parameter */
2740. > X509 *SSL_get_certificate(const SSL *s)
2741. {
2742. if (s->cert != NULL)
ssl/ssl_lib.c:2742:6: Taking false branch
2740. X509 *SSL_get_certificate(const SSL *s)
2741. {
2742. if (s->cert != NULL)
^
2743. return(s->cert->key->x509);
2744. else
ssl/ssl_lib.c:2745:3:
2743. return(s->cert->key->x509);
2744. else
2745. > return(NULL);
2746. }
2747.
ssl/ssl_lib.c:2746:2: return from a call to SSL_get_certificate
2744. else
2745. return(NULL);
2746. }
^
2747.
2748. /* Fix this function so that it takes an optional type parameter */
apps/s_server.c:745:2:
743. /* Build up OCSP query from server certificate */
744. x = SSL_get_certificate(s);
745. > aia = X509_get1_ocsp(x);
746. if (aia)
747. {
|
https://github.com/openssl/openssl/blob/dd4a0af3701b1669661d62420253ec1e40076e61/apps/s_server.c/#L745
|
d2a_code_trace_data_44071
|
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:1420: error: INTEGER_OVERFLOW_L1
(0 - 1):unsigned64 by call to `SSL_new`.
Showing all 24 steps of the trace
apps/s_client.c:1412:3: Call
1410. SSL_CTX_set_srp_cb_arg(ctx,&srp_arg);
1411. SSL_CTX_set_srp_client_pwd_callback(ctx, ssl_give_srp_client_pwd_cb);
1412. SSL_CTX_set_srp_strength(ctx, srp_arg.strength);
^
1413. if (c_msg || c_debug || srp_arg.amp == 0)
1414. SSL_CTX_set_srp_verify_param_callback(ctx, ssl_srp_verify_param_cb);
ssl/tls_srp.c:507:9: Call
505. int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength)
506. {
507. return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH, strength,
^
508. NULL);
509. }
ssl/s3_lib.c:4087:12: Call
4085. return 0;
4086. }
4087. if ((new=DHparams_dup(dh)) == NULL)
^
4088. {
4089. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_DH_LIB);
crypto/dh/dh_ameth.c:523:8: Call
521. {
522. DH *ret;
523. ret = DH_new();
^
524. if (!ret)
525. return NULL;
crypto/dh/dh_lib.c:104:9: Call
102. DH *DH_new(void)
103. {
104. return DH_new_method(NULL);
^
105. }
106.
crypto/dh/dh_lib.c:131:17: Call
129. }
130. else
131. ret->engine = ENGINE_get_default_DH();
^
132. if(ret->engine)
133. {
crypto/engine/tb_dh.c:104:9: Call
102. ENGINE *ENGINE_get_default_DH(void)
103. {
104. return engine_table_select(&dh_table, dummy_nid);
^
105. }
106.
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:1420:6: Call
1418. #endif
1419.
1420. con=SSL_new(ctx);
^
1421. if (sess_in)
1422. {
ssl/ssl_lib.c:275:1: Parameter `ctx->sessions->num_items`
273. }
274.
275. > SSL *SSL_new(SSL_CTX *ctx)
276. {
277. SSL *s;
ssl/ssl_lib.c:408:2: Call
406. s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1;
407.
408. SSL_clear(s);
^
409.
410. CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);
ssl/ssl_lib.c:185:1: Parameter `s->ctx->sessions->num_items`
183. };
184.
185. > int SSL_clear(SSL *s)
186. {
187.
ssl/ssl_lib.c:194:6: Call
192. }
193.
194. if (ssl_clear_bad_session(s))
^
195. {
196. SSL_SESSION_free(s->session);
ssl/ssl_sess.c:991:1: Parameter `s->ctx->sessions->num_items`
989. }
990.
991. > int ssl_clear_bad_session(SSL *s)
992. {
993. if ( (s->session != NULL) &&
ssl/ssl_sess.c:997:3: Call
995. !(SSL_in_init(s) || SSL_in_before(s)))
996. {
997. SSL_CTX_remove_session(s->ctx,s->session);
^
998. return(1);
999. }
ssl/ssl_sess.c:682:1: Parameter `ctx->sessions->num_items`
680. }
681.
682. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
683. {
684. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:684:9: Call
682. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
683. {
684. return remove_session_lock(ctx, c, 1);
^
685. }
686.
ssl/ssl_sess.c:687:1: Parameter `ctx->sessions->num_items`
685. }
686.
687. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
688. {
689. SSL_SESSION *r;
ssl/ssl_sess.c:698:6: Call
696. {
697. ret=1;
698. r=lh_SSL_SESSION_delete(ctx->sessions,c);
^
699. SSL_SESSION_list_remove(ctx,c);
700. }
crypto/lhash/lhash.c:217:1: <LHS trace>
215. }
216.
217. > void *lh_delete(_LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
215. }
216.
217. > void *lh_delete(_LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:240:2: Binary operation: (0 - 1):unsigned64 by call to `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/789da2c73d875af59b14156b6295aa4bdfc4f424/crypto/lhash/lhash.c/#L240
|
d2a_code_trace_data_44072
|
static int do_multi(int multi, int size_num)
{
int n;
int fd[2];
int *fds;
static char sep[] = ":";
fds = malloc(sizeof(*fds) * multi);
for (n = 0; n < multi; ++n) {
if (pipe(fd) == -1) {
BIO_printf(bio_err, "pipe failure\n");
exit(1);
}
fflush(stdout);
(void)BIO_flush(bio_err);
if (fork()) {
close(fd[1]);
fds[n] = fd[0];
} else {
close(fd[0]);
close(1);
if (dup(fd[1]) == -1) {
BIO_printf(bio_err, "dup failed\n");
exit(1);
}
close(fd[1]);
mr = 1;
usertime = 0;
free(fds);
return 0;
}
printf("Forked child %d\n", n);
}
for (n = 0; n < multi; ++n) {
FILE *f;
char buf[1024];
char *p;
f = fdopen(fds[n], "r");
while (fgets(buf, sizeof(buf), f)) {
p = strchr(buf, '\n');
if (p)
*p = '\0';
if (buf[0] != '+') {
BIO_printf(bio_err,
"Don't understand line '%s' from child %d\n", buf,
n);
continue;
}
printf("Got: %s from %d\n", buf, n);
if (strncmp(buf, "+F:", 3) == 0) {
int alg;
int j;
p = buf + 3;
alg = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
for (j = 0; j < size_num; ++j)
results[alg][j] += atof(sstrsep(&p, sep));
} else if (strncmp(buf, "+F2:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
rsa_results[k][0] += d;
d = atof(sstrsep(&p, sep));
rsa_results[k][1] += d;
}
# ifndef OPENSSL_NO_DSA
else if (strncmp(buf, "+F3:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
dsa_results[k][0] += d;
d = atof(sstrsep(&p, sep));
dsa_results[k][1] += d;
}
# endif
# ifndef OPENSSL_NO_EC
else if (strncmp(buf, "+F4:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
ecdsa_results[k][0] += d;
d = atof(sstrsep(&p, sep));
ecdsa_results[k][1] += d;
} else if (strncmp(buf, "+F5:", 4) == 0) {
int k;
double d;
p = buf + 4;
k = atoi(sstrsep(&p, sep));
sstrsep(&p, sep);
d = atof(sstrsep(&p, sep));
ecdh_results[k][0] += d;
}
# endif
else if (strncmp(buf, "+H:", 3) == 0) {
;
} else
BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf,
n);
}
fclose(f);
}
free(fds);
return 1;
}
apps/speed.c:3131: error: NULL_DEREFERENCE
pointer `fds` last assigned on line 3121 could be null and is dereferenced at line 3131, column 13.
Showing all 19 steps of the trace
apps/speed.c:3114:1: start of procedure do_multi()
3112. }
3113.
3114. > static int do_multi(int multi, int size_num)
3115. {
3116. int n;
apps/speed.c:3119:5:
3117. int fd[2];
3118. int *fds;
3119. > static char sep[] = ":";
3120.
3121. fds = malloc(sizeof(*fds) * multi);
apps/speed.c:3121:5:
3119. static char sep[] = ":";
3120.
3121. > fds = malloc(sizeof(*fds) * multi);
3122. for (n = 0; n < multi; ++n) {
3123. if (pipe(fd) == -1) {
apps/speed.c:3122:10:
3120.
3121. fds = malloc(sizeof(*fds) * multi);
3122. > for (n = 0; n < multi; ++n) {
3123. if (pipe(fd) == -1) {
3124. BIO_printf(bio_err, "pipe failure\n");
apps/speed.c:3122:17: Loop condition is true. Entering loop body
3120.
3121. fds = malloc(sizeof(*fds) * multi);
3122. for (n = 0; n < multi; ++n) {
^
3123. if (pipe(fd) == -1) {
3124. BIO_printf(bio_err, "pipe failure\n");
apps/speed.c:3123:13: Taking false branch
3121. fds = malloc(sizeof(*fds) * multi);
3122. for (n = 0; n < multi; ++n) {
3123. if (pipe(fd) == -1) {
^
3124. BIO_printf(bio_err, "pipe failure\n");
3125. exit(1);
apps/speed.c:3127:9:
3125. exit(1);
3126. }
3127. > fflush(stdout);
3128. (void)BIO_flush(bio_err);
3129. if (fork()) {
apps/speed.c:3128:15:
3126. }
3127. fflush(stdout);
3128. > (void)BIO_flush(bio_err);
3129. if (fork()) {
3130. close(fd[1]);
crypto/bio/bio_lib.c:509:1: start of procedure BIO_ctrl()
507. }
508.
509. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
510. {
511. long ret;
crypto/bio/bio_lib.c:513:9: Taking false branch
511. long ret;
512.
513. if (b == NULL)
^
514. return 0;
515.
crypto/bio/bio_lib.c:516:10: Taking false branch
514. return 0;
515.
516. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
518. return -2;
crypto/bio/bio_lib.c:516:33: Taking true branch
514. return 0;
515.
516. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
518. return -2;
crypto/bio/bio_lib.c:517:9: Skipping ERR_put_error(): empty list of specs
515.
516. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
^
518. return -2;
519. }
crypto/bio/bio_lib.c:518:9:
516. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
518. > return -2;
519. }
520.
crypto/bio/bio_lib.c:534:1: return from a call to BIO_ctrl
532.
533. return ret;
534. > }
535.
536. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
apps/speed.c:3128:9:
3126. }
3127. fflush(stdout);
3128. > (void)BIO_flush(bio_err);
3129. if (fork()) {
3130. close(fd[1]);
apps/speed.c:3129:13: Taking true branch
3127. fflush(stdout);
3128. (void)BIO_flush(bio_err);
3129. if (fork()) {
^
3130. close(fd[1]);
3131. fds[n] = fd[0];
apps/speed.c:3130:13:
3128. (void)BIO_flush(bio_err);
3129. if (fork()) {
3130. > close(fd[1]);
3131. fds[n] = fd[0];
3132. } else {
apps/speed.c:3131:13:
3129. if (fork()) {
3130. close(fd[1]);
3131. > fds[n] = fd[0];
3132. } else {
3133. close(fd[0]);
|
https://github.com/openssl/openssl/blob/fce78bd4ede74d4fa7bd1c8195d8f7bc9403bd4c/apps/speed.c/#L3131
|
d2a_code_trace_data_44073
|
static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length)
{
int sb, j, k, n, ch;
for (ch = 0; ch < q->nb_channels; ch++) {
init_quantized_coeffs_elem0(q->quantized_coeffs[ch][0], gb, length);
if (BITS_LEFT(length,gb) < 16) {
memset(q->quantized_coeffs[ch][0], 0, 8);
break;
}
}
n = q->sub_sampling + 1;
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++)
for (j = 0; j < 8; j++) {
if (BITS_LEFT(length,gb) < 1)
break;
if (get_bits1(gb)) {
for (k=0; k < 8; k++) {
if (BITS_LEFT(length,gb) < 16)
break;
q->tone_level_idx_hi1[ch][sb][j][k] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi1, 0, 2);
}
} else {
for (k=0; k < 8; k++)
q->tone_level_idx_hi1[ch][sb][j][k] = 0;
}
}
n = QDM2_SB_USED(q->sub_sampling) - 4;
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++) {
if (BITS_LEFT(length,gb) < 16)
break;
q->tone_level_idx_hi2[ch][sb] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi2, 0, 2);
if (sb > 19)
q->tone_level_idx_hi2[ch][sb] -= 16;
else
for (j = 0; j < 8; j++)
q->tone_level_idx_mid[ch][sb][j] = -16;
}
n = QDM2_SB_USED(q->sub_sampling) - 5;
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++)
for (j = 0; j < 8; j++) {
if (BITS_LEFT(length,gb) < 16)
break;
q->tone_level_idx_mid[ch][sb][j] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_mid, 0, 2) - 32;
}
}
libavcodec/qdm2.c:1026: error: Buffer Overrun L3
Offset added: 8 Size: [0, +oo].
libavcodec/qdm2.c:1018:1: <Length trace>
1016. * @param length packet length in bits
1017. */
1018. static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length)
^
1019. {
1020. int sb, j, k, n, ch;
libavcodec/qdm2.c:1018:1: Parameter `q->quantized_coeffs[*][*][*]`
1016. * @param length packet length in bits
1017. */
1018. static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length)
^
1019. {
1020. int sb, j, k, n, ch;
libavcodec/qdm2.c:1026:13: Array access: Offset added: 8 Size: [0, +oo]
1024.
1025. if (BITS_LEFT(length,gb) < 16) {
1026. memset(q->quantized_coeffs[ch][0], 0, 8);
^
1027. break;
1028. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/qdm2.c/#L1026
|
d2a_code_trace_data_44074
|
static void decode(Real288_internal *glob, unsigned int input)
{
unsigned int x,y;
float f;
double sum,sumsum;
float *p1,*p2;
float buffer[5];
const float *table;
for (x=36;x--;glob->sb[x+5]=glob->sb[x]);
for (x=5;x--;) {
p1=glob->sb+x;p2=glob->pr1;
for (sum=0,y=36;y--;sum-=(*(++p1))*(*(p2++)));
glob->sb[x]=sum;
}
f=amptable[input&7];
table=codetable+(input>>3)*5;
for (sum=32,x=10;x--;sum-=glob->pr2[x]*glob->lhist[x]);
if (sum<0) sum=0; else if (sum>60) sum=60;
sumsum=exp(sum*0.1151292546497)*f;
for (sum=0,x=5;x--;) { buffer[x]=table[x]*sumsum; sum+=buffer[x]*buffer[x]; }
if ((sum/=5)<1) sum=1;
for (x=10;--x;glob->lhist[x]=glob->lhist[x-1]);
*glob->lhist=glob->history[glob->phase]=10*log10(sum)-32;
for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]);
for (x=0;x<5;x++) {
f=glob->sb[4-x]+buffer[x];
if (f>4095) f=4095; else if (f<-4095) f=-4095;
glob->output[glob->phasep+x]=glob->sb[4-x]=f;
}
}
libavcodec/ra288.c:122: error: Integer Overflow L2
([-2, +oo] - 1):unsigned32.
libavcodec/ra288.c:122:8: <LHS trace>
120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32;
121.
122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]);
^
123.
124. /* output */
libavcodec/ra288.c:122:8: Assignment
120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32;
121.
122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]);
^
123.
124. /* output */
libavcodec/ra288.c:122:45: Binary operation: ([-2, +oo] - 1):unsigned32
120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32;
121.
122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]);
^
123.
124. /* output */
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra288.c/#L122
|
d2a_code_trace_data_44075
|
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if (a == NULL || *a == '\0')
return 0;
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
continue;
if (i == 0 || i > INT_MAX / 4)
goto err;
num = i + neg;
if (bn == NULL)
return num;
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return 0;
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i;
m = 0;
h = 0;
while (j > 0) {
m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0;
l = (l << 4) | k;
if (--m <= 0) {
ret->d[h++] = l;
break;
}
}
j -= BN_BYTES * 2;
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return num;
err:
if (*bn == NULL)
BN_free(ret);
return 0;
}
test/sm2_internal_test.c:323: error: BUFFER_OVERRUN_L2
Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `create_EC_group`.
Showing all 9 steps of the trace
test/sm2_internal_test.c:323:9: Call
321. /* From draft-shen-sm2-ecdsa-02 */
322. EC_GROUP *test_group =
323. create_EC_group
^
324. ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3",
325. "787968B4FA32C3FD2417842E73BBFEFF2F3C848B6831D7E0EC65228B3937E498",
test/sm2_internal_test.c:74:1: Parameter `*cof_hex`
72. }
73.
74. > static EC_GROUP *create_EC_group(const char *p_hex, const char *a_hex,
75. const char *b_hex, const char *x_hex,
76. const char *y_hex, const char *order_hex,
test/sm2_internal_test.c:110:17: Call
108.
109. if (!TEST_true(BN_hex2bn(&order, order_hex))
110. || !TEST_true(BN_hex2bn(&cof, cof_hex))
^
111. || !TEST_true(EC_GROUP_set_generator(group, generator, order, cof)))
112. goto done;
crypto/bn/bn_print.c:141:10: <Offset trace>
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:141:10: Assignment
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:164:5: Assignment
162. goto err;
163.
164. j = i; /* least significant 'hex' */
^
165. m = 0;
166. h = 0;
crypto/bn/bn_print.c:126:1: <Length trace>
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:126:1: Parameter `*a`
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:171:17: Array access: Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `create_EC_group`
169. l = 0;
170. for (;;) {
171. c = a[j - m];
^
172. k = OPENSSL_hexchar2int(c);
173. if (k < 0)
|
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_print.c/#L171
|
d2a_code_trace_data_44076
|
static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MSS2Context *ctx = avctx->priv_data;
MSS12Context *c = &ctx->c;
AVFrame *frame = data;
GetBitContext gb;
GetByteContext gB;
ArithCoder acoder;
int keyframe, has_wmv9, has_mv, is_rle, is_555, ret;
Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r;
int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >=
ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8);
init_get_bits(&gb, buf, buf_size * 8);
if (keyframe = get_bits1(&gb))
skip_bits(&gb, 7);
has_wmv9 = get_bits1(&gb);
has_mv = keyframe ? 0 : get_bits1(&gb);
is_rle = get_bits1(&gb);
is_555 = is_rle && get_bits1(&gb);
if (c->slice_split > 0)
ctx->split_position = c->slice_split;
else if (c->slice_split < 0) {
if (get_bits1(&gb)) {
if (get_bits1(&gb)) {
if (get_bits1(&gb))
ctx->split_position = get_bits(&gb, 16);
else
ctx->split_position = get_bits(&gb, 12);
} else
ctx->split_position = get_bits(&gb, 8) << 4;
} else {
if (keyframe)
ctx->split_position = avctx->height / 2;
}
} else
ctx->split_position = avctx->height;
if (c->slice_split && (ctx->split_position < 1 - is_555 ||
ctx->split_position > avctx->height - 1))
return AVERROR_INVALIDDATA;
align_get_bits(&gb);
buf += get_bits_count(&gb) >> 3;
buf_size -= get_bits_count(&gb) >> 3;
if (buf_size < 1)
return AVERROR_INVALIDDATA;
if (is_555 && (has_wmv9 || has_mv || c->slice_split && ctx->split_position))
return AVERROR_INVALIDDATA;
avctx->pix_fmt = is_555 ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_RGB24;
if (ctx->last_pic->format != avctx->pix_fmt)
av_frame_unref(ctx->last_pic);
if (has_wmv9) {
bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING);
arith2_init(&acoder, &gB);
implicit_rect = !arith2_get_bit(&acoder);
while (arith2_get_bit(&acoder)) {
if (used_rects == MAX_WMV9_RECTANGLES)
return AVERROR_INVALIDDATA;
r = &wmv9rects[used_rects];
if (!used_rects)
r->x = arith2_get_number(&acoder, avctx->width);
else
r->x = arith2_get_number(&acoder, avctx->width -
wmv9rects[used_rects - 1].x) +
wmv9rects[used_rects - 1].x;
r->y = arith2_get_number(&acoder, avctx->height);
r->w = arith2_get_number(&acoder, avctx->width - r->x) + 1;
r->h = arith2_get_number(&acoder, avctx->height - r->y) + 1;
used_rects++;
}
if (implicit_rect && used_rects) {
av_log(avctx, AV_LOG_ERROR, "implicit_rect && used_rects > 0\n");
return AVERROR_INVALIDDATA;
}
if (implicit_rect) {
wmv9rects[0].x = 0;
wmv9rects[0].y = 0;
wmv9rects[0].w = avctx->width;
wmv9rects[0].h = avctx->height;
used_rects = 1;
}
for (i = 0; i < used_rects; i++) {
if (!implicit_rect && arith2_get_bit(&acoder)) {
av_log(avctx, AV_LOG_ERROR, "Unexpected grandchildren\n");
return AVERROR_INVALIDDATA;
}
if (!i) {
wmv9_mask = arith2_get_bit(&acoder) - 1;
if (!wmv9_mask)
wmv9_mask = arith2_get_number(&acoder, 256);
}
wmv9rects[i].coded = arith2_get_number(&acoder, 2);
}
buf += arith2_get_consumed_bytes(&acoder);
buf_size -= arith2_get_consumed_bytes(&acoder);
if (buf_size < 1)
return AVERROR_INVALIDDATA;
}
c->mvX = c->mvY = 0;
if (keyframe && !is_555) {
if ((i = decode_pal_v2(c, buf, buf_size)) < 0)
return AVERROR_INVALIDDATA;
buf += i;
buf_size -= i;
} else if (has_mv) {
buf += 4;
buf_size -= 4;
if (buf_size < 1)
return AVERROR_INVALIDDATA;
c->mvX = AV_RB16(buf - 4) - avctx->width;
c->mvY = AV_RB16(buf - 2) - avctx->height;
}
if (c->mvX < 0 || c->mvY < 0) {
FFSWAP(uint8_t *, c->pal_pic, c->last_pal_pic);
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
if (ctx->last_pic->data[0]) {
av_assert0(frame->linesize[0] == ctx->last_pic->linesize[0]);
c->last_rgb_pic = ctx->last_pic->data[0] +
ctx->last_pic->linesize[0] * (avctx->height - 1);
} else {
av_log(avctx, AV_LOG_ERROR, "Missing keyframe\n");
return AVERROR_INVALIDDATA;
}
} else {
if ((ret = ff_reget_buffer(avctx, ctx->last_pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return ret;
}
if ((ret = av_frame_ref(frame, ctx->last_pic)) < 0)
return ret;
c->last_rgb_pic = NULL;
}
c->rgb_pic = frame->data[0] +
frame->linesize[0] * (avctx->height - 1);
c->rgb_stride = -frame->linesize[0];
frame->key_frame = keyframe;
frame->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if (is_555) {
bytestream2_init(&gB, buf, buf_size);
if (decode_555(&gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1,
keyframe, avctx->width, avctx->height))
return AVERROR_INVALIDDATA;
buf_size -= bytestream2_tell(&gB);
} else {
if (keyframe) {
c->corrupted = 0;
ff_mss12_slicecontext_reset(&ctx->sc[0]);
if (c->slice_split)
ff_mss12_slicecontext_reset(&ctx->sc[1]);
}
if (is_rle) {
init_get_bits(&gb, buf, buf_size * 8);
if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride,
c->rgb_pic, c->rgb_stride, c->pal, keyframe,
ctx->split_position, 0,
avctx->width, avctx->height))
return ret;
align_get_bits(&gb);
if (c->slice_split)
if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride,
c->rgb_pic, c->rgb_stride, c->pal, keyframe,
ctx->split_position, 1,
avctx->width, avctx->height))
return ret;
align_get_bits(&gb);
buf += get_bits_count(&gb) >> 3;
buf_size -= get_bits_count(&gb) >> 3;
} else if (!implicit_rect || wmv9_mask != -1) {
if (c->corrupted)
return AVERROR_INVALIDDATA;
bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING);
arith2_init(&acoder, &gB);
c->keyframe = keyframe;
if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[0], &acoder, 0, 0,
avctx->width,
ctx->split_position))
return AVERROR_INVALIDDATA;
buf += arith2_get_consumed_bytes(&acoder);
buf_size -= arith2_get_consumed_bytes(&acoder);
if (c->slice_split) {
if (buf_size < 1)
return AVERROR_INVALIDDATA;
bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING);
arith2_init(&acoder, &gB);
if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[1], &acoder, 0,
ctx->split_position,
avctx->width,
avctx->height - ctx->split_position))
return AVERROR_INVALIDDATA;
buf += arith2_get_consumed_bytes(&acoder);
buf_size -= arith2_get_consumed_bytes(&acoder);
}
} else
memset(c->pal_pic, 0, c->pal_stride * avctx->height);
}
if (has_wmv9) {
for (i = 0; i < used_rects; i++) {
int x = wmv9rects[i].x;
int y = wmv9rects[i].y;
int w = wmv9rects[i].w;
int h = wmv9rects[i].h;
if (wmv9rects[i].coded) {
int WMV9codedFrameSize;
if (buf_size < 4 || !(WMV9codedFrameSize = AV_RL24(buf)))
return AVERROR_INVALIDDATA;
if (ret = decode_wmv9(avctx, buf + 3, buf_size - 3,
x, y, w, h, wmv9_mask))
return ret;
buf += WMV9codedFrameSize + 3;
buf_size -= WMV9codedFrameSize + 3;
} else {
uint8_t *dst = c->rgb_pic + y * c->rgb_stride + x * 3;
if (wmv9_mask != -1) {
ctx->dsp.mss2_gray_fill_masked(dst, c->rgb_stride,
wmv9_mask,
c->pal_pic + y * c->pal_stride + x,
c->pal_stride,
w, h);
} else {
do {
memset(dst, 0x80, w * 3);
dst += c->rgb_stride;
} while (--h);
}
}
}
}
if (buf_size)
av_log(avctx, AV_LOG_WARNING, "buffer not fully consumed\n");
if (c->mvX < 0 || c->mvY < 0) {
av_frame_unref(ctx->last_pic);
ret = av_frame_ref(ctx->last_pic, frame);
if (ret < 0)
return ret;
}
*got_frame = 1;
return avpkt->size;
}
libavcodec/mss2.c:483: error: Null Dereference
pointer `&gb->buffer` last assigned on line 481 could be null and is dereferenced by call to `get_bits1()` at line 483, column 20.
libavcodec/mss2.c:461:1: start of procedure mss2_decode_frame()
459. #define ARITH2_PADDING 2
460.
461. static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
^
462. AVPacket *avpkt)
463. {
libavcodec/mss2.c:464:5:
462. AVPacket *avpkt)
463. {
464. const uint8_t *buf = avpkt->data;
^
465. int buf_size = avpkt->size;
466. MSS2Context *ctx = avctx->priv_data;
libavcodec/mss2.c:465:5:
463. {
464. const uint8_t *buf = avpkt->data;
465. int buf_size = avpkt->size;
^
466. MSS2Context *ctx = avctx->priv_data;
467. MSS12Context *c = &ctx->c;
libavcodec/mss2.c:466:5:
464. const uint8_t *buf = avpkt->data;
465. int buf_size = avpkt->size;
466. MSS2Context *ctx = avctx->priv_data;
^
467. MSS12Context *c = &ctx->c;
468. AVFrame *frame = data;
libavcodec/mss2.c:467:5:
465. int buf_size = avpkt->size;
466. MSS2Context *ctx = avctx->priv_data;
467. MSS12Context *c = &ctx->c;
^
468. AVFrame *frame = data;
469. GetBitContext gb;
libavcodec/mss2.c:468:5:
466. MSS2Context *ctx = avctx->priv_data;
467. MSS12Context *c = &ctx->c;
468. AVFrame *frame = data;
^
469. GetBitContext gb;
470. GetByteContext gB;
libavcodec/mss2.c:476:5:
474.
475. Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r;
476. int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
^
477.
478. av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >=
libavcodec/mss2.c:478:5: Taking false branch
476. int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
477.
478. av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >=
^
479. ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8);
480.
libavcodec/mss2.c:478:5: Loop condition is false. Leaving loop
476. int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
477.
478. av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >=
^
479. ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8);
480.
libavcodec/mss2.c:481:5:
479. ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8);
480.
481. init_get_bits(&gb, buf, buf_size * 8);
^
482.
483. if (keyframe = get_bits1(&gb))
libavcodec/get_bits.h:376:1: start of procedure init_get_bits()
374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
375. */
376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
377. int bit_size)
378. {
libavcodec/get_bits.h:380:5:
378. {
379. int buffer_size;
380. int ret = 0;
^
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
libavcodec/get_bits.h:382:9: Taking true branch
380. int ret = 0;
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
383. bit_size = 0;
384. buffer = NULL;
libavcodec/get_bits.h:383:9:
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
383. bit_size = 0;
^
384. buffer = NULL;
385. ret = AVERROR_INVALIDDATA;
libavcodec/get_bits.h:384:9:
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
383. bit_size = 0;
384. buffer = NULL;
^
385. ret = AVERROR_INVALIDDATA;
386. }
libavcodec/get_bits.h:385:9:
383. bit_size = 0;
384. buffer = NULL;
385. ret = AVERROR_INVALIDDATA;
^
386. }
387.
libavcodec/get_bits.h:388:5:
386. }
387.
388. buffer_size = (bit_size + 7) >> 3;
^
389.
390. s->buffer = buffer;
libavcodec/get_bits.h:390:5:
388. buffer_size = (bit_size + 7) >> 3;
389.
390. s->buffer = buffer;
^
391. s->size_in_bits = bit_size;
392. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:391:5:
389.
390. s->buffer = buffer;
391. s->size_in_bits = bit_size;
^
392. #if !UNCHECKED_BITSTREAM_READER
393. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:393:5:
391. s->size_in_bits = bit_size;
392. #if !UNCHECKED_BITSTREAM_READER
393. s->size_in_bits_plus8 = bit_size + 8;
^
394. #endif
395. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:395:5:
393. s->size_in_bits_plus8 = bit_size + 8;
394. #endif
395. s->buffer_end = buffer + buffer_size;
^
396. s->index = 0;
397.
libavcodec/get_bits.h:396:5:
394. #endif
395. s->buffer_end = buffer + buffer_size;
396. s->index = 0;
^
397.
398. return ret;
libavcodec/get_bits.h:398:5:
396. s->index = 0;
397.
398. return ret;
^
399. }
400.
libavcodec/get_bits.h:399:1: return from a call to init_get_bits
397.
398. return ret;
399. }
^
400.
401. /**
libavcodec/mss2.c:483:9:
481. init_get_bits(&gb, buf, buf_size * 8);
482.
483. if (keyframe = get_bits1(&gb))
^
484. skip_bits(&gb, 7);
485. has_wmv9 = get_bits1(&gb);
libavcodec/get_bits.h:272:1: start of procedure get_bits1()
270. }
271.
272. static inline unsigned int get_bits1(GetBitContext *s)
^
273. {
274. unsigned int index = s->index;
libavcodec/get_bits.h:274:5:
272. static inline unsigned int get_bits1(GetBitContext *s)
273. {
274. unsigned int index = s->index;
^
275. uint8_t result = s->buffer[index >> 3];
276. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:275:5:
273. {
274. unsigned int index = s->index;
275. uint8_t result = s->buffer[index >> 3];
^
276. #ifdef BITSTREAM_READER_LE
277. result >>= index & 7;
|
https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavcodec/mss2.c/#L483
|
d2a_code_trace_data_44077
|
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);
}
ssl/d1_clnt.c:249: error: INTEGER_OVERFLOW_L2
([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_get_server_hello`.
Showing all 15 steps of the trace
ssl/d1_clnt.c:144:1: Parameter `s->ctx->sessions->num_items`
142. dtls1_get_client_method)
143.
144. > int dtls1_connect(SSL *s)
145. {
146. BUF_MEM *buf=NULL;
ssl/d1_clnt.c:249:8: Call
247. case SSL3_ST_CR_SRVR_HELLO_A:
248. case SSL3_ST_CR_SRVR_HELLO_B:
249. ret=ssl3_get_server_hello(s);
^
250. if (ret <= 0) goto end;
251. else
ssl/s3_clnt.c:658:1: Parameter `s->ctx->sessions->num_items`
656. }
657.
658. > int ssl3_get_server_hello(SSL *s)
659. {
660. STACK_OF(SSL_CIPHER) *sk;
ssl/s3_clnt.c:834:7: Call
832. goto f_err;
833. }
834. if (ssl_check_serverhello_tlsext(s) <= 0)
^
835. {
836. SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SERVERHELLO_TLSEXT);
ssl/t1_lib.c:795:1: Parameter `s->ctx->sessions->num_items`
793. }
794.
795. > int ssl_check_serverhello_tlsext(SSL *s)
796. {
797. int ret=SSL_TLSEXT_ERR_NOACK;
ssl/t1_lib.c:844:4: Call
842. {
843. case SSL_TLSEXT_ERR_ALERT_FATAL:
844. ssl3_send_alert(s,SSL3_AL_FATAL,al);
^
845. return -1;
846.
ssl/s3_pkt.c:1317:1: Parameter `s->ctx->sessions->num_items`
1315. }
1316.
1317. > void ssl3_send_alert(SSL *s, int level, int desc)
1318. {
1319. /* Map tls/ssl alert value to correct one */
ssl/s3_pkt.c:1326:3: Call
1324. /* If a fatal one, remove from cache */
1325. if ((level == 2) && (s->session != NULL))
1326. SSL_CTX_remove_session(s->ctx,s->session);
^
1327.
1328. s->s3->alert_dispatch=1;
ssl/ssl_sess.c:614:1: Parameter `ctx->sessions->num_items`
612. }
613.
614. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
615. {
616. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:616:9: Call
614. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
615. {
616. return remove_session_lock(ctx, c, 1);
^
617. }
618.
ssl/ssl_sess.c:619:1: Parameter `ctx->sessions->num_items`
617. }
618.
619. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
620. {
621. SSL_SESSION *r;
ssl/ssl_sess.c:630:21: Call
628. {
629. ret=1;
630. r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
^
631. SSL_SESSION_list_remove(ctx,c);
632. }
crypto/lhash/lhash.c:217:1: <LHS trace>
215. }
216.
217. > void *lh_delete(LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
215. }
216.
217. > void *lh_delete(LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_get_server_hello`
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/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/crypto/lhash/lhash.c/#L240
|
d2a_code_trace_data_44078
|
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
{
const char *s = *t;
int64_t v = 0;
if (*s == '9' || *s == '8' || !ossl_isdigit(*s))
return 0;
do {
v = (v << 3) + (*s - '0');
} while (ossl_isdigit(*++s) && *s != '9' && *s != '8');
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
return 0;
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_NUMBER;
res->v.int_val = v;
return 1;
}
test/property_test.c:232: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add`.
Showing all 23 steps of the trace
test/property_test.c:218:9: Array declaration
216. char *impl;
217. } impls[] = {
218. { 6, "position=1", "a" },
^
219. { 6, "position=2", "b" },
220. { 6, "position=3", "c" },
test/property_test.c:232:14: Call
230.
231. for (i = 0; i < OSSL_NELEM(impls); i++)
232. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
^
233. impls[i].impl, NULL))) {
234. TEST_note("iteration %zd", i + 1);
crypto/property/property.c:186:1: Parameter `*properties`
184. }
185.
186. > int ossl_method_store_add(OSSL_METHOD_STORE *store,
187. int nid, const char *properties,
188. void *method, void (*method_destruct)(void *))
crypto/property/property.c:215:33: Call
213. ossl_method_cache_flush(store, nid);
214. if ((impl->properties = ossl_prop_defn_get(properties)) == NULL) {
215. if ((impl->properties = ossl_parse_property(properties)) == NULL)
^
216. goto err;
217. ossl_prop_defn_set(properties, impl->properties);
crypto/property/property_parse.c:315:1: Parameter `*defn`
313. }
314.
315. > OSSL_PROPERTY_LIST *ossl_parse_property(const char *defn)
316. {
317. PROPERTY_DEFINITION *prop = NULL;
crypto/property/property_parse.c:320:5: Assignment
318. OSSL_PROPERTY_LIST *res = NULL;
319. STACK_OF(PROPERTY_DEFINITION) *sk;
320. const char *s = defn;
^
321. int done;
322.
crypto/property/property_parse.c:326:9: Call
324. return NULL;
325.
326. s = skip_space(s);
^
327. done = *s == '\0';
328. while (!done) {
crypto/property/property_parse.c:50:1: Parameter `*s`
48. DEFINE_STACK_OF(PROPERTY_DEFINITION)
49.
50. > static const char *skip_space(const char *s)
51. {
52. while (ossl_isspace(*s))
crypto/property/property_parse.c:54:5: Assignment
52. while (ossl_isspace(*s))
53. s++;
54. return s;
^
55. }
56.
crypto/property/property_parse.c:326:5: Assignment
324. return NULL;
325.
326. s = skip_space(s);
^
327. done = *s == '\0';
328. while (!done) {
crypto/property/property_parse.c:333:14: Call
331. goto err;
332. memset(&prop->v, 0, sizeof(prop->v));
333. if (!parse_name(&s, 1, &prop->name_idx))
^
334. goto err;
335. prop->oper = PROPERTY_OPER_EQ;
crypto/property/property_parse.c:81:1: Parameter `**t`
79. }
80.
81. > static int parse_name(const char *t[], int create, OSSL_PROPERTY_IDX *idx)
82. {
83. char name[100];
crypto/property/property_parse.c:340:13: Call
338. goto err;
339. }
340. if (match_ch(&s, '=')) {
^
341. if (!parse_value(&s, prop, 1)) {
342. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
crypto/property/property_parse.c:57:1: Parameter `**t`
55. }
56.
57. > static int match_ch(const char *t[], char m)
58. {
59. const char *s = *t;
crypto/property/property_parse.c:341:18: Call
339. }
340. if (match_ch(&s, '=')) {
341. if (!parse_value(&s, prop, 1)) {
^
342. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
343. goto err;
crypto/property/property_parse.c:244:1: Parameter `**t`
242. }
243.
244. > static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create)
245. {
246. const char *s = *t;
crypto/property/property_parse.c:246:5: Assignment
244. static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create)
245. {
246. const char *s = *t;
^
247. int r = 0;
248.
crypto/property/property_parse.c:263:9: Assignment
261. r = parse_hex(&s, res);
262. } else if (*s == '0' && ossl_isdigit(s[1])) {
263. s++;
^
264. r = parse_oct(&s, res);
265. } else if (ossl_isdigit(*s)) {
crypto/property/property_parse.c:264:13: Call
262. } else if (*s == '0' && ossl_isdigit(s[1])) {
263. s++;
264. r = parse_oct(&s, res);
^
265. } else if (ossl_isdigit(*s)) {
266. return parse_number(t, res);
crypto/property/property_parse.c:163:1: <Length trace>
161. }
162.
163. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
164. {
165. const char *s = *t;
crypto/property/property_parse.c:163:1: Parameter `**t`
161. }
162.
163. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
164. {
165. const char *s = *t;
crypto/property/property_parse.c:165:5: Assignment
163. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
164. {
165. const char *s = *t;
^
166. int64_t v = 0;
167.
crypto/property/property_parse.c:172:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add`
170. do {
171. v = (v << 3) + (*s - '0');
172. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8');
^
173. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
174. PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
|
https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/property/property_parse.c/#L172
|
d2a_code_trace_data_44079
|
static void dct32(INTFLOAT *out, const INTFLOAT *tab)
{
INTFLOAT tmp0, tmp1;
INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 ,
val8 , val9 , val10, val11, val12, val13, val14, val15,
val16, val17, val18, val19, val20, val21, val22, val23,
val24, val25, val26, val27, val28, val29, val30, val31;
BF0( 0, 31, COS0_0 , 1);
BF0(15, 16, COS0_15, 5);
BF( 0, 15, COS1_0 , 1);
BF(16, 31,-COS1_0 , 1);
BF0( 7, 24, COS0_7 , 1);
BF0( 8, 23, COS0_8 , 1);
BF( 7, 8, COS1_7 , 4);
BF(23, 24,-COS1_7 , 4);
BF( 0, 7, COS2_0 , 1);
BF( 8, 15,-COS2_0 , 1);
BF(16, 23, COS2_0 , 1);
BF(24, 31,-COS2_0 , 1);
BF0( 3, 28, COS0_3 , 1);
BF0(12, 19, COS0_12, 2);
BF( 3, 12, COS1_3 , 1);
BF(19, 28,-COS1_3 , 1);
BF0( 4, 27, COS0_4 , 1);
BF0(11, 20, COS0_11, 2);
BF( 4, 11, COS1_4 , 1);
BF(20, 27,-COS1_4 , 1);
BF( 3, 4, COS2_3 , 3);
BF(11, 12,-COS2_3 , 3);
BF(19, 20, COS2_3 , 3);
BF(27, 28,-COS2_3 , 3);
BF( 0, 3, COS3_0 , 1);
BF( 4, 7,-COS3_0 , 1);
BF( 8, 11, COS3_0 , 1);
BF(12, 15,-COS3_0 , 1);
BF(16, 19, COS3_0 , 1);
BF(20, 23,-COS3_0 , 1);
BF(24, 27, COS3_0 , 1);
BF(28, 31,-COS3_0 , 1);
BF0( 1, 30, COS0_1 , 1);
BF0(14, 17, COS0_14, 3);
BF( 1, 14, COS1_1 , 1);
BF(17, 30,-COS1_1 , 1);
BF0( 6, 25, COS0_6 , 1);
BF0( 9, 22, COS0_9 , 1);
BF( 6, 9, COS1_6 , 2);
BF(22, 25,-COS1_6 , 2);
BF( 1, 6, COS2_1 , 1);
BF( 9, 14,-COS2_1 , 1);
BF(17, 22, COS2_1 , 1);
BF(25, 30,-COS2_1 , 1);
BF0( 2, 29, COS0_2 , 1);
BF0(13, 18, COS0_13, 3);
BF( 2, 13, COS1_2 , 1);
BF(18, 29,-COS1_2 , 1);
BF0( 5, 26, COS0_5 , 1);
BF0(10, 21, COS0_10, 1);
BF( 5, 10, COS1_5 , 2);
BF(21, 26,-COS1_5 , 2);
BF( 2, 5, COS2_2 , 1);
BF(10, 13,-COS2_2 , 1);
BF(18, 21, COS2_2 , 1);
BF(26, 29,-COS2_2 , 1);
BF( 1, 2, COS3_1 , 2);
BF( 5, 6,-COS3_1 , 2);
BF( 9, 10, COS3_1 , 2);
BF(13, 14,-COS3_1 , 2);
BF(17, 18, COS3_1 , 2);
BF(21, 22,-COS3_1 , 2);
BF(25, 26, COS3_1 , 2);
BF(29, 30,-COS3_1 , 2);
BF1( 0, 1, 2, 3);
BF2( 4, 5, 6, 7);
BF1( 8, 9, 10, 11);
BF2(12, 13, 14, 15);
BF1(16, 17, 18, 19);
BF2(20, 21, 22, 23);
BF1(24, 25, 26, 27);
BF2(28, 29, 30, 31);
ADD( 8, 12);
ADD(12, 10);
ADD(10, 14);
ADD(14, 9);
ADD( 9, 13);
ADD(13, 11);
ADD(11, 15);
out[ 0] = val0;
out[16] = val1;
out[ 8] = val2;
out[24] = val3;
out[ 4] = val4;
out[20] = val5;
out[12] = val6;
out[28] = val7;
out[ 2] = val8;
out[18] = val9;
out[10] = val10;
out[26] = val11;
out[ 6] = val12;
out[22] = val13;
out[14] = val14;
out[30] = val15;
ADD(24, 28);
ADD(28, 26);
ADD(26, 30);
ADD(30, 25);
ADD(25, 29);
ADD(29, 27);
ADD(27, 31);
out[ 1] = val16 + val24;
out[17] = val17 + val25;
out[ 9] = val18 + val26;
out[25] = val19 + val27;
out[ 5] = val20 + val28;
out[21] = val21 + val29;
out[13] = val22 + val30;
out[29] = val23 + val31;
out[ 3] = val24 + val20;
out[19] = val25 + val21;
out[11] = val26 + val22;
out[27] = val27 + val23;
out[ 7] = val28 + val18;
out[23] = val29 + val19;
out[15] = val30 + val17;
out[31] = val31;
}
libavcodec/mpc.c:54: error: Buffer Overrun L2
Offset: [9+min(0, `c->synth_buf_offset[*]`), 10+max(511, `c->synth_buf_offset[*]`)] (⇐ [min(0, `c->synth_buf_offset[*]`), 1+max(511, `c->synth_buf_offset[*]`)] + 9) Size: 2 by call to `ff_mpa_synth_filter`.
libavcodec/mpc.c:45:1: Parameter `c->synth_buf[*]`
43. * Process decoded Musepack data and produce PCM
44. */
45. static void mpc_synth(MPCContext *c, int16_t *out)
^
46. {
47. int dither_state = 0;
libavcodec/mpc.c:54:13: Call
52. samples_ptr = samples + ch;
53. for(i = 0; i < SAMPLES_PER_BAND; i++) {
54. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
^
55. ff_mpa_synth_window, &dither_state,
56. samples_ptr, 2,
libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr`
703. /* XXX: optimize by avoiding ring buffer usage */
704. #if !CONFIG_FLOAT
705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
^
706. MPA_INT *window, int *dither_state,
707. OUT_INT *samples, int incr,
libavcodec/mpegaudiodec.c:718:5: Assignment
716.
717. offset = *synth_buf_offset;
718. synth_buf = synth_buf_ptr + offset;
^
719.
720. #if FRAC_BITS <= 15
libavcodec/mpegaudiodec.c:728:5: Call
726. }
727. #else
728. dct32(synth_buf, sb_samples);
^
729. #endif
730.
libavcodec/dct32.c:106:1: <Length trace>
104.
105. /* DCT32 without 1/sqrt(2) coef zero scaling. */
106. static void dct32(INTFLOAT *out, const INTFLOAT *tab)
^
107. {
108. INTFLOAT tmp0, tmp1;
libavcodec/dct32.c:106:1: Parameter `*out`
104.
105. /* DCT32 without 1/sqrt(2) coef zero scaling. */
106. static void dct32(INTFLOAT *out, const INTFLOAT *tab)
^
107. {
108. INTFLOAT tmp0, tmp1;
libavcodec/dct32.c:253:5: Array access: Offset: [9+min(0, c->synth_buf_offset[*]), 10+max(511, c->synth_buf_offset[*])] (⇐ [min(0, c->synth_buf_offset[*]), 1+max(511, c->synth_buf_offset[*])] + 9) Size: 2 by call to `ff_mpa_synth_filter`
251. out[ 1] = val16 + val24;
252. out[17] = val17 + val25;
253. out[ 9] = val18 + val26;
^
254. out[25] = val19 + val27;
255. out[ 5] = val20 + val28;
|
https://github.com/libav/libav/blob/63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd/libavcodec/dct32.c/#L253
|
d2a_code_trace_data_44080
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_exp.c:1327: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 46 steps of the trace
crypto/bn/bn_exp.c:1277:1: Parameter `ctx->stack.depth`
1275.
1276. /* The old fallback, simple version :-) */
1277. > int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1278. const BIGNUM *m, BN_CTX *ctx)
1279. {
crypto/bn/bn_exp.c:1306:5: Call
1304. }
1305.
1306. BN_CTX_start(ctx);
^
1307. d = BN_CTX_get(ctx);
1308. val[0] = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:1307:9: Call
1305.
1306. BN_CTX_start(ctx);
1307. d = BN_CTX_get(ctx);
^
1308. val[0] = BN_CTX_get(ctx);
1309. if (val[0] == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:1308:14: Call
1306. BN_CTX_start(ctx);
1307. d = BN_CTX_get(ctx);
1308. val[0] = BN_CTX_get(ctx);
^
1309. if (val[0] == NULL)
1310. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:1312:10: Call
1310. goto err;
1311.
1312. if (!BN_nnmod(val[0], a, m, ctx))
^
1313. goto err; /* 1 */
1314. if (BN_is_zero(val[0])) {
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_exp.c:1322:14: Call
1320. window = BN_window_bits_for_exponent_size(bits);
1321. if (window > 1) {
1322. if (!BN_mod_mul(d, val[0], val[0], m, ctx))
^
1323. goto err; /* 2 */
1324. j = 1 << (window - 1);
crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth`
191.
192. /* slow but works */
193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
194. BN_CTX *ctx)
195. {
crypto/bn/bn_mod.c:203:5: Call
201. bn_check_top(m);
202.
203. BN_CTX_start(ctx);
^
204. if ((t = BN_CTX_get(ctx)) == NULL)
205. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mod.c:204:14: Call
202.
203. BN_CTX_start(ctx);
204. if ((t = BN_CTX_get(ctx)) == NULL)
^
205. goto err;
206. if (a == b) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mod.c:218:5: Call
216. ret = 1;
217. err:
218. BN_CTX_end(ctx);
^
219. return ret;
220. }
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_exp.c:1326:28: Call
1324. j = 1 << (window - 1);
1325. for (i = 1; i < j; i++) {
1326. if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
^
1327. !BN_mod_mul(val[i], val[i - 1], d, m, ctx))
1328. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:1327:18: Call
1325. for (i = 1; i < j; i++) {
1326. if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
1327. !BN_mod_mul(val[i], val[i - 1], d, m, ctx))
^
1328. goto err;
1329. }
crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth`
191.
192. /* slow but works */
193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
194. BN_CTX *ctx)
195. {
crypto/bn/bn_mod.c:203:5: Call
201. bn_check_top(m);
202.
203. BN_CTX_start(ctx);
^
204. if ((t = BN_CTX_get(ctx)) == NULL)
205. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mod.c:204:14: Call
202.
203. BN_CTX_start(ctx);
204. if ((t = BN_CTX_get(ctx)) == NULL)
^
205. goto err;
206. if (a == b) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mod.c:207:14: Call
205. goto err;
206. if (a == b) {
207. if (!BN_sqr(t, a, ctx))
^
208. goto err;
209. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
crypto/bn/bn_sqr.c:19:15: Call
17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
^
20.
21. bn_correct_top(r);
crypto/bn/bn_sqr.c:27:1: Parameter `ctx->stack.depth`
25. }
26.
27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
28. {
29. int max, al;
crypto/bn/bn_mod.c:213:10: Call
211. goto err;
212. }
213. if (!BN_nnmod(r, t, m, ctx))
^
214. goto err;
215. bn_check_top(r);
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:280:5: Call
278. bn_check_top(rm);
279.
280. BN_CTX_start(ctx);
^
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_div.c:450:5: Call
448. if (rm != NULL)
449. bn_rshift_fixed_top(rm, snum, norm_shift);
450. BN_CTX_end(ctx);
^
451. return 1;
452. err:
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44081
|
int test_mul(BIO *bp)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
BN_CTX *ctx;
ctx = BN_CTX_new();
if (ctx == NULL)
EXIT(1);
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
for (i = 0; i < num0 + num1; i++) {
if (i <= num1) {
BN_bntest_rand(a, 100, 0, 0);
BN_bntest_rand(b, 100, 0, 0);
} else
BN_bntest_rand(b, i - num1, 0, 0);
a->neg = rand_neg();
b->neg = rand_neg();
BN_mul(c, a, b, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " * ");
BN_print(bp, b);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_div(d, e, c, a, ctx);
BN_sub(d, d, b);
if (!BN_is_zero(d) || !BN_is_zero(e)) {
fprintf(stderr, "Multiplication test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
BN_CTX_free(ctx);
return (1);
}
test/bntest.c:691: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 659, column 9 is not reachable after line 691, column 5.
Showing all 184 steps of the trace
test/bntest.c:647:1: start of procedure test_mul()
645. }
646.
647. > int test_mul(BIO *bp)
648. {
649. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:653:5:
651. BN_CTX *ctx;
652.
653. > ctx = BN_CTX_new();
654. if (ctx == NULL)
655. EXIT(1);
crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
187.
188.
189. > BN_CTX *BN_CTX_new(void)
190. {
191. BN_CTX *ret;
crypto/bn/bn_ctx.c:193:9:
191. BN_CTX *ret;
192.
193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:193:9: Taking false branch
191. BN_CTX *ret;
192.
193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/bn/bn_ctx.c:198:5:
196. }
197. /* Initialise the structure */
198. > BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. return ret;
crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
333. /***********/
334.
335. > static void BN_POOL_init(BN_POOL *p)
336. {
337. p->head = p->current = p->tail = NULL;
crypto/bn/bn_ctx.c:337:5:
335. static void BN_POOL_init(BN_POOL *p)
336. {
337. > p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. }
crypto/bn/bn_ctx.c:338:5:
336. {
337. p->head = p->current = p->tail = NULL;
338. > p->used = p->size = 0;
339. }
340.
crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
337. p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. > }
340.
341. static void BN_POOL_finish(BN_POOL *p)
crypto/bn/bn_ctx.c:199:5:
197. /* Initialise the structure */
198. BN_POOL_init(&ret->pool);
199. > BN_STACK_init(&ret->stack);
200. return ret;
201. }
crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
292. /************/
293.
294. > static void BN_STACK_init(BN_STACK *st)
295. {
296. st->indexes = NULL;
crypto/bn/bn_ctx.c:296:5:
294. static void BN_STACK_init(BN_STACK *st)
295. {
296. > st->indexes = NULL;
297. st->depth = st->size = 0;
298. }
crypto/bn/bn_ctx.c:297:5:
295. {
296. st->indexes = NULL;
297. > st->depth = st->size = 0;
298. }
299.
crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
296. st->indexes = NULL;
297. st->depth = st->size = 0;
298. > }
299.
300. static void BN_STACK_finish(BN_STACK *st)
crypto/bn/bn_ctx.c:200:5:
198. BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. > return ret;
201. }
202.
crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
199. BN_STACK_init(&ret->stack);
200. return ret;
201. > }
202.
203. BN_CTX *BN_CTX_secure_new(void)
test/bntest.c:654:9: Taking false branch
652.
653. ctx = BN_CTX_new();
654. if (ctx == NULL)
^
655. EXIT(1);
656.
test/bntest.c:657:5:
655. EXIT(1);
656.
657. > a = BN_new();
658. b = BN_new();
659. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:658:5:
656.
657. a = BN_new();
658. > b = BN_new();
659. c = BN_new();
660. d = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:659:5:
657. a = BN_new();
658. b = BN_new();
659. > c = BN_new();
660. d = BN_new();
661. e = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:660:5:
658. b = BN_new();
659. c = BN_new();
660. > d = BN_new();
661. e = BN_new();
662.
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:661:5:
659. c = BN_new();
660. d = BN_new();
661. > e = BN_new();
662.
663. for (i = 0; i < num0 + num1; i++) {
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:663:10:
661. e = BN_new();
662.
663. > for (i = 0; i < num0 + num1; i++) {
664. if (i <= num1) {
665. BN_bntest_rand(a, 100, 0, 0);
test/bntest.c:663:17: Loop condition is false. Leaving loop
661. e = BN_new();
662.
663. for (i = 0; i < num0 + num1; i++) {
^
664. if (i <= num1) {
665. BN_bntest_rand(a, 100, 0, 0);
test/bntest.c:689:5:
687. }
688. }
689. > BN_free(a);
690. BN_free(b);
691. BN_free(c);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:690:5:
688. }
689. BN_free(a);
690. > BN_free(b);
691. BN_free(c);
692. BN_free(d);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:691:5:
689. BN_free(a);
690. BN_free(b);
691. > BN_free(c);
692. BN_free(d);
693. BN_free(e);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L691
|
d2a_code_trace_data_44082
|
static int ctr_BCC_update(RAND_DRBG_CTR *ctr,
const unsigned char *in, size_t inlen)
{
if (in == NULL || inlen == 0)
return 1;
if (ctr->bltmp_pos) {
size_t left = 16 - ctr->bltmp_pos;
if (inlen >= left) {
memcpy(ctr->bltmp + ctr->bltmp_pos, in, left);
if (!ctr_BCC_blocks(ctr, ctr->bltmp))
return 0;
ctr->bltmp_pos = 0;
inlen -= left;
in += left;
}
}
for (; inlen >= 16; in += 16, inlen -= 16) {
if (!ctr_BCC_blocks(ctr, in))
return 0;
}
if (inlen > 0) {
memcpy(ctr->bltmp + ctr->bltmp_pos, in, inlen);
ctr->bltmp_pos += inlen;
}
return 1;
}
crypto/rand/drbg_ctr.c:198: error: INTEGER_OVERFLOW_L2
([1, `in3len`] - [-22, 15]):unsigned64 by call to `ctr_BCC_update`.
Showing all 7 steps of the trace
crypto/rand/drbg_ctr.c:165:8: Parameter `in3len`
163. }
164.
165. __owur static int ctr_df(RAND_DRBG_CTR *ctr,
^
166. const unsigned char *in1, size_t in1len,
167. const unsigned char *in2, size_t in2len,
crypto/rand/drbg_ctr.c:198:13: Call
196. if (!ctr_BCC_update(ctr, in1, in1len)
197. || !ctr_BCC_update(ctr, in2, in2len)
198. || !ctr_BCC_update(ctr, in3, in3len)
^
199. || !ctr_BCC_update(ctr, &c80, 1)
200. || !ctr_BCC_final(ctr))
crypto/rand/drbg_ctr.c:120:8: <LHS trace>
118. * Process several blocks into BCC algorithm, some possibly partial
119. */
120. __owur static int ctr_BCC_update(RAND_DRBG_CTR *ctr,
^
121. const unsigned char *in, size_t inlen)
122. {
crypto/rand/drbg_ctr.c:120:8: Parameter `inlen`
118. * Process several blocks into BCC algorithm, some possibly partial
119. */
120. __owur static int ctr_BCC_update(RAND_DRBG_CTR *ctr,
^
121. const unsigned char *in, size_t inlen)
122. {
crypto/rand/drbg_ctr.c:120:8: <RHS trace>
118. * Process several blocks into BCC algorithm, some possibly partial
119. */
120. __owur static int ctr_BCC_update(RAND_DRBG_CTR *ctr,
^
121. const unsigned char *in, size_t inlen)
122. {
crypto/rand/drbg_ctr.c:120:8: Parameter `inlen`
118. * Process several blocks into BCC algorithm, some possibly partial
119. */
120. __owur static int ctr_BCC_update(RAND_DRBG_CTR *ctr,
^
121. const unsigned char *in, size_t inlen)
122. {
crypto/rand/drbg_ctr.c:136:13: Binary operation: ([1, in3len] - [-22, 15]):unsigned64 by call to `ctr_BCC_update`
134. return 0;
135. ctr->bltmp_pos = 0;
136. inlen -= left;
^
137. in += left;
138. }
|
https://github.com/openssl/openssl/blob/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/rand/drbg_ctr.c/#L136
|
d2a_code_trace_data_44083
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_mont.c:363: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`.
Showing all 18 steps of the trace
crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth`
261. }
262.
263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
264. {
265. int i, ret = 0;
crypto/bn/bn_mont.c:271:5: Call
269. return 0;
270.
271. BN_CTX_start(ctx);
^
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
273. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:272:15: Call
270.
271. BN_CTX_start(ctx);
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
^
273. goto err;
274. R = &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mont.c:363:14: Call
361. goto err; /* Ri-- (mod word size) */
362. }
363. if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
^
364. goto err;
365. /*
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:280:5: Call
278. bn_check_top(rm);
279.
280. BN_CTX_start(ctx);
^
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_div.c:450:5: Call
448. if (rm != NULL)
449. bn_rshift_fixed_top(rm, snum, norm_shift);
450. BN_CTX_end(ctx);
^
451. return 1;
452. err:
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44084
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:891: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`.
Showing all 19 steps of the trace
test/bntest.c:890:13: Call
888. for (j = 0; j < 2; j++) {
889. BN_GF2m_mod(c, a, b[j]);
890. BN_GF2m_mod_sqrt(d, a, b[j], ctx);
^
891. BN_GF2m_mod_sqr(e, d, b[j], ctx);
892. BN_GF2m_add(f, c, e);
crypto/bn/bn_gf2m.c:958:1: Parameter `ctx->stack.depth`
956. * for best performance, use the BN_GF2m_mod_sqrt_arr function.
957. */
958. > int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
959. {
960. int ret = 0;
test/bntest.c:891:13: Call
889. BN_GF2m_mod(c, a, b[j]);
890. BN_GF2m_mod_sqrt(d, a, b[j], ctx);
891. BN_GF2m_mod_sqr(e, d, b[j], ctx);
^
892. BN_GF2m_add(f, c, e);
893. /* Test that d^2 = a, where d = sqrt(a). */
crypto/bn/bn_gf2m.c:524:1: Parameter `ctx->stack.depth`
522. * use the BN_GF2m_mod_sqr_arr function.
523. */
524. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
525. {
526. int ret = 0;
test/bntest.c:890:13: Call
888. for (j = 0; j < 2; j++) {
889. BN_GF2m_mod(c, a, b[j]);
890. BN_GF2m_mod_sqrt(d, a, b[j], ctx);
^
891. BN_GF2m_mod_sqr(e, d, b[j], ctx);
892. BN_GF2m_add(f, c, e);
crypto/bn/bn_gf2m.c:958:1: Parameter `ctx->stack.depth`
956. * for best performance, use the BN_GF2m_mod_sqrt_arr function.
957. */
958. > int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
959. {
960. int ret = 0;
test/bntest.c:891:13: Call
889. BN_GF2m_mod(c, a, b[j]);
890. BN_GF2m_mod_sqrt(d, a, b[j], ctx);
891. BN_GF2m_mod_sqr(e, d, b[j], ctx);
^
892. BN_GF2m_add(f, c, e);
893. /* Test that d^2 = a, where d = sqrt(a). */
crypto/bn/bn_gf2m.c:524:1: Parameter `ctx->stack.depth`
522. * use the BN_GF2m_mod_sqr_arr function.
523. */
524. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
525. {
526. int ret = 0;
crypto/bn/bn_gf2m.c:539:11: Call
537. goto err;
538. }
539. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx);
^
540. bn_check_top(r);
541. err:
crypto/bn/bn_gf2m.c:496:5: Call
494.
495. bn_check_top(a);
496. BN_CTX_start(ctx);
^
497. if ((s = BN_CTX_get(ctx)) == NULL)
498. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gf2m.c:514:5: Call
512. ret = 1;
513. err:
514. BN_CTX_end(ctx);
^
515. return ret;
516. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44085
|
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
{
int16_t weight[8][64];
DCTELEM orig[8][64];
const int mb_x= s->mb_x;
const int mb_y= s->mb_y;
int i;
int skip_dct[8];
int dct_offset = s->linesize*8;
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int wrap_y, wrap_c;
for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct;
if(s->adaptive_quant){
const int last_qp= s->qscale;
const int mb_xy= mb_x + mb_y*s->mb_stride;
s->lambda= s->lambda_table[mb_xy];
update_qscale(s);
if(!(s->flags&CODEC_FLAG_QP_RD)){
s->qscale= s->current_picture_ptr->qscale_table[mb_xy];
s->dquant= s->qscale - last_qp;
if(s->out_format==FMT_H263){
s->dquant= av_clip(s->dquant, -2, 2);
if(s->codec_id==CODEC_ID_MPEG4){
if(!s->mb_intra){
if(s->pict_type == FF_B_TYPE){
if(s->dquant&1 || s->mv_dir&MV_DIRECT)
s->dquant= 0;
}
if(s->mv_type==MV_TYPE_8X8)
s->dquant=0;
}
}
}
}
ff_set_qscale(s, last_qp + s->dquant);
}else if(s->flags&CODEC_FLAG_QP_RD)
ff_set_qscale(s, s->qscale + s->dquant);
wrap_y = s->linesize;
wrap_c = s->uvlinesize;
ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16;
ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
uint8_t *ebuf= s->edge_emu_buffer + 32;
ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height);
ptr_y= ebuf;
ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cb= ebuf+18*wrap_y;
ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cr= ebuf+18*wrap_y+8;
}
if (s->mb_intra) {
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400;
if(progressive_score > 0){
interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.get_pixels(s->block[0], ptr_y , wrap_y);
s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y);
s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y);
s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
}
}
}else{
op_pixels_func (*op_pix)[4];
qpel_mc_func (*op_qpix)[16];
uint8_t *dest_y, *dest_cb, *dest_cr;
dest_y = s->dest[0];
dest_cb = s->dest[1];
dest_cr = s->dest[2];
if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
op_pix = s->dsp.put_pixels_tab;
op_qpix= s->dsp.put_qpel_pixels_tab;
}else{
op_pix = s->dsp.put_no_rnd_pixels_tab;
op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_FORWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
op_pix = s->dsp.avg_pixels_tab;
op_qpix= s->dsp.avg_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_BACKWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
}
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400;
if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400;
if(progressive_score>0){
interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y);
s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y);
s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y);
s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
}
}
if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){
if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1;
if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1;
if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
if(!s->chroma_y_shift){
if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
}
}
}
if(s->avctx->quantizer_noise_shaping){
if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y);
if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y);
if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y);
if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c);
if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c);
if(!s->chroma_y_shift){
if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
}
memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
}
assert(s->out_format!=FMT_MJPEG || s->qscale==8);
{
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
int overflow;
s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]);
}else
s->block_last_index[i]= -1;
}
if(s->avctx->quantizer_noise_shaping){
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale);
}
}
}
if(s->luma_elim_threshold && !s->mb_intra)
for(i=0; i<4; i++)
dct_single_coeff_elimination(s, i, s->luma_elim_threshold);
if(s->chroma_elim_threshold && !s->mb_intra)
for(i=4; i<mb_block_count; i++)
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
if(s->flags & CODEC_FLAG_CBP_RD){
for(i=0;i<mb_block_count;i++) {
if(s->block_last_index[i] == -1)
s->coded_score[i]= INT_MAX/256;
}
}
}
if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){
s->block_last_index[4]=
s->block_last_index[5]= 0;
s->block[4][0]=
s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
}
if(s->alternate_scan && s->dct_quantize != dct_quantize_c){
for(i=0; i<mb_block_count; i++){
int j;
if(s->block_last_index[i]>0){
for(j=63; j>0; j--){
if(s->block[i][ s->intra_scantable.permutated[j] ]) break;
}
s->block_last_index[i]= j;
}
}
}
switch(s->codec_id){
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER)
mpeg1_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MPEG4:
if (ENABLE_MPEG4_ENCODER)
mpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MSMPEG4V2:
case CODEC_ID_MSMPEG4V3:
case CODEC_ID_WMV1:
if (ENABLE_MSMPEG4_ENCODER)
msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_WMV2:
if (ENABLE_WMV2_ENCODER)
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H261:
if (ENABLE_H261_ENCODER)
ff_h261_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_FLV1:
case CODEC_ID_RV10:
case CODEC_ID_RV20:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER ||
ENABLE_FLV_ENCODER || ENABLE_RV10_ENCODER || ENABLE_RV20_ENCODER)
h263_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MJPEG:
if (ENABLE_MJPEG_ENCODER)
ff_mjpeg_encode_mb(s, s->block);
break;
default:
assert(0);
}
}
libavcodec/mpegvideo_enc.c:1753: error: Buffer Overrun L1
Offset added: 768 Size: 128 by call to `encode_mb_internal`.
libavcodec/mpegvideo_enc.c:1753:41: Call
1751. static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
1752. {
1753. if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6);
^
1754. else encode_mb_internal(s, motion_x, motion_y, 16, 8);
1755. }
libavcodec/mpegvideo_enc.c:1457:1: <Offset trace>
1455. }
1456.
1457. static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
^
1458. {
1459. int16_t weight[8][64];
libavcodec/mpegvideo_enc.c:1457:1: Parameter `mb_block_count`
1455. }
1456.
1457. static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
^
1458. {
1459. int16_t weight[8][64];
libavcodec/mpegvideo_enc.c:1457:1: <Length trace>
1455. }
1456.
1457. static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
^
1458. {
1459. int16_t weight[8][64];
libavcodec/mpegvideo_enc.c:1457:1: Array declaration
1455. }
1456.
1457. static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
^
1458. {
1459. int16_t weight[8][64];
libavcodec/mpegvideo_enc.c:1648:9: Array access: Offset added: 768 Size: 128 by call to `encode_mb_internal`
1646. if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
1647. }
1648. memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
^
1649. }
1650.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1648
|
d2a_code_trace_data_44086
|
static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
pkt->curr += len;
pkt->remaining -= len;
}
ssl/t1_lib.c:1850: error: INTEGER_OVERFLOW_L2
([2, +oo] - 16):unsigned64 by call to `PACKET_get_bytes`.
Showing all 9 steps of the trace
ssl/t1_lib.c:1847:9: Assignment
1845. if (TLS1_get_client_version(s) >= TLS1_2_VERSION) {
1846. const size_t len1 = sizeof(kSafariExtensionsBlock);
1847. const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock);
^
1848.
1849. if (!PACKET_get_bytes(&tmppkt, &eblock1, len1)
ssl/t1_lib.c:1850:21: Call
1848.
1849. if (!PACKET_get_bytes(&tmppkt, &eblock1, len1)
1850. || !PACKET_get_bytes(&tmppkt, &eblock2, len2)
^
1851. || PACKET_remaining(&tmppkt))
1852. return;
ssl/packet_locl.h:344:8: Parameter `len`
342. * freed
343. */
344. __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt,
^
345. const unsigned char **data,
346. size_t len)
ssl/packet_locl.h:351:5: Call
349. return 0;
350.
351. packet_forward(pkt, len);
^
352.
353. return 1;
ssl/packet_locl.h:81:1: <LHS trace>
79.
80. /* Internal unchecked shorthand; don't use outside this file. */
81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
82. {
83. pkt->curr += len;
ssl/packet_locl.h:81:1: Parameter `pkt->remaining`
79.
80. /* Internal unchecked shorthand; don't use outside this file. */
81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
82. {
83. pkt->curr += len;
ssl/packet_locl.h:81:1: <RHS trace>
79.
80. /* Internal unchecked shorthand; don't use outside this file. */
81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
82. {
83. pkt->curr += len;
ssl/packet_locl.h:81:1: Parameter `len`
79.
80. /* Internal unchecked shorthand; don't use outside this file. */
81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
82. {
83. pkt->curr += len;
ssl/packet_locl.h:84:5: Binary operation: ([2, +oo] - 16):unsigned64 by call to `PACKET_get_bytes`
82. {
83. pkt->curr += len;
84. pkt->remaining -= len;
^
85. }
86.
|
https://github.com/openssl/openssl/blob/d6c2587967f93f2f9c226bda9139ae427698f20f/ssl/packet_locl.h/#L84
|
d2a_code_trace_data_44087
|
static int do_not_call_session_ticket_cb(SSL *s, unsigned char *key_name,
unsigned char *iv,
EVP_CIPHER_CTX *ctx,
HMAC_CTX *hctx, int enc)
{
HANDSHAKE_EX_DATA *ex_data =
(HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
ex_data->session_ticket_do_not_call = 1;
return 0;
}
test/handshake_helper.c:201: error: NULL_DEREFERENCE
pointer `ex_data` last assigned on line 199 could be null and is dereferenced at line 201, column 5.
Showing all 10 steps of the trace
test/handshake_helper.c:194:1: start of procedure do_not_call_session_ticket_cb()
192. }
193.
194. > static int do_not_call_session_ticket_cb(SSL *s, unsigned char *key_name,
195. unsigned char *iv,
196. EVP_CIPHER_CTX *ctx,
test/handshake_helper.c:199:5:
197. HMAC_CTX *hctx, int enc)
198. {
199. > HANDSHAKE_EX_DATA *ex_data =
200. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
201. ex_data->session_ticket_do_not_call = 1;
ssl/ssl_lib.c:3525:1: start of procedure SSL_get_ex_data()
3523. }
3524.
3525. > void *SSL_get_ex_data(const SSL *s, int idx)
3526. {
3527. return (CRYPTO_get_ex_data(&s->ex_data, idx));
ssl/ssl_lib.c:3527:5:
3525. void *SSL_get_ex_data(const SSL *s, int idx)
3526. {
3527. > return (CRYPTO_get_ex_data(&s->ex_data, idx));
3528. }
3529.
crypto/ex_data.c:374:1: start of procedure CRYPTO_get_ex_data()
372. * particular index in the class used by this variable
373. */
374. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
375. {
376. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:376:9: Taking true branch
374. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
375. {
376. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
377. return NULL;
378. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:377:9:
375. {
376. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
377. > return NULL;
378. return sk_void_value(ad->sk, idx);
379. }
crypto/ex_data.c:379:1: return from a call to CRYPTO_get_ex_data
377. return NULL;
378. return sk_void_value(ad->sk, idx);
379. > }
ssl/ssl_lib.c:3528:1: return from a call to SSL_get_ex_data
3526. {
3527. return (CRYPTO_get_ex_data(&s->ex_data, idx));
3528. > }
3529.
3530. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
test/handshake_helper.c:201:5:
199. HANDSHAKE_EX_DATA *ex_data =
200. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
201. > ex_data->session_ticket_do_not_call = 1;
202. return 0;
203. }
|
https://github.com/openssl/openssl/blob/7f9ae88817ddf0aac5c6bd95d9a5af1c54ed5bbf/test/handshake_helper.c/#L201
|
d2a_code_trace_data_44088
|
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: [21, 57] Size: 40 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: Array declaration
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:667:13: Call
665.
666. if (lag < AMR_SUBFRAME_SIZE >> 1)
667. ff_celp_circ_addf(filter2, filter, filter1, lag, fac,
^
668. AMR_SUBFRAME_SIZE);
669. }
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: [21, 57] Size: 40 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_44089
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:238: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div_recp`.
Showing all 19 steps of the trace
test/bntest.c:238:9: Call
236. b->neg = rand_neg();
237. BN_RECP_CTX_set(recp, b, ctx);
238. BN_div_recp(d, c, a, recp, ctx);
^
239. BN_mul(e, d, b, ctx);
240. BN_add(d, e, c);
crypto/bn/bn_recp.c:83:1: Parameter `ctx->stack.depth`
81. }
82.
83. > int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
84. BN_RECP_CTX *recp, BN_CTX *ctx)
85. {
crypto/bn/bn_recp.c:89:5: Call
87. BIGNUM *a, *b, *d, *r;
88.
89. BN_CTX_start(ctx);
^
90. a = BN_CTX_get(ctx);
91. b = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_recp.c:106:13: Call
104. BN_zero(d);
105. if (!BN_copy(r, m)) {
106. BN_CTX_end(ctx);
^
107. return 0;
108. }
crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
test/bntest.c:239:9: Call
237. BN_RECP_CTX_set(recp, b, ctx);
238. BN_div_recp(d, c, a, recp, ctx);
239. BN_mul(e, d, b, ctx);
^
240. BN_add(d, e, c);
241. BN_sub(d, d, a);
crypto/bn/bn_mul.c:828:1: Parameter `ctx->stack.depth`
826. #endif /* BN_RECURSION */
827.
828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
829. {
830. int ret = 0;
test/bntest.c:238:9: Call
236. b->neg = rand_neg();
237. BN_RECP_CTX_set(recp, b, ctx);
238. BN_div_recp(d, c, a, recp, ctx);
^
239. BN_mul(e, d, b, ctx);
240. BN_add(d, e, c);
crypto/bn/bn_recp.c:89:5: Call
87. BIGNUM *a, *b, *d, *r;
88.
89. BN_CTX_start(ctx);
^
90. a = BN_CTX_get(ctx);
91. b = 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_recp.c:106:13: Call
104. BN_zero(d);
105. if (!BN_copy(r, m)) {
106. BN_CTX_end(ctx);
^
107. return 0;
108. }
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <Offset trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: <Length trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div_recp`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_44090
|
int OBJ_NAME_add(const char *name, int type, const char *data)
{
OBJ_NAME *onp, *ret;
int alias;
if ((names_lh == NULL) && !OBJ_NAME_init())
return (0);
alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS;
onp = OPENSSL_malloc(sizeof(*onp));
if (onp == NULL) {
return (0);
}
onp->name = name;
onp->alias = alias;
onp->type = type;
onp->data = data;
ret = lh_OBJ_NAME_insert(names_lh, onp);
if (ret != NULL) {
if ((name_funcs_stack != NULL)
&& (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) {
sk_NAME_FUNCS_value(name_funcs_stack,
ret->type)->free_func(ret->name, ret->type,
ret->data);
}
OPENSSL_free(ret);
} else {
if (lh_OBJ_NAME_error(names_lh)) {
return (0);
}
}
return (1);
}
crypto/objects/o_names.c:196: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_malloc()` at line 185, column 11 is not reachable after line 196, column 5.
Showing all 32 steps of the trace
crypto/objects/o_names.c:174:1: start of procedure OBJ_NAME_add()
172. }
173.
174. > int OBJ_NAME_add(const char *name, int type, const char *data)
175. {
176. OBJ_NAME *onp, *ret;
crypto/objects/o_names.c:179:10: Taking false branch
177. int alias;
178.
179. if ((names_lh == NULL) && !OBJ_NAME_init())
^
180. return (0);
181.
crypto/objects/o_names.c:182:5:
180. return (0);
181.
182. > alias = type & OBJ_NAME_ALIAS;
183. type &= ~OBJ_NAME_ALIAS;
184.
crypto/objects/o_names.c:183:5:
181.
182. alias = type & OBJ_NAME_ALIAS;
183. > type &= ~OBJ_NAME_ALIAS;
184.
185. onp = OPENSSL_malloc(sizeof(*onp));
crypto/objects/o_names.c:185:5:
183. type &= ~OBJ_NAME_ALIAS;
184.
185. > onp = OPENSSL_malloc(sizeof(*onp));
186. if (onp == NULL) {
187. /* ERROR */
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/objects/o_names.c:186:9: Taking false branch
184.
185. onp = OPENSSL_malloc(sizeof(*onp));
186. if (onp == NULL) {
^
187. /* ERROR */
188. return (0);
crypto/objects/o_names.c:191:5:
189. }
190.
191. > onp->name = name;
192. onp->alias = alias;
193. onp->type = type;
crypto/objects/o_names.c:192:5:
190.
191. onp->name = name;
192. > onp->alias = alias;
193. onp->type = type;
194. onp->data = data;
crypto/objects/o_names.c:193:5:
191. onp->name = name;
192. onp->alias = alias;
193. > onp->type = type;
194. onp->data = data;
195.
crypto/objects/o_names.c:194:5:
192. onp->alias = alias;
193. onp->type = type;
194. > onp->data = data;
195.
196. ret = lh_OBJ_NAME_insert(names_lh, onp);
crypto/objects/o_names.c:196:11: Condition is true
194. onp->data = data;
195.
196. ret = lh_OBJ_NAME_insert(names_lh, onp);
^
197. if (ret != NULL) {
198. /* free things */
crypto/objects/o_names.c:196:11: Condition is true
194. onp->data = data;
195.
196. ret = lh_OBJ_NAME_insert(names_lh, onp);
^
197. if (ret != NULL) {
198. /* free things */
crypto/objects/o_names.c:196:5:
194. onp->data = data;
195.
196. > ret = lh_OBJ_NAME_insert(names_lh, onp);
197. if (ret != NULL) {
198. /* free things */
crypto/lhash/lhash.c:156:1: start of procedure lh_insert()
154. }
155.
156. > void *lh_insert(_LHASH *lh, void *data)
157. {
158. unsigned long hash;
crypto/lhash/lhash.c:162:5:
160. void *ret;
161.
162. > lh->error = 0;
163. if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))
164. expand(lh);
crypto/lhash/lhash.c:163:9: Taking false branch
161.
162. lh->error = 0;
163. if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))
^
164. expand(lh);
165.
crypto/lhash/lhash.c:166:5: Skipping getrn(): empty list of specs
164. expand(lh);
165.
166. rn = getrn(lh, data, &hash);
^
167.
168. if (*rn == NULL) {
crypto/lhash/lhash.c:168:9: Taking false branch
166. rn = getrn(lh, data, &hash);
167.
168. if (*rn == NULL) {
^
169. if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
170. lh->error++;
crypto/lhash/lhash.c:182:9:
180. } else { /* replace same key */
181.
182. > ret = (*rn)->data;
183. (*rn)->data = data;
184. lh->num_replace++;
crypto/lhash/lhash.c:183:9:
181.
182. ret = (*rn)->data;
183. > (*rn)->data = data;
184. lh->num_replace++;
185. }
crypto/lhash/lhash.c:184:9:
182. ret = (*rn)->data;
183. (*rn)->data = data;
184. > lh->num_replace++;
185. }
186. return (ret);
crypto/lhash/lhash.c:186:5:
184. lh->num_replace++;
185. }
186. > return (ret);
187. }
188.
crypto/lhash/lhash.c:187:1: return from a call to lh_insert
185. }
186. return (ret);
187. > }
188.
189. void *lh_delete(_LHASH *lh, const void *data)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/objects/o_names.c/#L196
|
d2a_code_trace_data_44091
|
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
const char *dir)
{
DIR *d;
struct dirent *dstruct;
int ret = 0;
CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
d = opendir(dir);
if(!d)
{
SYSerr(SYS_F_OPENDIR, get_last_sys_error());
ERR_add_error_data(3, "opendir('", dir, "')");
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
goto err;
}
while((dstruct=readdir(d)))
{
char buf[1024];
int r;
if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
{
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
goto err;
}
r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
if (r <= 0 || r >= sizeof buf)
goto err;
if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
goto err;
}
ret = 1;
err:
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret;
}
ssl/ssl_cert.c:768: error: RESOURCE_LEAK
resource acquired by call to `opendir()` at line 745, column 6 is not released after line 768, column 17.
Showing all 16 steps of the trace
ssl/ssl_cert.c:737:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
735. #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! */
736.
737. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
738. const char *dir)
739. {
ssl/ssl_cert.c:742:2:
740. DIR *d;
741. struct dirent *dstruct;
742. > int ret = 0;
743.
744. CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
ssl/ssl_cert.c:744:2:
742. int ret = 0;
743.
744. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
745. d = opendir(dir);
746.
crypto/cryptlib.c:379:1: start of procedure CRYPTO_lock()
377. }
378.
379. > void CRYPTO_lock(int mode, int type, const char *file, int line)
380. {
381. #ifdef LOCK_DEBUG
crypto/cryptlib.c:404:6: Taking false branch
402. }
403. #endif
404. if (type < 0)
^
405. {
406. struct CRYPTO_dynlock_value *pointer
crypto/cryptlib.c:417:7: Taking true branch
415. }
416. else
417. if (locking_callback != NULL)
^
418. locking_callback(mode,type,file,line);
419. }
crypto/cryptlib.c:418:4: Skipping __function_pointer__(): unresolved function pointer
416. else
417. if (locking_callback != NULL)
418. locking_callback(mode,type,file,line);
^
419. }
420.
crypto/cryptlib.c:404:2:
402. }
403. #endif
404. > if (type < 0)
405. {
406. struct CRYPTO_dynlock_value *pointer
crypto/cryptlib.c:419:2: return from a call to CRYPTO_lock
417. if (locking_callback != NULL)
418. locking_callback(mode,type,file,line);
419. }
^
420.
421. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
ssl/ssl_cert.c:745:2:
743.
744. CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
745. > d = opendir(dir);
746.
747. /* Note that a side effect is that the CAs will be sorted by name */
ssl/ssl_cert.c:748:6: Taking false branch
746.
747. /* Note that a side effect is that the CAs will be sorted by name */
748. if(!d)
^
749. {
750. SYSerr(SYS_F_OPENDIR, get_last_sys_error());
ssl/ssl_cert.c:756:9: Loop condition is true. Entering loop body
754. }
755.
756. while((dstruct=readdir(d)))
^
757. {
758. char buf[1024];
ssl/ssl_cert.c:761:6: Taking false branch
759. int r;
760.
761. if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
^
762. {
763. SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
ssl/ssl_cert.c:767:3: Skipping BIO_snprintf(): empty list of specs
765. }
766.
767. r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
^
768. if (r <= 0 || r >= sizeof buf)
769. goto err;
ssl/ssl_cert.c:768:7: Taking false branch
766.
767. r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
768. if (r <= 0 || r >= sizeof buf)
^
769. goto err;
770. if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
ssl/ssl_cert.c:768:17: Taking true branch
766.
767. r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
768. if (r <= 0 || r >= sizeof buf)
^
769. goto err;
770. if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
|
https://github.com/openssl/openssl/blob/4bf4bc784f12bcdc3a3e772f85f6d33f5eccdab3/ssl/ssl_cert.c/#L768
|
d2a_code_trace_data_44092
|
void parse_options(int argc, char **argv, const OptionDef *options,
void (* parse_arg_function)(const char*))
{
const char *opt, *arg;
int optindex, handleoptions=1;
const OptionDef *po;
optindex = 1;
while (optindex < argc) {
opt = argv[optindex++];
if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
if (opt[1] == '-' && opt[2] == '\0') {
handleoptions = 0;
continue;
}
po= find_option(options, opt + 1);
if (!po->name)
po= find_option(options, "default");
if (!po->name) {
unknown_opt:
fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
exit(1);
}
arg = NULL;
if (po->flags & HAS_ARG) {
arg = argv[optindex++];
if (!arg) {
fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
exit(1);
}
}
if (po->flags & OPT_STRING) {
char *str;
str = av_strdup(arg);
*po->u.str_arg = str;
} else if (po->flags & OPT_BOOL) {
*po->u.int_arg = 1;
} else if (po->flags & OPT_INT) {
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
} else if (po->flags & OPT_INT64) {
*po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
} else if (po->flags & OPT_FLOAT) {
*po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
} else if (po->flags & OPT_FUNC2) {
if(po->u.func2_arg(opt+1, arg)<0)
goto unknown_opt;
} else {
po->u.func_arg(arg);
}
if(po->flags & OPT_EXIT)
exit(0);
} else {
if (parse_arg_function)
parse_arg_function(opt);
}
}
}
cmdutils.c:159: error: Null Dereference
pointer `arg` last assigned on line 142 could be null and is dereferenced by call to `parse_number_or_die()` at line 159, column 36.
cmdutils.c:117:1: start of procedure parse_options()
115. }
116.
117. void parse_options(int argc, char **argv, const OptionDef *options,
^
118. void (* parse_arg_function)(const char*))
119. {
cmdutils.c:121:5:
119. {
120. const char *opt, *arg;
121. int optindex, handleoptions=1;
^
122. const OptionDef *po;
123.
cmdutils.c:125:5:
123.
124. /* parse options */
125. optindex = 1;
^
126. while (optindex < argc) {
127. opt = argv[optindex++];
cmdutils.c:126:12: Loop condition is true. Entering loop body
124. /* parse options */
125. optindex = 1;
126. while (optindex < argc) {
^
127. opt = argv[optindex++];
128.
cmdutils.c:127:9:
125. optindex = 1;
126. while (optindex < argc) {
127. opt = argv[optindex++];
^
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
cmdutils.c:129:13: Taking true branch
127. opt = argv[optindex++];
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
^
130. if (opt[1] == '-' && opt[2] == '\0') {
131. handleoptions = 0;
cmdutils.c:129:30: Taking true branch
127. opt = argv[optindex++];
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
^
130. if (opt[1] == '-' && opt[2] == '\0') {
131. handleoptions = 0;
cmdutils.c:129:47: Taking true branch
127. opt = argv[optindex++];
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
^
130. if (opt[1] == '-' && opt[2] == '\0') {
131. handleoptions = 0;
cmdutils.c:130:17: Taking false branch
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
130. if (opt[1] == '-' && opt[2] == '\0') {
^
131. handleoptions = 0;
132. continue;
cmdutils.c:134:13: Skipping find_option(): empty list of specs
132. continue;
133. }
134. po= find_option(options, opt + 1);
^
135. if (!po->name)
136. po= find_option(options, "default");
cmdutils.c:135:18: Taking false branch
133. }
134. po= find_option(options, opt + 1);
135. if (!po->name)
^
136. po= find_option(options, "default");
137. if (!po->name) {
cmdutils.c:137:18: Taking false branch
135. if (!po->name)
136. po= find_option(options, "default");
137. if (!po->name) {
^
138. unknown_opt:
139. fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
cmdutils.c:142:13:
140. exit(1);
141. }
142. arg = NULL;
^
143. if (po->flags & HAS_ARG) {
144. arg = argv[optindex++];
cmdutils.c:143:17: Taking false branch
141. }
142. arg = NULL;
143. if (po->flags & HAS_ARG) {
^
144. arg = argv[optindex++];
145. if (!arg) {
cmdutils.c:150:17: Taking false branch
148. }
149. }
150. if (po->flags & OPT_STRING) {
^
151. char *str;
152. str = av_strdup(arg);
cmdutils.c:154:24: Taking false branch
152. str = av_strdup(arg);
153. *po->u.str_arg = str;
154. } else if (po->flags & OPT_BOOL) {
^
155. *po->u.int_arg = 1;
156. } else if (po->flags & OPT_INT) {
cmdutils.c:156:24: Taking false branch
154. } else if (po->flags & OPT_BOOL) {
155. *po->u.int_arg = 1;
156. } else if (po->flags & OPT_INT) {
^
157. *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
158. } else if (po->flags & OPT_INT64) {
cmdutils.c:158:24: Taking true branch
156. } else if (po->flags & OPT_INT) {
157. *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
158. } else if (po->flags & OPT_INT64) {
^
159. *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
160. } else if (po->flags & OPT_FLOAT) {
cmdutils.c:159:17:
157. *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
158. } else if (po->flags & OPT_INT64) {
159. *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
^
160. } else if (po->flags & OPT_FLOAT) {
161. *po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
cmdutils.c:57:1: start of procedure parse_number_or_die()
55. struct SwsContext *sws_opts;
56.
57. double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
^
58. {
59. char *tail;
cmdutils.c:61:5:
59. char *tail;
60. const char *error;
61. double d = strtod(numstr, &tail);
^
62. if (*tail)
63. error= "Expected number for %s but found: %s\n";
cmdutils.c:62:9: Taking false branch
60. const char *error;
61. double d = strtod(numstr, &tail);
62. if (*tail)
^
63. error= "Expected number for %s but found: %s\n";
64. else if (d < min || d > max)
cmdutils.c:64:14: Taking false branch
62. if (*tail)
63. error= "Expected number for %s but found: %s\n";
64. else if (d < min || d > max)
^
65. error= "The value for %s was %s which is not within %f - %f\n";
66. else if(type == OPT_INT64 && (int64_t)d != d)
cmdutils.c:64:25: Taking false branch
62. if (*tail)
63. error= "Expected number for %s but found: %s\n";
64. else if (d < min || d > max)
^
65. error= "The value for %s was %s which is not within %f - %f\n";
66. else if(type == OPT_INT64 && (int64_t)d != d)
cmdutils.c:66:13: Taking false branch
64. else if (d < min || d > max)
65. error= "The value for %s was %s which is not within %f - %f\n";
66. else if(type == OPT_INT64 && (int64_t)d != d)
^
67. error= "Expected int64 for %s but found %s\n";
68. else
cmdutils.c:69:9:
67. error= "Expected int64 for %s but found %s\n";
68. else
69. return d;
^
70. fprintf(stderr, error, context, numstr, min, max);
71. exit(1);
cmdutils.c:72:1: return from a call to parse_number_or_die
70. fprintf(stderr, error, context, numstr, min, max);
71. exit(1);
72. }
^
73.
74. int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
|
https://github.com/libav/libav/blob/712ca84c21a4d7faf97fa79732bf5c347ec6fbc3/cmdutils.c/#L159
|
d2a_code_trace_data_44093
|
static void opt_output_file(const char *filename)
{
AVFormatContext *oc;
int use_video, use_audio, use_subtitle;
int input_has_video, input_has_audio, input_has_subtitle;
AVFormatParameters params, *ap = ¶ms;
if (!strcmp(filename, "-"))
filename = "pipe:";
oc = avformat_alloc_context();
if (!file_oformat) {
file_oformat = guess_format(NULL, filename, NULL);
if (!file_oformat) {
fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
filename);
av_exit(1);
}
}
oc->oformat = file_oformat;
av_strlcpy(oc->filename, filename, sizeof(oc->filename));
if (!strcmp(file_oformat->name, "ffm") &&
av_strstart(filename, "http:", NULL)) {
int err = read_ffserver_streams(oc, filename);
if (err < 0) {
print_error(filename, err);
av_exit(1);
}
} else {
use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
if (nb_input_files > 0) {
check_audio_video_sub_inputs(&input_has_video, &input_has_audio,
&input_has_subtitle);
if (!input_has_video)
use_video = 0;
if (!input_has_audio)
use_audio = 0;
if (!input_has_subtitle)
use_subtitle = 0;
}
if (audio_disable) {
use_audio = 0;
}
if (video_disable) {
use_video = 0;
}
if (subtitle_disable) {
use_subtitle = 0;
}
if (use_video) {
new_video_stream(oc);
}
if (use_audio) {
new_audio_stream(oc);
}
if (use_subtitle) {
new_subtitle_stream(oc);
}
oc->timestamp = rec_timestamp;
for(; metadata_count>0; metadata_count--){
av_metadata_set(&oc->metadata, metadata[metadata_count-1].key,
metadata[metadata_count-1].value);
}
av_metadata_conv(oc, oc->oformat->metadata_conv, NULL);
}
output_files[nb_output_files++] = oc;
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
if (!av_filename_number_test(oc->filename)) {
print_error(oc->filename, AVERROR_NUMEXPECTED);
av_exit(1);
}
}
if (!(oc->oformat->flags & AVFMT_NOFILE)) {
if (!file_overwrite &&
(strchr(filename, ':') == NULL ||
filename[1] == ':' ||
av_strstart(filename, "file:", NULL))) {
if (url_exist(filename)) {
int c;
if (!using_stdin) {
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
fflush(stderr);
c = getchar();
if (toupper(c) != 'Y') {
fprintf(stderr, "Not overwriting - exiting\n");
av_exit(1);
}
}
else {
fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
av_exit(1);
}
}
}
if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
fprintf(stderr, "Could not open '%s'\n", filename);
av_exit(1);
}
}
memset(ap, 0, sizeof(*ap));
if (av_set_parameters(oc, ap) < 0) {
fprintf(stderr, "%s: Invalid encoding parameters\n",
oc->filename);
av_exit(1);
}
oc->preload= (int)(mux_preload*AV_TIME_BASE);
oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
oc->loop_output = loop_output;
oc->flags |= AVFMT_FLAG_NONBLOCK;
set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM);
file_oformat = NULL;
file_iformat = NULL;
}
ffmpeg.c:3288: error: Null Dereference
pointer `file_oformat` last assigned on line 3277 could be null and is dereferenced at line 3288, column 17.
ffmpeg.c:3264:1: start of procedure opt_output_file()
3262. }
3263.
3264. static void opt_output_file(const char *filename)
^
3265. {
3266. AVFormatContext *oc;
ffmpeg.c:3269:5:
3267. int use_video, use_audio, use_subtitle;
3268. int input_has_video, input_has_audio, input_has_subtitle;
3269. AVFormatParameters params, *ap = ¶ms;
^
3270.
3271. if (!strcmp(filename, "-"))
ffmpeg.c:3271:10: Taking false branch
3269. AVFormatParameters params, *ap = ¶ms;
3270.
3271. if (!strcmp(filename, "-"))
^
3272. filename = "pipe:";
3273.
ffmpeg.c:3274:5:
3272. filename = "pipe:";
3273.
3274. oc = avformat_alloc_context();
^
3275.
3276. if (!file_oformat) {
libavformat/options.c:77:1: start of procedure avformat_alloc_context()
75. }
76.
77. AVFormatContext *avformat_alloc_context(void)
^
78. {
79. AVFormatContext *ic;
libavformat/options.c:80:5:
78. {
79. AVFormatContext *ic;
80. ic = av_malloc(sizeof(AVFormatContext));
^
81. if (!ic) return ic;
82. avformat_get_context_defaults(ic);
libavutil/mem.c:47:1: start of procedure av_malloc()
45. linker will do it automatically. */
46.
47. void *av_malloc(unsigned int size)
^
48. {
49. void *ptr = NULL;
libavutil/mem.c:49:5:
47. void *av_malloc(unsigned int size)
48. {
49. void *ptr = NULL;
^
50. #if CONFIG_MEMALIGN_HACK
51. long diff;
libavutil/mem.c:55:8: Taking false branch
53.
54. /* let's disallow possible ambiguous cases */
55. if(size > (INT_MAX-16) )
^
56. return NULL;
57.
libavutil/mem.c:66:9: Taking false branch
64. ((char*)ptr)[-1]= diff;
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
^
67. ptr = NULL;
68. #elif HAVE_MEMALIGN
libavutil/mem.c:99:5:
97. ptr = malloc(size);
98. #endif
99. return ptr;
^
100. }
101.
libavutil/mem.c:100:1: return from a call to av_malloc
98. #endif
99. return ptr;
100. }
^
101.
102. void *av_realloc(void *ptr, unsigned int size)
libavformat/options.c:81:10: Taking false branch
79. AVFormatContext *ic;
80. ic = av_malloc(sizeof(AVFormatContext));
81. if (!ic) return ic;
^
82. avformat_get_context_defaults(ic);
83. ic->av_class = &av_format_context_class;
libavformat/options.c:82:5: Skipping avformat_get_context_defaults(): empty list of specs
80. ic = av_malloc(sizeof(AVFormatContext));
81. if (!ic) return ic;
82. avformat_get_context_defaults(ic);
^
83. ic->av_class = &av_format_context_class;
84. return ic;
libavformat/options.c:83:5:
81. if (!ic) return ic;
82. avformat_get_context_defaults(ic);
83. ic->av_class = &av_format_context_class;
^
84. return ic;
85. }
libavformat/options.c:84:5:
82. avformat_get_context_defaults(ic);
83. ic->av_class = &av_format_context_class;
84. return ic;
^
85. }
86.
libavformat/options.c:85:1: return from a call to avformat_alloc_context
83. ic->av_class = &av_format_context_class;
84. return ic;
85. }
^
86.
87. #if LIBAVFORMAT_VERSION_MAJOR < 53
ffmpeg.c:3276:10: Taking true branch
3274. oc = avformat_alloc_context();
3275.
3276. if (!file_oformat) {
^
3277. file_oformat = guess_format(NULL, filename, NULL);
3278. if (!file_oformat) {
ffmpeg.c:3277:9: Skipping guess_format(): empty list of specs
3275.
3276. if (!file_oformat) {
3277. file_oformat = guess_format(NULL, filename, NULL);
^
3278. if (!file_oformat) {
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
ffmpeg.c:3278:14: Taking true branch
3276. if (!file_oformat) {
3277. file_oformat = guess_format(NULL, filename, NULL);
3278. if (!file_oformat) {
^
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3280. filename);
ffmpeg.c:3279:13:
3277. file_oformat = guess_format(NULL, filename, NULL);
3278. if (!file_oformat) {
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
^
3280. filename);
3281. av_exit(1);
ffmpeg.c:3281:13: Skipping av_exit(): empty list of specs
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3280. filename);
3281. av_exit(1);
^
3282. }
3283. }
ffmpeg.c:3285:5:
3283. }
3284.
3285. oc->oformat = file_oformat;
^
3286. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3287.
ffmpeg.c:3286:5:
3284.
3285. oc->oformat = file_oformat;
3286. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
^
3287.
3288. if (!strcmp(file_oformat->name, "ffm") &&
libavutil/avstring.c:50:1: start of procedure av_strlcpy()
48. }
49.
50. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
51. {
52. size_t len = 0;
libavutil/avstring.c:52:5:
50. size_t av_strlcpy(char *dst, const char *src, size_t size)
51. {
52. size_t len = 0;
^
53. while (++len < size && *src)
54. *dst++ = *src++;
libavutil/avstring.c:53:12: Loop condition is true. Entering loop body
51. {
52. size_t len = 0;
53. while (++len < size && *src)
^
54. *dst++ = *src++;
55. if (len <= size)
libavutil/avstring.c:53:28: Loop condition is false. Leaving loop
51. {
52. size_t len = 0;
53. while (++len < size && *src)
^
54. *dst++ = *src++;
55. if (len <= size)
libavutil/avstring.c:55:9: Taking true branch
53. while (++len < size && *src)
54. *dst++ = *src++;
55. if (len <= size)
^
56. *dst = 0;
57. return len + strlen(src) - 1;
libavutil/avstring.c:56:9:
54. *dst++ = *src++;
55. if (len <= size)
56. *dst = 0;
^
57. return len + strlen(src) - 1;
58. }
libavutil/avstring.c:57:5:
55. if (len <= size)
56. *dst = 0;
57. return len + strlen(src) - 1;
^
58. }
59.
libavutil/avstring.c:58:1: return from a call to av_strlcpy
56. *dst = 0;
57. return len + strlen(src) - 1;
58. }
^
59.
60. size_t av_strlcat(char *dst, const char *src, size_t size)
ffmpeg.c:3288:10:
3286. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3287.
3288. if (!strcmp(file_oformat->name, "ffm") &&
^
3289. av_strstart(filename, "http:", NULL)) {
3290. /* special case for files sent to ffserver: we get the stream
|
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L3288
|
d2a_code_trace_data_44094
|
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
{
int16_t weight[8][64];
DCTELEM orig[8][64];
const int mb_x= s->mb_x;
const int mb_y= s->mb_y;
int i;
int skip_dct[8];
int dct_offset = s->linesize*8;
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int wrap_y, wrap_c;
for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct;
if(s->adaptive_quant){
const int last_qp= s->qscale;
const int mb_xy= mb_x + mb_y*s->mb_stride;
s->lambda= s->lambda_table[mb_xy];
update_qscale(s);
if(!(s->flags&CODEC_FLAG_QP_RD)){
s->qscale= s->current_picture_ptr->qscale_table[mb_xy];
s->dquant= s->qscale - last_qp;
if(s->out_format==FMT_H263){
s->dquant= av_clip(s->dquant, -2, 2);
if(s->codec_id==CODEC_ID_MPEG4){
if(!s->mb_intra){
if(s->pict_type == FF_B_TYPE){
if(s->dquant&1 || s->mv_dir&MV_DIRECT)
s->dquant= 0;
}
if(s->mv_type==MV_TYPE_8X8)
s->dquant=0;
}
}
}
}
ff_set_qscale(s, last_qp + s->dquant);
}else if(s->flags&CODEC_FLAG_QP_RD)
ff_set_qscale(s, s->qscale + s->dquant);
wrap_y = s->linesize;
wrap_c = s->uvlinesize;
ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16;
ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
uint8_t *ebuf= s->edge_emu_buffer + 32;
ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height);
ptr_y= ebuf;
ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cb= ebuf+18*wrap_y;
ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cr= ebuf+18*wrap_y+8;
}
if (s->mb_intra) {
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400;
if(progressive_score > 0){
interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.get_pixels(s->block[0], ptr_y , wrap_y);
s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y);
s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y);
s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
}
}
}else{
op_pixels_func (*op_pix)[4];
qpel_mc_func (*op_qpix)[16];
uint8_t *dest_y, *dest_cb, *dest_cr;
dest_y = s->dest[0];
dest_cb = s->dest[1];
dest_cr = s->dest[2];
if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
op_pix = s->dsp.put_pixels_tab;
op_qpix= s->dsp.put_qpel_pixels_tab;
}else{
op_pix = s->dsp.put_no_rnd_pixels_tab;
op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_FORWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
op_pix = s->dsp.avg_pixels_tab;
op_qpix= s->dsp.avg_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_BACKWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
}
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400;
if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400;
if(progressive_score>0){
interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y);
s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y);
s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y);
s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
}
}
if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){
if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1;
if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1;
if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
if(!s->chroma_y_shift){
if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
}
}
}
if(s->avctx->quantizer_noise_shaping){
if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y);
if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y);
if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y);
if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c);
if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c);
if(!s->chroma_y_shift){
if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
}
memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
}
assert(s->out_format!=FMT_MJPEG || s->qscale==8);
{
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
int overflow;
s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]);
}else
s->block_last_index[i]= -1;
}
if(s->avctx->quantizer_noise_shaping){
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale);
}
}
}
if(s->luma_elim_threshold && !s->mb_intra)
for(i=0; i<4; i++)
dct_single_coeff_elimination(s, i, s->luma_elim_threshold);
if(s->chroma_elim_threshold && !s->mb_intra)
for(i=4; i<mb_block_count; i++)
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
if(s->flags & CODEC_FLAG_CBP_RD){
for(i=0;i<mb_block_count;i++) {
if(s->block_last_index[i] == -1)
s->coded_score[i]= INT_MAX/256;
}
}
}
if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){
s->block_last_index[4]=
s->block_last_index[5]= 0;
s->block[4][0]=
s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
}
if(s->alternate_scan && s->dct_quantize != dct_quantize_c){
for(i=0; i<mb_block_count; i++){
int j;
if(s->block_last_index[i]>0){
for(j=63; j>0; j--){
if(s->block[i][ s->intra_scantable.permutated[j] ]) break;
}
s->block_last_index[i]= j;
}
}
}
switch(s->codec_id){
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER)
mpeg1_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MPEG4:
if (ENABLE_MPEG4_ENCODER)
mpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MSMPEG4V2:
case CODEC_ID_MSMPEG4V3:
case CODEC_ID_WMV1:
if (ENABLE_MSMPEG4_ENCODER)
msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_WMV2:
if (ENABLE_WMV2_ENCODER)
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H261:
if (ENABLE_H261_ENCODER)
ff_h261_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_FLV1:
case CODEC_ID_RV10:
case CODEC_ID_RV20:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER ||
ENABLE_FLV_ENCODER || ENABLE_RV10_ENCODER || ENABLE_RV20_ENCODER)
h263_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MJPEG:
if (ENABLE_MJPEG_ENCODER)
ff_mjpeg_encode_mb(s, s->block);
break;
default:
assert(0);
}
}
libavcodec/mpegvideo_enc.c:1640: error: Uninitialized Value
The value read from skip_dct[_] was never initialized.
libavcodec/mpegvideo_enc.c:1640:13:
1638. if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y);
1639. if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y);
1640. if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y);
^
1641. if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
1642. if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1640
|
d2a_code_trace_data_44095
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
crypto/sm2/sm2_sign.c:137: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`.
Showing all 22 steps of the trace
crypto/sm2/sm2_sign.c:135:14: Call
133. continue;
134.
135. if (!BN_add(s, dA, BN_value_one())
^
136. || !BN_mod_inverse(s, s, order, ctx)
137. || !BN_mod_mul(tmp, dA, r, order, ctx)
crypto/bn/bn_add.c:28:19: Call
26. if (cmp_res > 0) {
27. r_neg = a->neg;
28. ret = BN_usub(r, a, b);
^
29. } else if (cmp_res < 0) {
30. r_neg = b->neg;
crypto/bn/bn_add.c:125:1: Parameter `r->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/sm2/sm2_sign.c:136:21: Call
134.
135. if (!BN_add(s, dA, BN_value_one())
136. || !BN_mod_inverse(s, s, order, ctx)
^
137. || !BN_mod_mul(tmp, dA, r, order, ctx)
138. || !BN_sub(tmp, k, tmp)
crypto/bn/bn_gcd.c:124:1: Parameter `a->top`
122. BN_CTX *ctx);
123.
124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
126. {
crypto/bn/bn_gcd.c:129:10: Call
127. BIGNUM *rv;
128. int noinv;
129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
^
130. if (noinv)
131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);
crypto/bn/bn_gcd.c:135:1: Parameter `a->top`
133. }
134.
135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
137. int *pnoinv)
crypto/sm2/sm2_sign.c:137:21: Call
135. if (!BN_add(s, dA, BN_value_one())
136. || !BN_mod_inverse(s, s, order, ctx)
137. || !BN_mod_mul(tmp, dA, r, order, ctx)
^
138. || !BN_sub(tmp, k, tmp)
139. || !BN_mod_mul(s, s, tmp, order, ctx)) {
crypto/bn/bn_mod.c:73:1: Parameter `a->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:116:5: Assignment
114. rp[0] = rp[max - 1] = 0;
115. rp++;
116. j = n;
^
117.
118. if (--j > 0) {
crypto/bn/bn_sqr.c:118:9: Assignment
116. j = n;
117.
118. if (--j > 0) {
^
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
115. rp++;
^
116. j = n;
117.
crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
|
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_sqr.c/#L120
|
d2a_code_trace_data_44096
|
static int wc3_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
Wc3DemuxContext *wc3 = s->priv_data;
ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
AVStream *st;
unsigned char preamble[WC3_PREAMBLE_SIZE];
int ret = 0;
int current_palette = 0;
int bytes_to_read;
int i;
unsigned char rotate;
wc3->width = WC3_DEFAULT_WIDTH;
wc3->height = WC3_DEFAULT_HEIGHT;
wc3->palettes = NULL;
wc3->palette_count = 0;
wc3->pts = 0;
wc3->video_stream_index = wc3->audio_stream_index = 0;
url_fseek(pb, 12, SEEK_CUR);
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
return AVERROR(EIO);
fourcc_tag = AV_RL32(&preamble[0]);
size = (AV_RB32(&preamble[4]) + 1) & (~1);
do {
switch (fourcc_tag) {
case SOND_TAG:
case INDX_TAG:
url_fseek(pb, size, SEEK_CUR);
break;
case PC__TAG:
url_fseek(pb, 8, SEEK_CUR);
if ((ret = get_buffer(pb, preamble, 4)) != 4)
return AVERROR(EIO);
wc3->palette_count = AV_RL32(&preamble[0]);
if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){
wc3->palette_count= 0;
return -1;
}
wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);
break;
case BNAM_TAG:
if ((unsigned)size < 512)
bytes_to_read = size;
else
bytes_to_read = 512;
if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read)
return AVERROR(EIO);
break;
case SIZE_TAG:
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
return AVERROR(EIO);
wc3->width = AV_RL32(&preamble[0]);
wc3->height = AV_RL32(&preamble[4]);
break;
case PALT_TAG:
if ((unsigned)current_palette >= wc3->palette_count)
return AVERROR_INVALIDDATA;
if ((ret = get_buffer(pb,
&wc3->palettes[current_palette * PALETTE_SIZE],
PALETTE_SIZE)) != PALETTE_SIZE)
return AVERROR(EIO);
for (i = current_palette * PALETTE_SIZE;
i < (current_palette + 1) * PALETTE_SIZE; i++) {
rotate = ((wc3->palettes[i] << 2) & 0xFF) |
((wc3->palettes[i] >> 6) & 0xFF);
wc3->palettes[i] = wc3_pal_lookup[rotate];
}
current_palette++;
break;
default:
av_log(s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n",
preamble[0], preamble[1], preamble[2], preamble[3],
preamble[0], preamble[1], preamble[2], preamble[3]);
return AVERROR_INVALIDDATA;
break;
}
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
return AVERROR(EIO);
fourcc_tag = AV_RL32(&preamble[0]);
size = (AV_RB32(&preamble[4]) + 1) & (~1);
} while (fourcc_tag != BRCH_TAG);
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
wc3->video_stream_index = st->index;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_XAN_WC3;
st->codec->codec_tag = 0;
st->codec->width = wc3->width;
st->codec->height = wc3->height;
st->codec->palctrl = &wc3->palette_control;
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
wc3->audio_stream_index = st->index;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_PCM_S16LE;
st->codec->codec_tag = 1;
st->codec->channels = WC3_AUDIO_CHANNELS;
st->codec->bits_per_sample = WC3_AUDIO_BITS;
st->codec->sample_rate = WC3_SAMPLE_RATE;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
return 0;
}
libavformat/wc3movie.c:178: error: Integer Overflow L2
([-oo, 5592404] × 768):signed32.
libavformat/wc3movie.c:173:13: <LHS trace>
171. if ((ret = get_buffer(pb, preamble, 4)) != 4)
172. return AVERROR(EIO);
173. wc3->palette_count = AV_RL32(&preamble[0]);
^
174. if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){
175. wc3->palette_count= 0;
libavformat/wc3movie.c:173:13: Assignment
171. if ((ret = get_buffer(pb, preamble, 4)) != 4)
172. return AVERROR(EIO);
173. wc3->palette_count = AV_RL32(&preamble[0]);
^
174. if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){
175. wc3->palette_count= 0;
libavformat/wc3movie.c:178:29: Binary operation: ([-oo, 5592404] × 768):signed32
176. return -1;
177. }
178. wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);
^
179. break;
180.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/wc3movie.c/#L178
|
d2a_code_trace_data_44097
|
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;
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":"", avctx->frame_number+1, s->qps[0]);
s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] ||
avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL : AVDISCARD_NONKEY);
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 (ff_thread_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 (avctx->frame_number == 0)
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 (ff_thread_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));
ff_thread_finish_setup(avctx);
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->avctx->height);
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->current_frame;
if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME))
update_frames(avctx);
return buf_size;
error:
ff_thread_report_progress(&s->current_frame, INT_MAX, 0);
if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME))
avctx->release_buffer(avctx, &s->current_frame);
return -1;
}
libavcodec/vp3.c:1856: error: Null Dereference
pointer `&gb->buffer` last assigned on line 1848 could be null and is dereferenced by call to `get_bits1()` at line 1856, column 20.
libavcodec/vp3.c:1838:1: start of procedure vp3_decode_frame()
1836. * This is the ffmpeg/libavcodec API frame decode function.
1837. */
1838. static int vp3_decode_frame(AVCodecContext *avctx,
^
1839. void *data, int *data_size,
1840. AVPacket *avpkt)
libavcodec/vp3.c:1842:5:
1840. AVPacket *avpkt)
1841. {
1842. const uint8_t *buf = avpkt->data;
^
1843. int buf_size = avpkt->size;
1844. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1843:5:
1841. {
1842. const uint8_t *buf = avpkt->data;
1843. int buf_size = avpkt->size;
^
1844. Vp3DecodeContext *s = avctx->priv_data;
1845. GetBitContext gb;
libavcodec/vp3.c:1844:5:
1842. const uint8_t *buf = avpkt->data;
1843. int buf_size = avpkt->size;
1844. Vp3DecodeContext *s = avctx->priv_data;
^
1845. GetBitContext gb;
1846. int i;
libavcodec/vp3.c:1848:5:
1846. int i;
1847.
1848. init_get_bits(&gb, buf, buf_size * 8);
^
1849.
1850. if (s->theora && get_bits1(&gb))
libavcodec/get_bits.h:391:1: start of procedure init_get_bits()
389. * responsible for checking for the buffer end yourself (take advantage of the padding)!
390. */
391. static inline void init_get_bits(GetBitContext *s,
^
392. const uint8_t *buffer, int bit_size)
393. {
libavcodec/get_bits.h:394:5:
392. const uint8_t *buffer, int bit_size)
393. {
394. int buffer_size = (bit_size+7)>>3;
^
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
libavcodec/get_bits.h:395:9: Taking true branch
393. {
394. int buffer_size = (bit_size+7)>>3;
395. if (buffer_size < 0 || bit_size < 0) {
^
396. buffer_size = bit_size = 0;
397. buffer = NULL;
libavcodec/get_bits.h:396:9:
394. int buffer_size = (bit_size+7)>>3;
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
^
397. buffer = NULL;
398. }
libavcodec/get_bits.h:397:9:
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
397. buffer = NULL;
^
398. }
399.
libavcodec/get_bits.h:400:5:
398. }
399.
400. s->buffer = buffer;
^
401. s->size_in_bits = bit_size;
402. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:401:5:
399.
400. s->buffer = buffer;
401. s->size_in_bits = bit_size;
^
402. s->buffer_end = buffer + buffer_size;
403. #ifdef ALT_BITSTREAM_READER
libavcodec/get_bits.h:402:5:
400. s->buffer = buffer;
401. s->size_in_bits = bit_size;
402. s->buffer_end = buffer + buffer_size;
^
403. #ifdef ALT_BITSTREAM_READER
404. s->index = 0;
libavcodec/get_bits.h:404:5:
402. s->buffer_end = buffer + buffer_size;
403. #ifdef ALT_BITSTREAM_READER
404. s->index = 0;
^
405. #elif defined A32_BITSTREAM_READER
406. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3);
libavcodec/get_bits.h:410:1: return from a call to init_get_bits
408. skip_bits_long(s, 0);
409. #endif
410. }
^
411.
412. static inline void align_get_bits(GetBitContext *s)
libavcodec/vp3.c:1850:9: Taking false branch
1848. init_get_bits(&gb, buf, buf_size * 8);
1849.
1850. if (s->theora && get_bits1(&gb))
^
1851. {
1852. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/vp3.c:1856:20:
1854. }
1855.
1856. s->keyframe = !get_bits1(&gb);
^
1857. if (!s->theora)
1858. skip_bits(&gb, 1);
libavcodec/get_bits.h:311:1: start of procedure get_bits1()
309. }
310.
311. static inline unsigned int get_bits1(GetBitContext *s){
^
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
libavcodec/get_bits.h:313:5:
311. static inline unsigned int get_bits1(GetBitContext *s){
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
^
314. uint8_t result = s->buffer[index>>3];
315. #ifdef ALT_BITSTREAM_READER_LE
libavcodec/get_bits.h:314:5:
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
314. uint8_t result = s->buffer[index>>3];
^
315. #ifdef ALT_BITSTREAM_READER_LE
316. result >>= index & 7;
|
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/libavcodec/vp3.c/#L1856
|
d2a_code_trace_data_44098
|
void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
AVIOContext *pb = s->pb;
if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
(s->flags & AVFMT_FLAG_CUSTOM_IO))
pb = NULL;
flush_packet_queue(s);
if (s->iformat)
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
*ps = NULL;
avio_close(pb);
}
libavformat/utils.c:2495: error: Null Dereference
pointer `pb` last assigned on line 2483 could be null and is dereferenced by call to `avio_close()` at line 2495, column 5.
libavformat/utils.c:2476:1: start of procedure avformat_close_input()
2474. }
2475.
2476. void avformat_close_input(AVFormatContext **ps)
^
2477. {
2478. AVFormatContext *s = *ps;
libavformat/utils.c:2478:5:
2476. void avformat_close_input(AVFormatContext **ps)
2477. {
2478. AVFormatContext *s = *ps;
^
2479. AVIOContext *pb = s->pb;
2480.
libavformat/utils.c:2479:5:
2477. {
2478. AVFormatContext *s = *ps;
2479. AVIOContext *pb = s->pb;
^
2480.
2481. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
libavformat/utils.c:2481:10: Taking true branch
2479. AVIOContext *pb = s->pb;
2480.
2481. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2482. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2483. pb = NULL;
libavformat/utils.c:2481:24: Taking false branch
2479. AVIOContext *pb = s->pb;
2480.
2481. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2482. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2483. pb = NULL;
libavformat/utils.c:2482:10: Taking true branch
2480.
2481. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2482. (s->flags & AVFMT_FLAG_CUSTOM_IO))
^
2483. pb = NULL;
2484.
libavformat/utils.c:2483:9:
2481. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2482. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2483. pb = NULL;
^
2484.
2485. flush_packet_queue(s);
libavformat/utils.c:2485:5: Skipping flush_packet_queue(): empty list of specs
2483. pb = NULL;
2484.
2485. flush_packet_queue(s);
^
2486.
2487. if (s->iformat)
libavformat/utils.c:2487:9: Taking true branch
2485. flush_packet_queue(s);
2486.
2487. if (s->iformat)
^
2488. if (s->iformat->read_close)
2489. s->iformat->read_close(s);
libavformat/utils.c:2488:13: Taking true branch
2486.
2487. if (s->iformat)
2488. if (s->iformat->read_close)
^
2489. s->iformat->read_close(s);
2490.
libavformat/utils.c:2489:13: Skipping __function_pointer__(): unresolved function pointer
2487. if (s->iformat)
2488. if (s->iformat->read_close)
2489. s->iformat->read_close(s);
^
2490.
2491. avformat_free_context(s);
libavformat/utils.c:2491:5: Skipping avformat_free_context(): empty list of specs
2489. s->iformat->read_close(s);
2490.
2491. avformat_free_context(s);
^
2492.
2493. *ps = NULL;
libavformat/utils.c:2493:5:
2491. avformat_free_context(s);
2492.
2493. *ps = NULL;
^
2494.
2495. avio_close(pb);
libavformat/utils.c:2495:5:
2493. *ps = NULL;
2494.
2495. avio_close(pb);
^
2496. }
2497.
libavformat/aviobuf.c:800:1: start of procedure avio_close()
798. }
799.
800. int avio_close(AVIOContext *s)
^
801. {
802. URLContext *h;
libavformat/aviobuf.c:804:10: Taking false branch
802. URLContext *h;
803.
804. if (!s)
^
805. return 0;
806.
libavformat/aviobuf.c:807:5:
805. return 0;
806.
807. avio_flush(s);
^
808. h = s->opaque;
809. av_freep(&s->buffer);
libavformat/aviobuf.c:180:1: start of procedure avio_flush()
178. }
179.
180. void avio_flush(AVIOContext *s)
^
181. {
182. flush_buffer(s);
libavformat/aviobuf.c:182:5:
180. void avio_flush(AVIOContext *s)
181. {
182. flush_buffer(s);
^
183. s->must_flush = 0;
184. }
libavformat/aviobuf.c:124:1: start of procedure flush_buffer()
122. }
123.
124. static void flush_buffer(AVIOContext *s)
^
125. {
126. if (s->buf_ptr > s->buffer) {
libavformat/aviobuf.c:126:9:
124. static void flush_buffer(AVIOContext *s)
125. {
126. if (s->buf_ptr > s->buffer) {
^
127. if (s->write_packet && !s->error) {
128. int ret = s->write_packet(s->opaque, s->buffer,
|
https://github.com/libav/libav/blob/b263f8ffe7599d9cd27ec477a12700da8eb2790d/libavformat/utils.c/#L2495
|
d2a_code_trace_data_44099
|
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_reneg.c:58: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 7]):unsigned64 by call to `WPACKET_memcpy`.
Showing all 10 steps of the trace
ssl/t1_reneg.c:57:17: Call
55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate)
56. || !WPACKET_start_sub_packet_u16(pkt)
57. || !WPACKET_start_sub_packet_u8(pkt)
^
58. || !WPACKET_memcpy(pkt, s->s3->previous_client_finished,
59. s->s3->previous_client_finished_len)
ssl/packet.c:205:1: Parameter `pkt->buf->length`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/t1_reneg.c:58:17: Call
56. || !WPACKET_start_sub_packet_u16(pkt)
57. || !WPACKET_start_sub_packet_u8(pkt)
58. || !WPACKET_memcpy(pkt, s->s3->previous_client_finished,
^
59. s->s3->previous_client_finished_len)
60. || !WPACKET_memcpy(pkt, s->s3->previous_server_finished,
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] - [pkt->written, pkt->written + 7]):unsigned64 by call to `WPACKET_memcpy`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27. size_t reflen;
|
https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25
|
d2a_code_trace_data_44100
|
static int epzs_motion_search4(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int P[10][2],
int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d, dmin;
int map_generation;
const int penalty_factor= c->penalty_factor;
const int size=1;
const int h=8;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
int flags= c->flags;
LOAD_COMMON2
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
map_generation= update_map_generation(c);
dmin = 1000000;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
}else{
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}
if(dmin>64*4){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1167: error: Uninitialized Value
The value read from xmax was never initialized.
libavcodec/motion_est_template.c:1167:9:
1165. //FIXME try some early stop
1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
^
1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1167
|
d2a_code_trace_data_44101
|
void
TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
{
register unsigned char *cp;
register unsigned char t;
assert(sizeof(uint32)==4);
while (n-- > 0) {
cp = (unsigned char *)lp;
t = cp[3]; cp[3] = cp[0]; cp[0] = t;
t = cp[2]; cp[2] = cp[1]; cp[1] = t;
lp++;
}
}
tools/thumbnail.c:616: error: Buffer Overrun L3
Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, +oo] by call to `TIFFWriteDirectory`.
tools/thumbnail.c:563:1: Parameter `out->tif_dir.td_samplesperpixel`
561. }
562.
563. static int
^
564. generateThumbnail(TIFF* in, TIFF* out)
565. {
tools/thumbnail.c:615:13: Call
613. diroff[0] = 0UL;
614. TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);
615. return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&
^
616. TIFFWriteDirectory(out) != -1);
617. }
libtiff/tif_write.c:183:1: Parameter `tif->tif_dir.td_samplesperpixel`
181. * NB: Image length must be setup before writing.
182. */
183. tmsize_t
^
184. TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
185. {
tools/thumbnail.c:616:13: Call
614. TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);
615. return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&
616. TIFFWriteDirectory(out) != -1);
^
617. }
618.
libtiff/tif_dirwrite.c:163:1: Parameter `tif->tif_dir.td_samplesperpixel`
161. * storage that's been changed.
162. */
163. int
^
164. TIFFWriteDirectory(TIFF* tif)
165. {
libtiff/tif_dirwrite.c:166:9: Call
164. TIFFWriteDirectory(TIFF* tif)
165. {
166. return TIFFWriteDirectorySec(tif,TRUE,TRUE,NULL);
^
167. }
168.
libtiff/tif_dirwrite.c:345:1: Parameter `tif->tif_dir.td_samplesperpixel`
343. }
344.
345. static int
^
346. TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
347. {
libtiff/tif_dirwrite.c:555:10: Call
553. if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE))
554. {
555. if (!TIFFWriteDirectoryTagSampleformatPerSample(tif,&ndir,dir,TIFFTAG_SMINSAMPLEVALUE,tif->tif_dir.td_sminsamplevalue))
^
556. goto bad;
557. }
libtiff/tif_dirwrite.c:897:1: Parameter `tif->tif_dir.td_samplesperpixel`
895. }
896.
897. static int
^
898. TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
899. {
libtiff/tif_dirwrite.c:913:12: Call
911. return(TIFFWriteDirectoryTagSshortPerSample(tif,ndir,dir,tag,(int16)value));
912. else
913. return(TIFFWriteDirectoryTagSlongPerSample(tif,ndir,dir,tag,(int32)value));
^
914. case SAMPLEFORMAT_UINT:
915. if (tif->tif_dir.td_bitspersample<=8)
libtiff/tif_dirwrite.c:1218:1: Parameter `tif->tif_dir.td_samplesperpixel`
1216. }
1217.
1218. static int
^
1219. TIFFWriteDirectoryTagSlongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value)
1220. {
libtiff/tif_dirwrite.c:1231:4: Call
1229. return(1);
1230. }
1231. m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int32));
^
1232. if (m==NULL)
1233. {
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:1231:2: Assignment
1229. return(1);
1230. }
1231. m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int32));
^
1232. if (m==NULL)
1233. {
libtiff/tif_dirwrite.c:1239:4: Call
1237. for (na=m, nb=0; nb<tif->tif_dir.td_samplesperpixel; na++, nb++)
1238. *na=value;
1239. o=TIFFWriteDirectoryTagCheckedSlongArray(tif,ndir,dir,tag,tif->tif_dir.td_samplesperpixel,m);
^
1240. _TIFFfree(m);
1241. return(o);
libtiff/tif_dirwrite.c:1897:1: Parameter `*value`
1895. #endif
1896.
1897. static int
^
1898. TIFFWriteDirectoryTagCheckedSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value)
1899. {
libtiff/tif_dirwrite.c:1903:3: Call
1901. assert(sizeof(int32)==4);
1902. if (tif->tif_flags&TIFF_SWAB)
1903. TIFFSwabArrayOfLong((uint32*)value,count);
^
1904. return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG,count,count*4,value));
1905. }
libtiff/tif_swab.c:104:1: <Length trace>
102.
103. #ifndef TIFFSwabArrayOfLong
104. void
^
105. TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
106. {
libtiff/tif_swab.c:104:1: Parameter `*lp`
102.
103. #ifndef TIFFSwabArrayOfLong
104. void
^
105. TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
106. {
libtiff/tif_swab.c:112:3: Assignment
110. /* XXX unroll loop some */
111. while (n-- > 0) {
112. cp = (unsigned char *)lp;
^
113. t = cp[3]; cp[3] = cp[0]; cp[0] = t;
114. t = cp[2]; cp[2] = cp[1]; cp[1] = t;
libtiff/tif_swab.c:113:7: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, +oo] by call to `TIFFWriteDirectory`
111. while (n-- > 0) {
112. cp = (unsigned char *)lp;
113. t = cp[3]; cp[3] = cp[0]; cp[0] = t;
^
114. t = cp[2]; cp[2] = cp[1]; cp[1] = t;
115. lp++;
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L113
|
d2a_code_trace_data_44102
|
int test_kron(BIO *bp, BN_CTX *ctx)
{
BN_GENCB cb;
BIGNUM *a, *b, *r, *t;
int i;
int legendre, kronecker;
int ret = 0;
a = BN_new();
b = BN_new();
r = BN_new();
t = BN_new();
if (a == NULL || b == NULL || r == NULL || t == NULL)
goto err;
BN_GENCB_set(&cb, genprime_cb, NULL);
if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb))
goto err;
b->neg = rand_neg();
putc('\n', stderr);
for (i = 0; i < num0; i++) {
if (!BN_bntest_rand(a, 512, 0, 0))
goto err;
a->neg = rand_neg();
if (!BN_copy(t, b))
goto err;
t->neg = 0;
if (!BN_sub_word(t, 1))
goto err;
if (!BN_rshift1(t, t))
goto err;
b->neg = 0;
if (!BN_mod_exp_recp(r, a, t, b, ctx))
goto err;
b->neg = 1;
if (BN_is_word(r, 1))
legendre = 1;
else if (BN_is_zero(r))
legendre = 0;
else {
if (!BN_add_word(r, 1))
goto err;
if (0 != BN_ucmp(r, b)) {
fprintf(stderr, "Legendre symbol computation failed\n");
goto err;
}
legendre = -1;
}
kronecker = BN_kronecker(a, b, ctx);
if (kronecker < -1)
goto err;
if (a->neg && b->neg)
kronecker = -kronecker;
if (legendre != kronecker) {
fprintf(stderr, "legendre != kronecker; a = ");
BN_print_fp(stderr, a);
fprintf(stderr, ", b = ");
BN_print_fp(stderr, b);
fprintf(stderr, "\n");
goto err;
}
putc('.', stderr);
fflush(stderr);
}
putc('\n', stderr);
fflush(stderr);
ret = 1;
err:
BN_free(a);
BN_free(b);
BN_free(r);
BN_free(t);
return ret;
}
test/bntest.c:1743: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1661, column 9 is not reachable after line 1743, column 5.
Showing all 116 steps of the trace
test/bntest.c:1653:1: start of procedure test_kron()
1651. }
1652.
1653. > int test_kron(BIO *bp, BN_CTX *ctx)
1654. {
1655. BN_GENCB cb;
test/bntest.c:1659:5:
1657. int i;
1658. int legendre, kronecker;
1659. > int ret = 0;
1660.
1661. a = BN_new();
test/bntest.c:1661:5:
1659. int ret = 0;
1660.
1661. > a = BN_new();
1662. b = BN_new();
1663. r = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1662:5:
1660.
1661. a = BN_new();
1662. > b = BN_new();
1663. r = BN_new();
1664. t = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1663:5:
1661. a = BN_new();
1662. b = BN_new();
1663. > r = BN_new();
1664. t = BN_new();
1665. if (a == NULL || b == NULL || r == NULL || t == NULL)
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1664:5:
1662. b = BN_new();
1663. r = BN_new();
1664. > t = BN_new();
1665. if (a == NULL || b == NULL || r == NULL || t == NULL)
1666. goto err;
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1665:9: Taking false branch
1663. r = BN_new();
1664. t = BN_new();
1665. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1666. goto err;
1667.
test/bntest.c:1665:22: Taking false branch
1663. r = BN_new();
1664. t = BN_new();
1665. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1666. goto err;
1667.
test/bntest.c:1665:35: Taking false branch
1663. r = BN_new();
1664. t = BN_new();
1665. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1666. goto err;
1667.
test/bntest.c:1665:48: Taking false branch
1663. r = BN_new();
1664. t = BN_new();
1665. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1666. goto err;
1667.
test/bntest.c:1668:5:
1666. goto err;
1667.
1668. > BN_GENCB_set(&cb, genprime_cb, NULL);
1669.
1670. /*
crypto/bn/bn_lib.c:981:1: start of procedure BN_GENCB_set()
979.
980. /* Populate a BN_GENCB structure with a "new"-style callback */
981. > void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
982. void *cb_arg)
983. {
crypto/bn/bn_lib.c:984:5:
982. void *cb_arg)
983. {
984. > BN_GENCB *tmp_gencb = gencb;
985. tmp_gencb->ver = 2;
986. tmp_gencb->arg = cb_arg;
crypto/bn/bn_lib.c:985:5:
983. {
984. BN_GENCB *tmp_gencb = gencb;
985. > tmp_gencb->ver = 2;
986. tmp_gencb->arg = cb_arg;
987. tmp_gencb->cb.cb_2 = callback;
crypto/bn/bn_lib.c:986:5:
984. BN_GENCB *tmp_gencb = gencb;
985. tmp_gencb->ver = 2;
986. > tmp_gencb->arg = cb_arg;
987. tmp_gencb->cb.cb_2 = callback;
988. }
crypto/bn/bn_lib.c:987:5:
985. tmp_gencb->ver = 2;
986. tmp_gencb->arg = cb_arg;
987. > tmp_gencb->cb.cb_2 = callback;
988. }
989.
crypto/bn/bn_lib.c:988:1: return from a call to BN_GENCB_set
986. tmp_gencb->arg = cb_arg;
987. tmp_gencb->cb.cb_2 = callback;
988. > }
989.
990. void *BN_GENCB_get_arg(BN_GENCB *cb)
test/bntest.c:1680:10: Taking true branch
1678. */
1679.
1680. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb))
^
1681. goto err;
1682. b->neg = rand_neg();
test/bntest.c:1742:2:
1740. fflush(stderr);
1741. ret = 1;
1742. > err:
1743. BN_free(a);
1744. BN_free(b);
test/bntest.c:1743:5:
1741. ret = 1;
1742. err:
1743. > BN_free(a);
1744. BN_free(b);
1745. BN_free(r);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1743
|
d2a_code_trace_data_44103
|
int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt=0;
int i;
int y=0,M=0,d=0,h=0,m=0,s=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 ( (v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9'))
s= (v[12]-'0')*10+(v[13]-'0');
if (BIO_printf(bp,"%s %2d %02d:%02d:%02d %d%s",
mon[M-1],d,h,m,s,y,(gmt)?" GMT":"") <= 0)
return(0);
else
return(1);
err:
BIO_write(bp,"Bad time value",14);
return(0);
}
apps/x509.c:783: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `X509_print_ex`.
Showing all 13 steps of the trace
apps/x509.c:567:3: Call
565. pkey = X509_REQ_get_pubkey(req);
566. X509_set_pubkey(x,pkey);
567. EVP_PKEY_free(pkey);
^
568. }
569. else
crypto/evp/p_lib.c:286:1: Parameter `**x->pkey.rsa->ex_data.sk->data`
284. }
285.
286. > void EVP_PKEY_free(EVP_PKEY *x)
287. {
288. int i;
apps/x509.c:783:5: Call
781. else if (text == i)
782. {
783. X509_print_ex(out,x,nmflag, certflag);
^
784. }
785. else if (startdate == i)
crypto/asn1/t_x509.c:101:1: Parameter `*x->cert_info->validity->notBefore->data`
99. }
100.
101. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
102. {
103. long l;
crypto/asn1/t_x509.c:184:8: Call
182. if (BIO_write(bp,"\n Validity\n",18) <= 0) goto err;
183. if (BIO_write(bp," Not Before: ",24) <= 0) goto err;
184. if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
^
185. if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err;
186. if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
crypto/asn1/t_x509.c:314:1: Parameter `*tm->data`
312. }
313.
314. > int ASN1_TIME_print(BIO *bp, ASN1_TIME *tm)
315. {
316. if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);
crypto/asn1/t_x509.c:318:12: Call
316. if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);
317. if(tm->type == V_ASN1_GENERALIZEDTIME)
318. return ASN1_GENERALIZEDTIME_print(bp, tm);
^
319. BIO_write(bp,"Bad time value",14);
320. return(0);
crypto/asn1/t_x509.c:329:1: <Offset trace>
327. };
328.
329. > int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm)
330. {
331. char *v;
crypto/asn1/t_x509.c:329:1: Parameter `*tm->data`
327. };
328.
329. > int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm)
330. {
331. char *v;
crypto/asn1/t_x509.c:344:2: Assignment
342. if ((v[i] > '9') || (v[i] < '0')) goto err;
343. y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0');
344. M= (v[4]-'0')*10+(v[5]-'0');
^
345. if ((M > 12) || (M < 1)) goto err;
346. d= (v[6]-'0')*10+(v[7]-'0');
crypto/asn1/t_x509.c:323:1: <Length trace>
321. }
322.
323. > static const char *mon[12]=
324. {
325. "Jan","Feb","Mar","Apr","May","Jun",
crypto/asn1/t_x509.c:323:1: Array declaration
321. }
322.
323. > static const char *mon[12]=
324. {
325. "Jan","Feb","Mar","Apr","May","Jun",
crypto/asn1/t_x509.c:354:3: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print_ex`
352.
353. if (BIO_printf(bp,"%s %2d %02d:%02d:%02d %d%s",
354. mon[M-1],d,h,m,s,y,(gmt)?" GMT":"") <= 0)
^
355. return(0);
356. else
|
https://github.com/openssl/openssl/blob/5f97f508e450af9d53e3a01b59b13e9e7b540720/crypto/asn1/t_x509.c/#L354
|
d2a_code_trace_data_44104
|
void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
if(!(--ref->buf->refcount))
ref->buf->free(ref->buf);
av_free(ref->video);
av_free(ref);
}
libavfilter/defaults.c:106: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`.
libavfilter/defaults.c:106:13: Call
104. if(out) {
105. if(out->out_buf) {
106. avfilter_unref_buffer(out->out_buf);
^
107. out->out_buf = NULL;
108. }
libavfilter/avfilter.c:61:1: <LHS trace>
59. }
60.
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
62. {
63. if(!(--ref->buf->refcount))
libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount`
59. }
60.
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
62. {
63. if(!(--ref->buf->refcount))
libavfilter/avfilter.c:63:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
62. {
63. if(!(--ref->buf->refcount))
^
64. ref->buf->free(ref->buf);
65. av_free(ref->video);
|
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L63
|
d2a_code_trace_data_44105
|
int test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b[2], *c, *d, *e;
int i, j, s = 0, t, ret = 0;
int p0[] = { 163, 7, 6, 3, 0, -1 };
int p1[] = { 193, 15, 0, -1 };
a = BN_new();
b[0] = BN_new();
b[1] = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_GF2m_arr2poly(p0, b[0]);
BN_GF2m_arr2poly(p1, b[1]);
for (i = 0; i < num0; i++) {
BN_bntest_rand(a, 512, 0, 0);
for (j = 0; j < 2; j++) {
t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx);
if (t) {
s++;
BN_GF2m_mod_sqr(d, c, b[j], ctx);
BN_GF2m_add(d, c, d);
BN_GF2m_mod(e, a, b[j]);
BN_GF2m_add(e, e, d);
if (!BN_is_zero(e)) {
fprintf(stderr,
"GF(2^m) modular solve quadratic test failed!\n");
goto err;
}
}
}
}
if (s == 0) {
fprintf(stderr,
"All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n",
num0);
fprintf(stderr,
"this is very unlikely and probably indicates an error.\n");
goto err;
}
ret = 1;
err:
BN_free(a);
BN_free(b[0]);
BN_free(b[1]);
BN_free(c);
BN_free(d);
BN_free(e);
return ret;
}
test/bntest.c:1617: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1575, column 9 is not reachable after line 1617, column 5.
Showing all 157 steps of the trace
test/bntest.c:1568:1: start of procedure test_gf2m_mod_solve_quad()
1566. }
1567.
1568. > int test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx)
1569. {
1570. BIGNUM *a, *b[2], *c, *d, *e;
test/bntest.c:1571:5:
1569. {
1570. BIGNUM *a, *b[2], *c, *d, *e;
1571. > int i, j, s = 0, t, ret = 0;
1572. int p0[] = { 163, 7, 6, 3, 0, -1 };
1573. int p1[] = { 193, 15, 0, -1 };
test/bntest.c:1572:5:
1570. BIGNUM *a, *b[2], *c, *d, *e;
1571. int i, j, s = 0, t, ret = 0;
1572. > int p0[] = { 163, 7, 6, 3, 0, -1 };
1573. int p1[] = { 193, 15, 0, -1 };
1574.
test/bntest.c:1573:5:
1571. int i, j, s = 0, t, ret = 0;
1572. int p0[] = { 163, 7, 6, 3, 0, -1 };
1573. > int p1[] = { 193, 15, 0, -1 };
1574.
1575. a = BN_new();
test/bntest.c:1575:5:
1573. int p1[] = { 193, 15, 0, -1 };
1574.
1575. > a = BN_new();
1576. b[0] = BN_new();
1577. b[1] = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1576:5:
1574.
1575. a = BN_new();
1576. > b[0] = BN_new();
1577. b[1] = BN_new();
1578. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1577:5:
1575. a = BN_new();
1576. b[0] = BN_new();
1577. > b[1] = BN_new();
1578. c = BN_new();
1579. d = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1578:5:
1576. b[0] = BN_new();
1577. b[1] = BN_new();
1578. > c = BN_new();
1579. d = BN_new();
1580. e = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1579:5:
1577. b[1] = BN_new();
1578. c = BN_new();
1579. > d = BN_new();
1580. e = BN_new();
1581.
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1580:5:
1578. c = BN_new();
1579. d = BN_new();
1580. > e = BN_new();
1581.
1582. BN_GF2m_arr2poly(p0, b[0]);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1582:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1580. e = BN_new();
1581.
1582. BN_GF2m_arr2poly(p0, b[0]);
^
1583. BN_GF2m_arr2poly(p1, b[1]);
1584.
test/bntest.c:1583:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1581.
1582. BN_GF2m_arr2poly(p0, b[0]);
1583. BN_GF2m_arr2poly(p1, b[1]);
^
1584.
1585. for (i = 0; i < num0; i++) {
test/bntest.c:1585:10:
1583. BN_GF2m_arr2poly(p1, b[1]);
1584.
1585. > for (i = 0; i < num0; i++) {
1586. BN_bntest_rand(a, 512, 0, 0);
1587. for (j = 0; j < 2; j++) {
test/bntest.c:1585:17: Loop condition is false. Leaving loop
1583. BN_GF2m_arr2poly(p1, b[1]);
1584.
1585. for (i = 0; i < num0; i++) {
^
1586. BN_bntest_rand(a, 512, 0, 0);
1587. for (j = 0; j < 2; j++) {
test/bntest.c:1607:9: Taking true branch
1605. }
1606. }
1607. if (s == 0) {
^
1608. fprintf(stderr,
1609. "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n",
test/bntest.c:1608:9:
1606. }
1607. if (s == 0) {
1608. > fprintf(stderr,
1609. "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n",
1610. num0);
test/bntest.c:1611:9:
1609. "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n",
1610. num0);
1611. > fprintf(stderr,
1612. "this is very unlikely and probably indicates an error.\n");
1613. goto err;
test/bntest.c:1616:2:
1614. }
1615. ret = 1;
1616. > err:
1617. BN_free(a);
1618. BN_free(b[0]);
test/bntest.c:1617:5:
1615. ret = 1;
1616. err:
1617. > BN_free(a);
1618. BN_free(b[0]);
1619. BN_free(b[1]);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1617
|
d2a_code_trace_data_44106
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:1167: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`.
Showing all 13 steps of the trace
test/bntest.c:1167:17: Call
1165. || !TEST_true(BN_add(ret, a, a))
1166. || !equalBN("A + A", lshift1, ret)
1167. || !TEST_true(BN_mul(ret, a, two, ctx))
^
1168. || !equalBN("A * 2", lshift1, ret)
1169. || !TEST_true(BN_div(ret, remainder, lshift1, two, ctx))
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44107
|
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
{
SSL_COMP *comp;
if (cm == NULL || cm->type == NID_undef)
return 1;
if (id < 193 || id > 255)
{
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
return 0;
}
MemCheck_off();
comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
comp->id=id;
comp->method=cm;
load_builtin_compressions();
if (ssl_comp_methods
&& !sk_SSL_COMP_find(ssl_comp_methods,comp))
{
OPENSSL_free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_DUPLICATE_COMPRESSION_ID);
return(1);
}
else if ((ssl_comp_methods == NULL)
|| !sk_SSL_COMP_push(ssl_comp_methods,comp))
{
OPENSSL_free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE);
return(1);
}
else
{
MemCheck_on();
return(0);
}
}
ssl/ssl_ciph.c:1714: error: NULL_DEREFERENCE
pointer `comp` last assigned on line 1713 could be null and is dereferenced at line 1714, column 2.
Showing all 44 steps of the trace
ssl/ssl_ciph.c:1693:1: start of procedure SSL_COMP_add_compression_method()
1691. }
1692.
1693. > int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
1694. {
1695. SSL_COMP *comp;
ssl/ssl_ciph.c:1697:13: Taking false branch
1695. SSL_COMP *comp;
1696.
1697. if (cm == NULL || cm->type == NID_undef)
^
1698. return 1;
1699.
ssl/ssl_ciph.c:1697:27: Taking false branch
1695. SSL_COMP *comp;
1696.
1697. if (cm == NULL || cm->type == NID_undef)
^
1698. return 1;
1699.
ssl/ssl_ciph.c:1706:6: Taking false branch
1704. 64 to 192: external party methods assigned by IANA
1705. 193 to 255: reserved for private use */
1706. if (id < 193 || id > 255)
^
1707. {
1708. SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
ssl/ssl_ciph.c:1706:18: Taking false branch
1704. 64 to 192: external party methods assigned by IANA
1705. 193 to 255: reserved for private use */
1706. if (id < 193 || id > 255)
^
1707. {
1708. SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
ssl/ssl_ciph.c:1712:2:
1710. }
1711.
1712. > MemCheck_off();
1713. comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1714. comp->id=id;
crypto/mem_dbg.c:216:1: start of procedure CRYPTO_mem_ctrl()
214. }
215.
216. > int CRYPTO_mem_ctrl(int mode)
217. {
218. int ret=mh_mode;
crypto/mem_dbg.c:218:2:
216. int CRYPTO_mem_ctrl(int mode)
217. {
218. > int ret=mh_mode;
219.
220. CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
crypto/mem_dbg.c:220:2:
218. int ret=mh_mode;
219.
220. > CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
221. switch (mode)
222. {
crypto/cryptlib.c:557:1: start of procedure CRYPTO_lock()
555. #endif
556.
557. > void CRYPTO_lock(int mode, int type, const char *file, int line)
558. {
559. #ifdef LOCK_DEBUG
crypto/cryptlib.c:584:6: Taking false branch
582. }
583. #endif
584. if (type < 0)
^
585. {
586. if (dynlock_lock_callback != NULL)
crypto/cryptlib.c:599:7: Taking true branch
597. }
598. else
599. if (locking_callback != NULL)
^
600. locking_callback(mode,type,file,line);
601. }
crypto/cryptlib.c:600:4: Skipping __function_pointer__(): unresolved function pointer
598. else
599. if (locking_callback != NULL)
600. locking_callback(mode,type,file,line);
^
601. }
602.
crypto/cryptlib.c:584:2:
582. }
583. #endif
584. > if (type < 0)
585. {
586. if (dynlock_lock_callback != NULL)
crypto/cryptlib.c:601:2: return from a call to CRYPTO_lock
599. if (locking_callback != NULL)
600. locking_callback(mode,type,file,line);
601. }
^
602.
603. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/mem_dbg.c:221:2:
219.
220. CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
221. > switch (mode)
222. {
223. /* for applications (not to be called while multiple threads
crypto/mem_dbg.c:225:2: Switch condition is false. Skipping switch case
223. /* for applications (not to be called while multiple threads
224. * use the library): */
225. case CRYPTO_MEM_CHECK_ON: /* aka MemCheck_start() */
^
226. mh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE;
227. num_disable = 0;
crypto/mem_dbg.c:229:2: Switch condition is false. Skipping switch case
227. num_disable = 0;
228. break;
229. case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */
^
230. mh_mode = 0;
231. num_disable = 0; /* should be true *before* MemCheck_stop is used,
crypto/mem_dbg.c:236:2: Switch condition is true. Entering switch case
234.
235. /* switch off temporarily (for library-internal use): */
236. case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
^
237. if (mh_mode & CRYPTO_MEM_CHECK_ON)
238. {
crypto/mem_dbg.c:237:7: Taking false branch
235. /* switch off temporarily (for library-internal use): */
236. case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
237. if (mh_mode & CRYPTO_MEM_CHECK_ON)
^
238. {
239. CRYPTO_THREADID cur;
crypto/mem_dbg.c:282:2:
280. break;
281. }
282. > CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
283. return(ret);
284. }
crypto/cryptlib.c:557:1: start of procedure CRYPTO_lock()
555. #endif
556.
557. > void CRYPTO_lock(int mode, int type, const char *file, int line)
558. {
559. #ifdef LOCK_DEBUG
crypto/cryptlib.c:584:6: Taking false branch
582. }
583. #endif
584. if (type < 0)
^
585. {
586. if (dynlock_lock_callback != NULL)
crypto/cryptlib.c:599:7: Taking true branch
597. }
598. else
599. if (locking_callback != NULL)
^
600. locking_callback(mode,type,file,line);
601. }
crypto/cryptlib.c:600:4: Skipping __function_pointer__(): unresolved function pointer
598. else
599. if (locking_callback != NULL)
600. locking_callback(mode,type,file,line);
^
601. }
602.
crypto/cryptlib.c:584:2:
582. }
583. #endif
584. > if (type < 0)
585. {
586. if (dynlock_lock_callback != NULL)
crypto/cryptlib.c:601:2: return from a call to CRYPTO_lock
599. if (locking_callback != NULL)
600. locking_callback(mode,type,file,line);
601. }
^
602.
603. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/mem_dbg.c:283:2:
281. }
282. CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
283. > return(ret);
284. }
285.
crypto/mem_dbg.c:284:2: return from a call to CRYPTO_mem_ctrl
282. CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
283. return(ret);
284. }
^
285.
286. int CRYPTO_is_mem_check_on(void)
ssl/ssl_ciph.c:1713:2:
1711.
1712. MemCheck_off();
1713. > comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1714. comp->id=id;
1715. comp->method=cm;
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 true branch
299.
300. allow_customize = 0;
301. if (malloc_debug_func != NULL)
^
302. {
303. allow_customize_debug = 0;
crypto/mem.c:303:3:
301. if (malloc_debug_func != NULL)
302. {
303. > allow_customize_debug = 0;
304. malloc_debug_func(NULL, num, file, line, 0);
305. }
crypto/mem.c:304:3: Skipping __function_pointer__(): unresolved function pointer
302. {
303. allow_customize_debug = 0;
304. malloc_debug_func(NULL, num, file, line, 0);
^
305. }
306. ret = malloc_ex_func(num,file,line);
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 true 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:311:3: Skipping __function_pointer__(): unresolved function pointer
309. #endif
310. if (malloc_debug_func != NULL)
311. malloc_debug_func(ret, num, file, line, 1);
^
312.
313. #ifndef OPENSSL_CPUID_OBJ
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/ssl_ciph.c:1714:2:
1712. MemCheck_off();
1713. comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1714. > comp->id=id;
1715. comp->method=cm;
1716. load_builtin_compressions();
|
https://github.com/openssl/openssl/blob/c2c99e2860566044b23a5b3fded6f70b7436b9ad/ssl/ssl_ciph.c/#L1714
|
d2a_code_trace_data_44108
|
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:312: error: USE_AFTER_FREE
call to `sk_PKCS12_SAFEBAG_free()` eventually accesses memory that was invalidated by call to `free()` on line 310 indirectly during the call to `sk_PKCS12_SAFEBAG_push()`.
Showing all 22 steps of the trace
crypto/pkcs12/p12_crt.c:303:18: invalidation part of the trace starts here
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:303:18: passed as argument to `sk_PKCS12_SAFEBAG_new_null`
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:303:18: return from call to `sk_PKCS12_SAFEBAG_new_null`
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:303:9: assigned
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:310:10: when calling `sk_PKCS12_SAFEBAG_push` here
308. free_bags = 0;
309.
310. if (!sk_PKCS12_SAFEBAG_push(*pbags, bag)) {
^
311. if (free_bags) {
312. sk_PKCS12_SAFEBAG_free(*pbags);
include/openssl/pkcs12.h:126:1: parameter `sk` of sk_PKCS12_SAFEBAG_push
124. } PKCS12_SAFEBAG;
125.
126. > DEFINE_STACK_OF(PKCS12_SAFEBAG)
127.
128. typedef struct pkcs12_bag_st {
include/openssl/pkcs12.h:126:1: when calling `sk_push` here
124. } PKCS12_SAFEBAG;
125.
126. > DEFINE_STACK_OF(PKCS12_SAFEBAG)
127.
128. typedef struct pkcs12_bag_st {
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:303:18: use-after-lifetime part of the trace starts here
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:303:18: passed as argument to `sk_PKCS12_SAFEBAG_new_null`
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:303:18: return from call to `sk_PKCS12_SAFEBAG_new_null`
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:303:9: assigned
301. return 1;
302. if (!*pbags) {
303. *pbags = sk_PKCS12_SAFEBAG_new_null();
^
304. if (!*pbags)
305. return 0;
crypto/pkcs12/p12_crt.c:312:13: when calling `sk_PKCS12_SAFEBAG_free` here
310. if (!sk_PKCS12_SAFEBAG_push(*pbags, bag)) {
311. if (free_bags) {
312. sk_PKCS12_SAFEBAG_free(*pbags);
^
313. *pbags = NULL;
314. }
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_44109
|
static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
{
int i;
LHASH_NODE *a,*n;
if (lh == NULL)
return;
for (i=lh->num_nodes-1; i>=0; i--)
{
a=lh->b[i];
while (a != NULL)
{
n=a->next;
if(use_arg)
func_arg(a->data,arg);
else
func(a->data);
a=n;
}
}
}
ssl/bio_ssl.c:442: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `SSL_dup`.
Showing all 16 steps of the trace
ssl/bio_ssl.c:441:4: Call
439. dbio=(BIO *)ptr;
440. if (((BIO_SSL *)dbio->ptr)->ssl != NULL)
441. SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
^
442. ((BIO_SSL *)dbio->ptr)->ssl=SSL_dup(ssl);
443. ((BIO_SSL *)dbio->ptr)->renegotiate_count=
ssl/ssl_lib.c:472:1: Parameter `s->initial_ctx->sessions->num_nodes`
470. }
471.
472. > void SSL_free(SSL *s)
473. {
474. int i;
ssl/bio_ssl.c:442:31: Call
440. if (((BIO_SSL *)dbio->ptr)->ssl != NULL)
441. SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
442. ((BIO_SSL *)dbio->ptr)->ssl=SSL_dup(ssl);
^
443. ((BIO_SSL *)dbio->ptr)->renegotiate_count=
444. ((BIO_SSL *)b->ptr)->renegotiate_count;
ssl/ssl_lib.c:2254:1: Parameter `s->ctx->sessions->num_nodes`
2252. }
2253.
2254. > SSL *SSL_dup(SSL *s)
2255. {
2256. STACK_OF(X509_NAME) *sk;
ssl/ssl_lib.c:2261:11: Call
2259. int i;
2260.
2261. if ((ret=SSL_new(SSL_get_SSL_CTX(s))) == NULL)
^
2262. return(NULL);
2263.
ssl/ssl_lib.c:264:1: Parameter `ctx->sessions->num_nodes`
262. }
263.
264. > SSL *SSL_new(SSL_CTX *ctx)
265. {
266. SSL *s;
ssl/ssl_lib.c:367:4: Call
365. ssl_cert_free(s->cert);
366. if (s->ctx != NULL)
367. SSL_CTX_free(s->ctx); /* decrement reference count */
^
368. OPENSSL_free(s);
369. }
ssl/ssl_lib.c:1563:1: Parameter `a->sessions->num_nodes`
1561. #endif
1562.
1563. > void SSL_CTX_free(SSL_CTX *a)
1564. {
1565. int i;
ssl/ssl_lib.c:1595:3: Call
1593. */
1594. if (a->sessions != NULL)
1595. SSL_CTX_flush_sessions(a,0);
^
1596.
1597. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:826:1: Parameter `s->sessions->num_nodes`
824. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION *, TIMEOUT_PARAM *)
825.
826. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
827. {
828. unsigned long i;
ssl/ssl_sess.c:838:2: Call
836. i=tp.cache->down_load;
837. tp.cache->down_load=0;
838. lh_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), &tp);
^
839. tp.cache->down_load=i;
840. CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);
crypto/lhash/lhash.c:303:1: Parameter `lh->num_nodes`
301. }
302.
303. > void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
304. {
305. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
crypto/lhash/lhash.c:305:2: Call
303. void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
304. {
305. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
^
306. }
307.
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, +oo] - 1):unsigned32 by call to `SSL_dup`
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/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/crypto/lhash/lhash.c/#L281
|
d2a_code_trace_data_44110
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_eay.c:448: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`.
Showing all 26 steps of the trace
crypto/rsa/rsa_eay.c:365:2: Call
363.
364. if ((ctx=BN_CTX_new()) == NULL) goto err;
365. BN_CTX_start(ctx);
^
366. f = BN_CTX_get(ctx);
367. ret = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/rsa/rsa_eay.c:448:8: Call
446.
447. if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)
448. if(!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx))
^
449. goto err;
450.
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_44111
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_gf2m.c:948: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 10 steps of the trace
crypto/bn/bn_gf2m.c:938:5: Call
936. }
937.
938. BN_CTX_start(ctx);
^
939. if ((u = BN_CTX_get(ctx)) == NULL)
940. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gf2m.c:948:5: Call
946.
947. err:
948. BN_CTX_end(ctx);
^
949. return ret;
950. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44112
|
static void BN_POOL_release(BN_POOL *p, unsigned int num)
{
unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
p->used -= num;
while (num--) {
bn_check_top(p->current->vals + offset);
if (offset == 0) {
offset = BN_CTX_POOL_SIZE - 1;
p->current = p->current->prev;
} else
offset--;
}
}
crypto/rsa/rsa_sp800_56b_check.c:179: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`.
Showing all 18 steps of the trace
crypto/rsa/rsa_sp800_56b_check.c:175:15: Call
173. ret = (gcd != NULL
174. /* LCM(p - 1, q - 1) */
175. && (rsa_get_lcm(ctx, rsa->p, rsa->q, lcm, gcd, p1, q1, p1q1) == 1)
^
176. /* (Step 6a) d < LCM(p - 1, q - 1) */
177. && (BN_cmp(rsa->d, lcm) < 0)
crypto/rsa/rsa_sp800_56b_check.c:220:1: Parameter `ctx->pool.used`
218.
219. /* return LCM(p-1, q-1) */
220. > int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q,
221. BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1,
222. BIGNUM *p1q1)
crypto/rsa/rsa_sp800_56b_check.c:179:14: Call
177. && (BN_cmp(rsa->d, lcm) < 0)
178. /* (Step 6b) 1 = (e . d) mod LCM(p - 1, q - 1) */
179. && BN_mod_mul(r, rsa->e, rsa->d, lcm, ctx)
^
180. && BN_is_one(r));
181.
crypto/bn/bn_mod.c:193:1: Parameter `ctx->pool.used`
191.
192. /* slow but works */
193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
194. BN_CTX *ctx)
195. {
crypto/bn/bn_mod.c:204:14: Call
202.
203. BN_CTX_start(ctx);
204. if ((t = BN_CTX_get(ctx)) == NULL)
^
205. goto err;
206. if (a == b) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mod.c:207:14: Call
205. goto err;
206. if (a == b) {
207. if (!BN_sqr(t, a, ctx))
^
208. goto err;
209. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `ctx->pool.used`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
crypto/bn/bn_sqr.c:19:15: Call
17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
^
20.
21. bn_correct_top(r);
crypto/bn/bn_sqr.c:27:1: Parameter `ctx->pool.used`
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:44:11: Call
42. BN_CTX_start(ctx);
43. rr = (a != r) ? r : BN_CTX_get(ctx);
44. tmp = BN_CTX_get(ctx);
^
45. if (rr == NULL || tmp == NULL)
46. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_sqr.c:104:5: Call
102. bn_check_top(rr);
103. bn_check_top(tmp);
104. BN_CTX_end(ctx);
^
105. return ret;
106. }
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:194:13: Call
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
194. BN_POOL_release(&ctx->pool, ctx->used - fp);
^
195. ctx->used = fp;
196. /* Unjam "too_many" in case "get" had failed */
crypto/bn/bn_ctx.c:338:1: <LHS trace>
336. }
337.
338. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
339. {
340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
crypto/bn/bn_ctx.c:338:1: Parameter `p->used`
336. }
337.
338. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
339. {
340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
crypto/bn/bn_ctx.c:340:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`
338. static void BN_POOL_release(BN_POOL *p, unsigned int num)
339. {
340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
^
341.
342. p->used -= num;
|
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L340
|
d2a_code_trace_data_44113
|
int ssl3_get_record(SSL *s)
{
int enc_err, rret;
int i;
size_t more, n;
SSL3_RECORD *rr, *thisrr;
SSL3_BUFFER *rbuf;
SSL_SESSION *sess;
unsigned char *p;
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int version;
size_t mac_size;
int imac_size;
size_t num_recs = 0, max_recs, j;
PACKET pkt, sslv2pkt;
size_t first_rec_len;
rr = RECORD_LAYER_get_rrec(&s->rlayer);
rbuf = RECORD_LAYER_get_rbuf(&s->rlayer);
max_recs = s->max_pipelines;
if (max_recs == 0)
max_recs = 1;
sess = s->session;
do {
thisrr = &rr[num_recs];
if ((RECORD_LAYER_get_rstate(&s->rlayer) != SSL_ST_READ_BODY) ||
(RECORD_LAYER_get_packet_length(&s->rlayer)
< SSL3_RT_HEADER_LENGTH)) {
size_t sslv2len;
unsigned int type;
rret = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
SSL3_BUFFER_get_len(rbuf), 0,
num_recs == 0 ? 1 : 0, &n);
if (rret <= 0)
return rret;
RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_BODY);
p = RECORD_LAYER_get_packet(&s->rlayer);
if (!PACKET_buf_init(&pkt, RECORD_LAYER_get_packet(&s->rlayer),
RECORD_LAYER_get_packet_length(&s->rlayer))) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
sslv2pkt = pkt;
if (!PACKET_get_net_2_len(&sslv2pkt, &sslv2len)
|| !PACKET_get_1(&sslv2pkt, &type)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
if (s->server && RECORD_LAYER_is_first_record(&s->rlayer)
&& (sslv2len & 0x8000) != 0
&& (type == SSL2_MT_CLIENT_HELLO)) {
thisrr->type = SSL3_RT_HANDSHAKE;
thisrr->rec_version = SSL2_VERSION;
thisrr->length = sslv2len & 0x7fff;
if (thisrr->length > SSL3_BUFFER_get_len(rbuf)
- SSL2_RT_HEADER_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_PACKET_LENGTH_TOO_LONG);
return -1;
}
if (thisrr->length < MIN_SSL2_RECORD_LEN) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
SSL_R_LENGTH_TOO_SHORT);
return -1;
}
} else {
if (s->msg_callback)
s->msg_callback(0, 0, SSL3_RT_HEADER, p, 5, s,
s->msg_callback_arg);
if (!PACKET_get_1(&pkt, &type)
|| !PACKET_get_net_2(&pkt, &version)
|| !PACKET_get_net_2_len(&pkt, &thisrr->length)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
thisrr->type = type;
thisrr->rec_version = version;
if (!s->first_packet && !SSL_IS_TLS13(s)
&& !s->hello_retry_request
&& version != (unsigned int)s->version) {
if ((s->version & 0xFF00) == (version & 0xFF00)
&& !s->enc_write_ctx && !s->write_hash) {
if (thisrr->type == SSL3_RT_ALERT) {
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
}
s->version = (unsigned short)version;
}
SSLfatal(s, SSL_AD_PROTOCOL_VERSION, SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
}
if ((version >> 8) != SSL3_VERSION_MAJOR) {
if (RECORD_LAYER_is_first_record(&s->rlayer)) {
p = RECORD_LAYER_get_packet(&s->rlayer);
if (strncmp((char *)p, "GET ", 4) == 0 ||
strncmp((char *)p, "POST ", 5) == 0 ||
strncmp((char *)p, "HEAD ", 5) == 0 ||
strncmp((char *)p, "PUT ", 4) == 0) {
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_HTTP_REQUEST);
return -1;
} else if (strncmp((char *)p, "CONNE", 5) == 0) {
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_HTTPS_PROXY_REQUEST);
return -1;
}
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
} else {
SSLfatal(s, SSL_AD_PROTOCOL_VERSION,
SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
}
}
if (SSL_IS_TLS13(s) && s->enc_read_ctx != NULL
&& thisrr->type != SSL3_RT_APPLICATION_DATA) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE,
SSL_F_SSL3_GET_RECORD, SSL_R_BAD_RECORD_TYPE);
return -1;
}
if (thisrr->length >
SSL3_BUFFER_get_len(rbuf) - SSL3_RT_HEADER_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_PACKET_LENGTH_TOO_LONG);
return -1;
}
}
}
if (SSL_IS_TLS13(s)) {
if (thisrr->length > SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_ENCRYPTED_LENGTH_TOO_LONG);
return -1;
}
} else {
size_t len = SSL3_RT_MAX_ENCRYPTED_LENGTH;
#ifndef OPENSSL_NO_COMP
if (s->expand == NULL)
len -= SSL3_RT_MAX_COMPRESSED_OVERHEAD;
#endif
if (thisrr->length > len) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_ENCRYPTED_LENGTH_TOO_LONG);
return -1;
}
}
if (thisrr->rec_version == SSL2_VERSION) {
more = thisrr->length + SSL2_RT_HEADER_LENGTH
- SSL3_RT_HEADER_LENGTH;
} else {
more = thisrr->length;
}
if (more > 0) {
rret = ssl3_read_n(s, more, more, 1, 0, &n);
if (rret <= 0)
return rret;
}
RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_HEADER);
if (thisrr->rec_version == SSL2_VERSION) {
thisrr->input =
&(RECORD_LAYER_get_packet(&s->rlayer)[SSL2_RT_HEADER_LENGTH]);
} else {
thisrr->input =
&(RECORD_LAYER_get_packet(&s->rlayer)[SSL3_RT_HEADER_LENGTH]);
}
thisrr->data = thisrr->input;
thisrr->orig_len = thisrr->length;
thisrr->read = 0;
num_recs++;
RECORD_LAYER_reset_packet_length(&s->rlayer);
RECORD_LAYER_clear_first_record(&s->rlayer);
} while (num_recs < max_recs
&& thisrr->type == SSL3_RT_APPLICATION_DATA
&& SSL_USE_EXPLICIT_IV(s)
&& s->enc_read_ctx != NULL
&& (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_read_ctx))
& EVP_CIPH_FLAG_PIPELINE)
&& ssl3_record_app_data_waiting(s));
if (SSL_READ_ETM(s) && s->read_hash) {
unsigned char *mac;
imac_size = EVP_MD_CTX_size(s->read_hash);
if (!ossl_assert(imac_size >= 0 && imac_size <= EVP_MAX_MD_SIZE)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_LIB_EVP);
return -1;
}
mac_size = (size_t)imac_size;
for (j = 0; j < num_recs; j++) {
thisrr = &rr[j];
if (thisrr->length < mac_size) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
SSL_R_LENGTH_TOO_SHORT);
return -1;
}
thisrr->length -= mac_size;
mac = thisrr->data + thisrr->length;
i = s->method->ssl3_enc->mac(s, thisrr, md, 0 );
if (i == 0 || CRYPTO_memcmp(md, mac, mac_size) != 0) {
SSLfatal(s, SSL_AD_BAD_RECORD_MAC, SSL_F_SSL3_GET_RECORD,
SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
return -1;
}
}
}
first_rec_len = rr[0].length;
enc_err = s->method->ssl3_enc->enc(s, rr, num_recs, 0);
if (enc_err == 0) {
if (ossl_statem_in_error(s)) {
return -1;
}
if (num_recs == 1 && ossl_statem_skip_early_data(s)) {
thisrr = &rr[0];
if (!early_data_count_ok(s, thisrr->length,
EARLY_DATA_CIPHERTEXT_OVERHEAD, 0)) {
return -1;
}
thisrr->length = 0;
thisrr->read = 1;
RECORD_LAYER_set_numrpipes(&s->rlayer, 1);
RECORD_LAYER_reset_read_sequence(&s->rlayer);
return 1;
}
SSLfatal(s, SSL_AD_DECRYPTION_FAILED, SSL_F_SSL3_GET_RECORD,
SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
return -1;
}
#ifdef SSL_DEBUG
printf("dec %"OSSLzu"\n", rr[0].length);
{
size_t z;
for (z = 0; z < rr[0].length; z++)
printf("%02X%c", rr[0].data[z], ((z + 1) % 16) ? ' ' : '\n');
}
printf("\n");
#endif
if ((sess != NULL) &&
(s->enc_read_ctx != NULL) &&
(!SSL_READ_ETM(s) && EVP_MD_CTX_md(s->read_hash) != NULL)) {
unsigned char *mac = NULL;
unsigned char mac_tmp[EVP_MAX_MD_SIZE];
mac_size = EVP_MD_CTX_size(s->read_hash);
if (!ossl_assert(mac_size <= EVP_MAX_MD_SIZE)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
for (j = 0; j < num_recs; j++) {
thisrr = &rr[j];
if (thisrr->orig_len < mac_size ||
(EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
thisrr->orig_len < mac_size + 1)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
SSL_R_LENGTH_TOO_SHORT);
return -1;
}
if (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE) {
mac = mac_tmp;
if (!ssl3_cbc_copy_mac(mac_tmp, thisrr, mac_size)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
thisrr->length -= mac_size;
} else {
thisrr->length -= mac_size;
mac = &thisrr->data[thisrr->length];
}
i = s->method->ssl3_enc->mac(s, thisrr, md, 0 );
if (i == 0 || mac == NULL
|| CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0)
enc_err = -1;
if (thisrr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + mac_size)
enc_err = -1;
}
}
if (enc_err < 0) {
if (ossl_statem_in_error(s)) {
return -1;
}
if (num_recs == 1 && ossl_statem_skip_early_data(s)) {
if (!early_data_count_ok(s, first_rec_len,
EARLY_DATA_CIPHERTEXT_OVERHEAD, 0)) {
return -1;
}
thisrr = &rr[0];
thisrr->length = 0;
thisrr->read = 1;
RECORD_LAYER_set_numrpipes(&s->rlayer, 1);
RECORD_LAYER_reset_read_sequence(&s->rlayer);
return 1;
}
SSLfatal(s, SSL_AD_BAD_RECORD_MAC, SSL_F_SSL3_GET_RECORD,
SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
return -1;
}
for (j = 0; j < num_recs; j++) {
thisrr = &rr[j];
if (s->expand != NULL) {
if (thisrr->length > SSL3_RT_MAX_COMPRESSED_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_COMPRESSED_LENGTH_TOO_LONG);
return -1;
}
if (!ssl3_do_uncompress(s, thisrr)) {
SSLfatal(s, SSL_AD_DECOMPRESSION_FAILURE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_DECOMPRESSION);
return -1;
}
}
if (SSL_IS_TLS13(s) && s->enc_read_ctx != NULL) {
size_t end;
if (thisrr->length == 0
|| thisrr->type != SSL3_RT_APPLICATION_DATA) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_RECORD_TYPE);
return -1;
}
for (end = thisrr->length - 1; end > 0 && thisrr->data[end] == 0;
end--)
continue;
thisrr->length = end;
thisrr->type = thisrr->data[end];
if (thisrr->type != SSL3_RT_APPLICATION_DATA
&& thisrr->type != SSL3_RT_ALERT
&& thisrr->type != SSL3_RT_HANDSHAKE) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_RECORD_TYPE);
return -1;
}
if (s->msg_callback)
s->msg_callback(0, s->version, SSL3_RT_INNER_CONTENT_TYPE,
&thisrr->data[end], 1, s, s->msg_callback_arg);
}
if (SSL_IS_TLS13(s)
&& (thisrr->type == SSL3_RT_HANDSHAKE
|| thisrr->type == SSL3_RT_ALERT)
&& thisrr->length == 0) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_LENGTH);
return -1;
}
if (thisrr->length > SSL3_RT_MAX_PLAIN_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_DATA_LENGTH_TOO_LONG);
return -1;
}
if (s->session != NULL && USE_MAX_FRAGMENT_LENGTH_EXT(s->session)
&& thisrr->length > GET_MAX_FRAGMENT_LENGTH(s->session)) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_DATA_LENGTH_TOO_LONG);
return -1;
}
thisrr->off = 0;
if (thisrr->length == 0) {
RECORD_LAYER_inc_empty_record_count(&s->rlayer);
if (RECORD_LAYER_get_empty_record_count(&s->rlayer)
> MAX_EMPTY_RECORDS) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_RECORD_TOO_SMALL);
return -1;
}
} else {
RECORD_LAYER_reset_empty_record_count(&s->rlayer);
}
}
if (s->early_data_state == SSL_EARLY_DATA_READING) {
thisrr = &rr[0];
if (thisrr->type == SSL3_RT_APPLICATION_DATA
&& !early_data_count_ok(s, thisrr->length, 0, 0)) {
return -1;
}
}
RECORD_LAYER_set_numrpipes(&s->rlayer, num_recs);
return 1;
}
ssl/record/ssl3_record.c:343: error: INTEGER_OVERFLOW_L2
([0, +oo] - 5):unsigned64.
Showing all 4 steps of the trace
ssl/record/ssl3_record.c:202:20: <LHS trace>
200. unsigned int type;
201.
202. rret = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
^
203. SSL3_BUFFER_get_len(rbuf), 0,
204. num_recs == 0 ? 1 : 0, &n);
ssl/record/ssl3_record.c:202:20: Call
200. unsigned int type;
201.
202. rret = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
^
203. SSL3_BUFFER_get_len(rbuf), 0,
204. num_recs == 0 ? 1 : 0, &n);
ssl/record/rec_layer_s3.c:169:1: Parameter `n`
167. * Return values are as per SSL_read()
168. */
169. > int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold,
170. size_t *readbytes)
171. {
ssl/record/ssl3_record.c:343:21: Binary operation: ([0, +oo] - 5):unsigned64
341. }
342.
343. if (thisrr->length >
^
344. SSL3_BUFFER_get_len(rbuf) - SSL3_RT_HEADER_LENGTH) {
345. SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
|
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/ssl3_record.c/#L343
|
d2a_code_trace_data_44114
|
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/exptest.c:162: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp_recp`.
Showing all 12 steps of the trace
test/exptest.c:159:10: Call
157. BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD);
158.
159. if (!TEST_true(BN_mod(a, a, m, ctx))
^
160. || !TEST_true(BN_mod(b, b, m, ctx))
161. || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL))
crypto/bn/bn_div.c:140:1: Parameter `rm->top`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
test/exptest.c:162:13: Call
160. || !TEST_true(BN_mod(b, b, m, ctx))
161. || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL))
162. || !TEST_true(BN_mod_exp_recp(r_recp, a, b, m, ctx))
^
163. || !TEST_true(BN_mod_exp_simple(r_simple, a, b, m, ctx))
164. || !TEST_true(BN_mod_exp_mont_consttime(r_mont_const, a, b, m, ctx, NULL)))
crypto/bn/bn_exp.c:158:1: Parameter `m->top`
156. }
157.
158. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
159. const BIGNUM *m, BN_CTX *ctx)
160. {
crypto/bn/bn_exp.c:195:14: Call
193. if (m->neg) {
194. /* ignore sign of 'm' */
195. if (!BN_copy(aa, m))
^
196. goto err;
197. aa->neg = 0;
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 `*a->d`
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:329:9: Call
327. if (a == b)
328. return a;
329. if (bn_wexpand(a, b->top) == NULL)
^
330. return NULL;
331.
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:333:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp_recp`
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/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/bn/bn_lib.c/#L333
|
d2a_code_trace_data_44115
|
int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
unsigned char *md_out,
size_t *md_out_size,
const unsigned char header[13],
const unsigned char *data,
size_t data_plus_mac_size,
size_t data_plus_mac_plus_padding_size,
const unsigned char *mac_secret,
size_t mac_secret_length, char is_sslv3)
{
union {
double align;
unsigned char c[sizeof(LARGEST_DIGEST_CTX)];
} md_state;
void (*md_final_raw) (void *ctx, unsigned char *md_out);
void (*md_transform) (void *ctx, const unsigned char *block);
size_t md_size, md_block_size = 64;
size_t sslv3_pad_length = 40, header_length, variance_blocks,
len, max_mac_bytes, num_blocks,
num_starting_blocks, k, mac_end_offset, c, index_a, index_b;
size_t bits;
unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES];
unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE];
unsigned char first_block[MAX_HASH_BLOCK_SIZE];
unsigned char mac_out[EVP_MAX_MD_SIZE];
size_t i, j;
unsigned md_out_size_u;
EVP_MD_CTX *md_ctx = NULL;
size_t md_length_size = 8;
char length_is_big_endian = 1;
int ret;
OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024);
switch (EVP_MD_CTX_type(ctx)) {
case NID_md5:
if (MD5_Init((MD5_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_md5_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))MD5_Transform;
md_size = 16;
sslv3_pad_length = 48;
length_is_big_endian = 0;
break;
case NID_sha1:
if (SHA1_Init((SHA_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha1_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA1_Transform;
md_size = 20;
break;
case NID_sha224:
if (SHA224_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 224 / 8;
break;
case NID_sha256:
if (SHA256_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 32;
break;
case NID_sha384:
if (SHA384_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 384 / 8;
md_block_size = 128;
md_length_size = 16;
break;
case NID_sha512:
if (SHA512_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 64;
md_block_size = 128;
md_length_size = 16;
break;
default:
OPENSSL_assert(0);
if (md_out_size)
*md_out_size = 0;
return 0;
}
OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES);
OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE);
OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE);
header_length = 13;
if (is_sslv3) {
header_length = mac_secret_length + sslv3_pad_length + 8 +
1 +
2 ;
}
variance_blocks = is_sslv3 ? 2 : 6;
len = data_plus_mac_plus_padding_size + header_length;
max_mac_bytes = len - md_size - 1;
num_blocks =
(max_mac_bytes + 1 + md_length_size + md_block_size -
1) / md_block_size;
num_starting_blocks = 0;
k = 0;
mac_end_offset = data_plus_mac_size + header_length - md_size;
c = mac_end_offset % md_block_size;
index_a = mac_end_offset / md_block_size;
index_b = (mac_end_offset + md_length_size) / md_block_size;
if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
num_starting_blocks = num_blocks - variance_blocks;
k = md_block_size * num_starting_blocks;
}
bits = 8 * mac_end_offset;
if (!is_sslv3) {
bits += 8 * md_block_size;
memset(hmac_pad, 0, md_block_size);
OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad));
memcpy(hmac_pad, mac_secret, mac_secret_length);
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x36;
md_transform(md_state.c, hmac_pad);
}
if (length_is_big_endian) {
memset(length_bytes, 0, md_length_size - 4);
length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 1] = (unsigned char)bits;
} else {
memset(length_bytes, 0, md_length_size);
length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 8] = (unsigned char)bits;
}
if (k > 0) {
if (is_sslv3) {
size_t overhang;
if (header_length <= md_block_size) {
return 0;
}
overhang = header_length - md_block_size;
md_transform(md_state.c, header);
memcpy(first_block, header + md_block_size, overhang);
memcpy(first_block + overhang, data, md_block_size - overhang);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size - 1; i++)
md_transform(md_state.c, data + md_block_size * i - overhang);
} else {
memcpy(first_block, header, 13);
memcpy(first_block + 13, data, md_block_size - 13);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size; i++)
md_transform(md_state.c, data + md_block_size * i - 13);
}
}
memset(mac_out, 0, sizeof(mac_out));
for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks;
i++) {
unsigned char block[MAX_HASH_BLOCK_SIZE];
unsigned char is_block_a = constant_time_eq_8_s(i, index_a);
unsigned char is_block_b = constant_time_eq_8_s(i, index_b);
for (j = 0; j < md_block_size; j++) {
unsigned char b = 0, is_past_c, is_past_cp1;
if (k < header_length)
b = header[k];
else if (k < data_plus_mac_plus_padding_size + header_length)
b = data[k - header_length];
k++;
is_past_c = is_block_a & constant_time_ge_8_s(j, c);
is_past_cp1 = is_block_a & constant_time_ge_8_s(j, c + 1);
b = constant_time_select_8(is_past_c, 0x80, b);
b = b & ~is_past_cp1;
b &= ~is_block_b | is_block_a;
if (j >= md_block_size - md_length_size) {
b = constant_time_select_8(is_block_b,
length_bytes[j -
(md_block_size -
md_length_size)], b);
}
block[j] = b;
}
md_transform(md_state.c, block);
md_final_raw(md_state.c, block);
for (j = 0; j < md_size; j++)
mac_out[j] |= block[j] & is_block_b;
}
md_ctx = EVP_MD_CTX_new();
if (md_ctx == NULL)
goto err;
if (EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL ) <= 0)
goto err;
if (is_sslv3) {
memset(hmac_pad, 0x5c, sslv3_pad_length);
if (EVP_DigestUpdate(md_ctx, mac_secret, mac_secret_length) <= 0
|| EVP_DigestUpdate(md_ctx, hmac_pad, sslv3_pad_length) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
} else {
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
if (EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
}
ret = EVP_DigestFinal(md_ctx, md_out, &md_out_size_u);
if (ret && md_out_size)
*md_out_size = md_out_size_u;
EVP_MD_CTX_free(md_ctx);
return 1;
err:
EVP_MD_CTX_free(md_ctx);
return 0;
}
ssl/record/ssl3_record.c:1038: error: BUFFER_OVERRUN_L2
Offset: [-oo, `ssl->s3->read_mac_secret_size` + 58] Size: 13 by call to `ssl3_cbc_digest_record`.
Showing all 7 steps of the trace
ssl/record/ssl3_record.c:978:1: Array declaration
976. }
977.
978. > int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int send)
979. {
980. unsigned char *seq;
ssl/record/ssl3_record.c:1038:13: Call
1036. */
1037. /* Final param == not SSLv3 */
1038. if (ssl3_cbc_digest_record(mac_ctx,
^
1039. md, &md_size,
1040. header, rec->input,
ssl/s3_cbc.c:129:1: <Offset trace>
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: Parameter `data_plus_mac_plus_padding_size`
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: <Length trace>
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: Parameter `*header`
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:408:21: Array access: Offset: [-oo, ssl->s3->read_mac_secret_size + 58] Size: 13 by call to `ssl3_cbc_digest_record`
406. unsigned char b = 0, is_past_c, is_past_cp1;
407. if (k < header_length)
408. b = header[k];
^
409. else if (k < data_plus_mac_plus_padding_size + header_length)
410. b = data[k - header_length];
|
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/s3_cbc.c/#L408
|
d2a_code_trace_data_44116
|
int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_one(b);
BN_zero(c);
if (BN_mod_exp(d, a, b, c, ctx)) {
fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
return 0;
}
BN_bntest_rand(c, 30, 0, 1);
for (i = 0; i < num2; i++) {
BN_bntest_rand(a, 20 + i * 5, 0, 0);
BN_bntest_rand(b, 2 + i, 0, 0);
if (!BN_mod_exp(d, a, b, c, ctx))
return (0);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " ^ ");
BN_print(bp, b);
BIO_puts(bp, " % ");
BN_print(bp, c);
BIO_puts(bp, " - ");
}
BN_print(bp, d);
BIO_puts(bp, "\n");
}
BN_exp(e, a, b, ctx);
BN_sub(e, e, d);
BN_div(a, b, e, c, ctx);
if (!BN_is_zero(b)) {
fprintf(stderr, "Modulo exponentiation test failed!\n");
return 0;
}
}
BN_hex2bn(&a, "050505050505");
BN_hex2bn(&b, "02");
BN_hex2bn(&c,
"4141414141414141414141274141414141414141414141414141414141414141"
"4141414141414141414141414141414141414141414141414141414141414141"
"4141414141414141414141800000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000001");
BN_mod_exp(d, a, b, c, ctx);
BN_mul(e, a, a, ctx);
if (BN_cmp(d, e)) {
fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n");
return 0;
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
return (1);
}
test/bntest.c:1040: error: MEMORY_LEAK
memory dynamically allocated to `c` by call to `BN_new()` at line 976, column 9 is not reachable after line 1040, column 1.
Showing all 145 steps of the trace
test/bntest.c:969:1: start of procedure test_mod_exp()
967. }
968.
969. > int test_mod_exp(BIO *bp, BN_CTX *ctx)
970. {
971. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:974:5:
972. int i;
973.
974. > a = BN_new();
975. b = BN_new();
976. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:975:5:
973.
974. a = BN_new();
975. > b = BN_new();
976. c = BN_new();
977. d = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:976:5:
974. a = BN_new();
975. b = BN_new();
976. > c = BN_new();
977. d = BN_new();
978. e = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:977:5:
975. b = BN_new();
976. c = BN_new();
977. > d = BN_new();
978. e = BN_new();
979.
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:978:5:
976. c = BN_new();
977. d = BN_new();
978. > e = BN_new();
979.
980. BN_one(a);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:980:5:
978. e = BN_new();
979.
980. > BN_one(a);
981. BN_one(b);
982. BN_zero(c);
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:981:5:
979.
980. BN_one(a);
981. > BN_one(b);
982. BN_zero(c);
983. if (BN_mod_exp(d, a, b, c, ctx)) {
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:982:5:
980. BN_one(a);
981. BN_one(b);
982. > BN_zero(c);
983. if (BN_mod_exp(d, a, b, c, ctx)) {
984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is false
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:983:9: Taking true branch
981. BN_one(b);
982. BN_zero(c);
983. if (BN_mod_exp(d, a, b, c, ctx)) {
^
984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
985. return 0;
test/bntest.c:984:9:
982. BN_zero(c);
983. if (BN_mod_exp(d, a, b, c, ctx)) {
984. > fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
985. return 0;
986. }
test/bntest.c:985:9:
983. if (BN_mod_exp(d, a, b, c, ctx)) {
984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
985. > return 0;
986. }
987.
test/bntest.c:1040:1: return from a call to test_mod_exp
1038. BN_free(e);
1039. return (1);
1040. > }
1041.
1042. int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1040
|
d2a_code_trace_data_44117
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/bn/bn_prime.c:208: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_rshift`.
Showing all 14 steps of the trace
crypto/bn/bn_prime.c:198:10: Call
196.
197. /* compute A1 := a - 1 */
198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1))
^
199. goto err;
200. /* compute A3 := a - 3 */
crypto/bn/bn_lib.c:285:1: Parameter `a->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:208:10: Call
206. while (!BN_is_bit_set(A1, k))
207. k++;
208. if (!BN_rshift(A1_odd, A1, k))
^
209. goto err;
210.
crypto/bn/bn_shift.c:122:1: Parameter `*r->d`
120. }
121.
122. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
123. {
124. int i, j, nw, lb, rb;
crypto/bn/bn_shift.c:145:13: Call
143. i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2;
144. if (r != a) {
145. if (bn_wexpand(r, i) == NULL)
^
146. return 0;
147. 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_lib.c:943:37: Call
941. BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
944. }
945.
crypto/bn/bn_lib.c:246:1: Parameter `*b->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_rshift`
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/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L233
|
d2a_code_trace_data_44118
|
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if (a == NULL || *a == '\0')
return 0;
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
continue;
if (i == 0 || i > INT_MAX / 4)
goto err;
num = i + neg;
if (bn == NULL)
return num;
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return 0;
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i;
m = 0;
h = 0;
while (j > 0) {
m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0;
l = (l << 4) | k;
if (--m <= 0) {
ret->d[h++] = l;
break;
}
}
j -= BN_BYTES * 2;
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return num;
err:
if (*bn == NULL)
BN_free(ret);
return 0;
}
test/sm2_internal_test.c:208: error: BUFFER_OVERRUN_L2
Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `create_EC_group`.
Showing all 9 steps of the trace
test/sm2_internal_test.c:208:9: Call
206. int testresult = 1;
207. EC_GROUP *test_group =
208. create_EC_group
^
209. ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3",
210. "787968B4FA32C3FD2417842E73BBFEFF2F3C848B6831D7E0EC65228B3937E498",
test/sm2_internal_test.c:74:1: Parameter `*cof_hex`
72. }
73.
74. > static EC_GROUP *create_EC_group(const char *p_hex, const char *a_hex,
75. const char *b_hex, const char *x_hex,
76. const char *y_hex, const char *order_hex,
test/sm2_internal_test.c:110:17: Call
108.
109. if (!TEST_true(BN_hex2bn(&order, order_hex))
110. || !TEST_true(BN_hex2bn(&cof, cof_hex))
^
111. || !TEST_true(EC_GROUP_set_generator(group, generator, order, cof)))
112. goto done;
crypto/bn/bn_print.c:141:10: <Offset trace>
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:141:10: Assignment
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:164:5: Assignment
162. goto err;
163.
164. j = i; /* least significant 'hex' */
^
165. m = 0;
166. h = 0;
crypto/bn/bn_print.c:126:1: <Length trace>
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:126:1: Parameter `*a`
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:171:17: Array access: Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `create_EC_group`
169. l = 0;
170. for (;;) {
171. c = a[j - m];
^
172. k = OPENSSL_hexchar2int(c);
173. if (k < 0)
|
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_print.c/#L171
|
d2a_code_trace_data_44119
|
void ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, unsigned md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
unsigned mac_end = rec->length;
unsigned mac_start = mac_end - md_size;
unsigned scan_start = 0;
unsigned i, j;
unsigned div_spoiler;
unsigned rotate_offset;
OPENSSL_assert(rec->orig_len >= md_size);
OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE);
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63);
#endif
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
div_spoiler = md_size >> 1;
div_spoiler <<= (sizeof(div_spoiler) - 1) * 8;
rotate_offset = (div_spoiler + mac_start - scan_start) % md_size;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i++) {
unsigned char mac_started = constant_time_ge_8(i, mac_start);
unsigned char mac_ended = constant_time_ge_8(i, mac_end);
unsigned char b = rec->data[i];
rotated_mac[j++] |= b & mac_started & ~mac_ended;
j &= constant_time_lt(j, md_size);
}
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt(rotate_offset, md_size);
}
#endif
}
ssl/record/ssl3_record.c:1621: error: INTEGER_OVERFLOW_L2
([0, 17728] - [256, 320]):unsigned32 by call to `dtls1_process_record`.
Showing all 11 steps of the trace
ssl/record/ssl3_record.c:1509:13: Unknown value from: non-const function
1507.
1508. if (s->msg_callback)
1509. s->msg_callback(0, 0, SSL3_RT_HEADER, p, DTLS1_RT_HEADER_LENGTH,
^
1510. s, s->msg_callback_arg);
1511.
ssl/record/ssl3_record.c:1524:9: Assignment
1522. p += 6;
1523.
1524. n2s(p, rr->length);
^
1525.
1526. /* Lets check version */
ssl/record/ssl3_record.c:1621:10: Call
1619. }
1620.
1621. if (!dtls1_process_record(s, bitmap)) {
^
1622. rr->length = 0;
1623. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */
ssl/record/ssl3_record.c:1276:1: Parameter `s->rlayer.rrec.length`
1274. }
1275.
1276. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap)
1277. {
1278. int i, al;
ssl/record/ssl3_record.c:1315:5: Assignment
1313. /* decrypt in place in 'rr->input' */
1314. rr->data = rr->input;
1315. rr->orig_len = rr->length;
^
1316.
1317. enc_err = s->method->ssl3_enc->enc(s, rr, 1, 0);
ssl/record/ssl3_record.c:1372:13: Call
1370. */
1371. mac = mac_tmp;
1372. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size);
^
1373. rr->length -= mac_size;
1374. } else {
ssl/record/ssl3_record.c:1199:1: <LHS trace>
1197. #define CBC_MAC_ROTATE_IN_PLACE
1198.
1199. > void ssl3_cbc_copy_mac(unsigned char *out,
1200. const SSL3_RECORD *rec, unsigned md_size)
1201. {
ssl/record/ssl3_record.c:1199:1: Parameter `md_size`
1197. #define CBC_MAC_ROTATE_IN_PLACE
1198.
1199. > void ssl3_cbc_copy_mac(unsigned char *out,
1200. const SSL3_RECORD *rec, unsigned md_size)
1201. {
ssl/record/ssl3_record.c:1199:1: <RHS trace>
1197. #define CBC_MAC_ROTATE_IN_PLACE
1198.
1199. > void ssl3_cbc_copy_mac(unsigned char *out,
1200. const SSL3_RECORD *rec, unsigned md_size)
1201. {
ssl/record/ssl3_record.c:1199:1: Parameter `md_size`
1197. #define CBC_MAC_ROTATE_IN_PLACE
1198.
1199. > void ssl3_cbc_copy_mac(unsigned char *out,
1200. const SSL3_RECORD *rec, unsigned md_size)
1201. {
ssl/record/ssl3_record.c:1232:9: Binary operation: ([0, 17728] - [256, 320]):unsigned32 by call to `dtls1_process_record`
1230. /* This information is public so it's safe to branch based on it. */
1231. if (rec->orig_len > md_size + 255 + 1)
1232. scan_start = rec->orig_len - (md_size + 255 + 1);
^
1233. /*
1234. * div_spoiler contains a multiple of md_size that is used to cause the
|
https://github.com/openssl/openssl/blob/1fb9fdc3027b27d8eb6a1e6a846435b070980770/ssl/record/ssl3_record.c/#L1232
|
d2a_code_trace_data_44120
|
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:1104: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 35]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 16 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:1101:14: Call
1099. tls1_get_formatlist(s, &pformats, &num_formats);
1100.
1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats)
^
1102. /* Sub-packet for formats extension */
1103. || !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:1103:21: Call
1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats)
1102. /* Sub-packet for formats extension */
1103. || !WPACKET_start_sub_packet_u16(pkt)
^
1104. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats)
1105. || !WPACKET_close(pkt)) {
ssl/packet.c:205:1: Parameter `pkt->written`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/t1_lib.c:1104:21: Call
1102. /* Sub-packet for formats extension */
1103. || !WPACKET_start_sub_packet_u16(pkt)
1104. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats)
^
1105. || !WPACKET_close(pkt)) {
1106. SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
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 + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 35]):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_44121
|
int dsa_paramgen_check_g(DSA *dsa)
{
BN_CTX *ctx;
BIGNUM *tmp;
BN_MONT_CTX *mont = NULL;
int rv = -1;
ctx = BN_CTX_new();
if (ctx == NULL)
return -1;
BN_CTX_start(ctx);
if (BN_cmp(dsa->g, BN_value_one()) <= 0)
return 0;
if (BN_cmp(dsa->g, dsa->p) >= 0)
return 0;
tmp = BN_CTX_get(ctx);
if (!tmp)
goto err;
if ((mont = BN_MONT_CTX_new()) == NULL)
goto err;
if (!BN_MONT_CTX_set(mont, dsa->p, ctx))
goto err;
if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont))
goto err;
if (!BN_cmp(tmp, BN_value_one()))
rv = 1;
else
rv = 0;
err:
BN_CTX_end(ctx);
BN_MONT_CTX_free(mont);
BN_CTX_free(ctx);
return rv;
}
crypto/dsa/dsa_gen.c:660: error: MEMORY_LEAK
memory dynamically allocated to `return` by call to `BN_CTX_new()` at line 653, column 11 is not reachable after line 660, column 9.
Showing all 77 steps of the trace
crypto/dsa/dsa_gen.c:647:1: start of procedure dsa_paramgen_check_g()
645. }
646.
647. > int dsa_paramgen_check_g(DSA *dsa)
648. {
649. BN_CTX *ctx;
crypto/dsa/dsa_gen.c:651:5:
649. BN_CTX *ctx;
650. BIGNUM *tmp;
651. > BN_MONT_CTX *mont = NULL;
652. int rv = -1;
653. ctx = BN_CTX_new();
crypto/dsa/dsa_gen.c:652:5:
650. BIGNUM *tmp;
651. BN_MONT_CTX *mont = NULL;
652. > int rv = -1;
653. ctx = BN_CTX_new();
654. if (ctx == NULL)
crypto/dsa/dsa_gen.c:653:5:
651. BN_MONT_CTX *mont = NULL;
652. int rv = -1;
653. > ctx = BN_CTX_new();
654. if (ctx == NULL)
655. return -1;
crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
187.
188.
189. > BN_CTX *BN_CTX_new(void)
190. {
191. BN_CTX *ret;
crypto/bn/bn_ctx.c:193:9:
191. BN_CTX *ret;
192.
193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:193:9: Taking false branch
191. BN_CTX *ret;
192.
193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/bn/bn_ctx.c:198:5:
196. }
197. /* Initialise the structure */
198. > BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. return ret;
crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
333. /***********/
334.
335. > static void BN_POOL_init(BN_POOL *p)
336. {
337. p->head = p->current = p->tail = NULL;
crypto/bn/bn_ctx.c:337:5:
335. static void BN_POOL_init(BN_POOL *p)
336. {
337. > p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. }
crypto/bn/bn_ctx.c:338:5:
336. {
337. p->head = p->current = p->tail = NULL;
338. > p->used = p->size = 0;
339. }
340.
crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
337. p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. > }
340.
341. static void BN_POOL_finish(BN_POOL *p)
crypto/bn/bn_ctx.c:199:5:
197. /* Initialise the structure */
198. BN_POOL_init(&ret->pool);
199. > BN_STACK_init(&ret->stack);
200. return ret;
201. }
crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
292. /************/
293.
294. > static void BN_STACK_init(BN_STACK *st)
295. {
296. st->indexes = NULL;
crypto/bn/bn_ctx.c:296:5:
294. static void BN_STACK_init(BN_STACK *st)
295. {
296. > st->indexes = NULL;
297. st->depth = st->size = 0;
298. }
crypto/bn/bn_ctx.c:297:5:
295. {
296. st->indexes = NULL;
297. > st->depth = st->size = 0;
298. }
299.
crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
296. st->indexes = NULL;
297. st->depth = st->size = 0;
298. > }
299.
300. static void BN_STACK_finish(BN_STACK *st)
crypto/bn/bn_ctx.c:200:5:
198. BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. > return ret;
201. }
202.
crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
199. BN_STACK_init(&ret->stack);
200. return ret;
201. > }
202.
203. BN_CTX *BN_CTX_secure_new(void)
crypto/dsa/dsa_gen.c:654:9: Taking false branch
652. int rv = -1;
653. ctx = BN_CTX_new();
654. if (ctx == NULL)
^
655. return -1;
656. BN_CTX_start(ctx);
crypto/dsa/dsa_gen.c:656:5:
654. if (ctx == NULL)
655. return -1;
656. > BN_CTX_start(ctx);
657. if (BN_cmp(dsa->g, BN_value_one()) <= 0)
658. return 0;
crypto/bn/bn_ctx.c:236:1: start of procedure BN_CTX_start()
234. }
235.
236. > void BN_CTX_start(BN_CTX *ctx)
237. {
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_ctx.c:240:9: Taking false branch
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
239. /* If we're already overflowing ... */
240. if (ctx->err_stack || ctx->too_many)
^
241. ctx->err_stack++;
242. /* (Try to) get a new frame pointer */
crypto/bn/bn_ctx.c:240:27: Taking false branch
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
239. /* If we're already overflowing ... */
240. if (ctx->err_stack || ctx->too_many)
^
241. ctx->err_stack++;
242. /* (Try to) get a new frame pointer */
crypto/bn/bn_ctx.c:243:15:
241. ctx->err_stack++;
242. /* (Try to) get a new frame pointer */
243. > else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
245. ctx->err_stack++;
crypto/bn/bn_ctx.c:307:1: start of procedure BN_STACK_push()
305.
306.
307. > static int BN_STACK_push(BN_STACK *st, unsigned int idx)
308. {
309. if (st->depth == st->size) {
crypto/bn/bn_ctx.c:309:9: Taking true branch
307. static int BN_STACK_push(BN_STACK *st, unsigned int idx)
308. {
309. if (st->depth == st->size) {
^
310. /* Need to expand */
311. unsigned int newsize =
crypto/bn/bn_ctx.c:312:13: Condition is false
310. /* Need to expand */
311. unsigned int newsize =
312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
^
313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
314. if (newitems == NULL)
crypto/bn/bn_ctx.c:311:9:
309. if (st->depth == st->size) {
310. /* Need to expand */
311. > unsigned int newsize =
312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
crypto/bn/bn_ctx.c:313:9:
311. unsigned int newsize =
312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
313. > unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
314. if (newitems == NULL)
315. return 0;
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:314:13: Taking false branch
312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
314. if (newitems == NULL)
^
315. return 0;
316. if (st->depth)
crypto/bn/bn_ctx.c:316:13: Taking false branch
314. if (newitems == NULL)
315. return 0;
316. if (st->depth)
^
317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
318. OPENSSL_free(st->indexes);
crypto/bn/bn_ctx.c:318:9:
316. if (st->depth)
317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
318. > OPENSSL_free(st->indexes);
319. st->indexes = newitems;
320. st->size = newsize;
crypto/mem.c:234:1: start of procedure CRYPTO_free()
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5:
243. }
244. #else
245. > free(str);
246. #endif
247. }
crypto/mem.c:247:1: return from a call to CRYPTO_free
245. free(str);
246. #endif
247. > }
248.
249. void CRYPTO_clear_free(void *str, size_t num)
crypto/bn/bn_ctx.c:319:9:
317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
318. OPENSSL_free(st->indexes);
319. > st->indexes = newitems;
320. st->size = newsize;
321. }
crypto/bn/bn_ctx.c:320:9:
318. OPENSSL_free(st->indexes);
319. st->indexes = newitems;
320. > st->size = newsize;
321. }
322. st->indexes[(st->depth)++] = idx;
crypto/bn/bn_ctx.c:322:5:
320. st->size = newsize;
321. }
322. > st->indexes[(st->depth)++] = idx;
323. return 1;
324. }
crypto/bn/bn_ctx.c:323:5:
321. }
322. st->indexes[(st->depth)++] = idx;
323. > return 1;
324. }
325.
crypto/bn/bn_ctx.c:324:1: return from a call to BN_STACK_push
322. st->indexes[(st->depth)++] = idx;
323. return 1;
324. > }
325.
326. static unsigned int BN_STACK_pop(BN_STACK *st)
crypto/bn/bn_ctx.c:243:15: Taking false branch
241. ctx->err_stack++;
242. /* (Try to) get a new frame pointer */
243. else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
^
244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
245. ctx->err_stack++;
crypto/bn/bn_ctx.c:240:5:
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
239. /* If we're already overflowing ... */
240. > if (ctx->err_stack || ctx->too_many)
241. ctx->err_stack++;
242. /* (Try to) get a new frame pointer */
crypto/bn/bn_ctx.c:248:1: return from a call to BN_CTX_start
246. }
247. CTXDBG_EXIT(ctx);
248. > }
249.
250. void BN_CTX_end(BN_CTX *ctx)
crypto/dsa/dsa_gen.c:657:9:
655. return -1;
656. BN_CTX_start(ctx);
657. > if (BN_cmp(dsa->g, BN_value_one()) <= 0)
658. return 0;
659. if (BN_cmp(dsa->g, dsa->p) >= 0)
crypto/bn/bn_lib.c:134:1: start of procedure BN_value_one()
132. #endif
133.
134. > const BIGNUM *BN_value_one(void)
135. {
136. static const BN_ULONG data_one = 1L;
crypto/bn/bn_lib.c:136:5:
134. const BIGNUM *BN_value_one(void)
135. {
136. > static const BN_ULONG data_one = 1L;
137. static const BIGNUM const_one =
138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
crypto/bn/bn_lib.c:137:5:
135. {
136. static const BN_ULONG data_one = 1L;
137. > static const BIGNUM const_one =
138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
139.
crypto/bn/bn_lib.c:140:5:
138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
139.
140. > return (&const_one);
141. }
142.
crypto/bn/bn_lib.c:141:1: return from a call to BN_value_one
139.
140. return (&const_one);
141. > }
142.
143. int BN_num_bits_word(BN_ULONG l)
crypto/dsa/dsa_gen.c:657:9: Taking false branch
655. return -1;
656. BN_CTX_start(ctx);
657. if (BN_cmp(dsa->g, BN_value_one()) <= 0)
^
658. return 0;
659. if (BN_cmp(dsa->g, dsa->p) >= 0)
crypto/dsa/dsa_gen.c:659:9: Taking true branch
657. if (BN_cmp(dsa->g, BN_value_one()) <= 0)
658. return 0;
659. if (BN_cmp(dsa->g, dsa->p) >= 0)
^
660. return 0;
661. tmp = BN_CTX_get(ctx);
crypto/dsa/dsa_gen.c:660:9:
658. return 0;
659. if (BN_cmp(dsa->g, dsa->p) >= 0)
660. > return 0;
661. tmp = BN_CTX_get(ctx);
662. if (!tmp)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/dsa/dsa_gen.c/#L660
|
d2a_code_trace_data_44122
|
static int kek_wrap_key(unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen,
EVP_CIPHER_CTX *ctx)
{
size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
size_t olen;
int dummy;
olen = (inlen + 4 + blocklen - 1) / blocklen;
olen *= blocklen;
if (olen < 2 * blocklen) {
return 0;
}
if (inlen > 0xFF) {
return 0;
}
if (out) {
out[0] = (unsigned char)inlen;
out[1] = in[0] ^ 0xFF;
out[2] = in[1] ^ 0xFF;
out[3] = in[2] ^ 0xFF;
memcpy(out + 4, in, inlen);
if (olen > inlen + 4
&& RAND_bytes(out + 4 + inlen, olen - 4 - inlen) <= 0)
return 0;
if (!EVP_EncryptUpdate(ctx, out, &dummy, out, olen)
|| !EVP_EncryptUpdate(ctx, out, &dummy, out, olen))
return 0;
}
*outlen = olen;
return 1;
}
crypto/cms/cms_pwri.c:398: error: BUFFER_OVERRUN_L3
Offset: 3 Size: [1, +oo] by call to `kek_wrap_key`.
Showing all 9 steps of the trace
crypto/cms/cms_pwri.c:390:14: Call
388. if (en_de) {
389.
390. if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, kekctx))
^
391. goto err;
392.
crypto/cms/cms_pwri.c:275:1: Parameter `*outlen`
273. }
274.
275. > static int kek_wrap_key(unsigned char *out, size_t *outlen,
276. const unsigned char *in, size_t inlen,
277. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:393:15: Call
391. goto err;
392.
393. key = OPENSSL_malloc(keylen);
^
394.
395. if (key == NULL)
crypto/mem.c:125:9: Assignment
123.
124. if (num <= 0)
125. return NULL;
^
126.
127. allow_customize = 0;
crypto/cms/cms_pwri.c:393:9: Assignment
391. goto err;
392.
393. key = OPENSSL_malloc(keylen);
^
394.
395. if (key == NULL)
crypto/cms/cms_pwri.c:398:14: Call
396. goto err;
397.
398. if (!kek_wrap_key(key, &keylen, ec->key, ec->keylen, kekctx))
^
399. goto err;
400. pwri->encryptedKey->data = key;
crypto/cms/cms_pwri.c:275:1: <Length trace>
273. }
274.
275. > static int kek_wrap_key(unsigned char *out, size_t *outlen,
276. const unsigned char *in, size_t inlen,
277. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:275:1: Parameter `*out`
273. }
274.
275. > static int kek_wrap_key(unsigned char *out, size_t *outlen,
276. const unsigned char *in, size_t inlen,
277. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:301:9: Array access: Offset: 3 Size: [1, +oo] by call to `kek_wrap_key`
299. out[1] = in[0] ^ 0xFF;
300. out[2] = in[1] ^ 0xFF;
301. out[3] = in[2] ^ 0xFF;
^
302. memcpy(out + 4, in, inlen);
303. /* Add random padding to end */
|
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/cms/cms_pwri.c/#L301
|
d2a_code_trace_data_44123
|
int BN_dec2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, i, j;
int num;
if ((a == NULL) || (*a == '\0'))
return (0);
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
continue;
if (i == 0 || i > INT_MAX/4)
goto err;
num = i + neg;
if (bn == NULL)
return (num);
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return (0);
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = BN_DEC_NUM - (i % BN_DEC_NUM);
if (j == BN_DEC_NUM)
j = 0;
l = 0;
while (--i >= 0) {
l *= 10;
l += *a - '0';
a++;
if (++j == BN_DEC_NUM) {
if (!BN_mul_word(ret, BN_DEC_CONV)
|| !BN_add_word(ret, l))
goto err;
l = 0;
j = 0;
}
}
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return (num);
err:
if (*bn == NULL)
BN_free(ret);
return (0);
}
test/bntest.c:1662: error: BUFFER_OVERRUN_L2
Offset: [0, 536870913] (⇐ [0, 2] + [0, 536870911]) Size: 2 by call to `BN_asc2bn`.
Showing all 9 steps of the trace
test/bntest.c:1662:10: Call
1660. goto err;
1661.
1662. if (!TEST_true(BN_asc2bn(&bn, "0"))
^
1663. || !TEST_BN_eq_zero(bn)
1664. || !TEST_BN_ge_zero(bn))
crypto/bn/bn_print.c:267:1: Parameter `*a`
265. }
266.
267. > int BN_asc2bn(BIGNUM **bn, const char *a)
268. {
269. const char *p = a;
crypto/bn/bn_print.c:269:5: Assignment
267. int BN_asc2bn(BIGNUM **bn, const char *a)
268. {
269. const char *p = a;
^
270.
271. if (*p == '-')
crypto/bn/bn_print.c:278:14: Call
276. return 0;
277. } else {
278. if (!BN_dec2bn(bn, p))
^
279. return 0;
280. }
crypto/bn/bn_print.c:211:10: <Offset trace>
209. }
210.
211. for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
^
212. continue;
213.
crypto/bn/bn_print.c:211:10: Assignment
209. }
210.
211. for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
^
212. continue;
213.
crypto/bn/bn_print.c:197:1: <Length trace>
195. }
196.
197. > int BN_dec2bn(BIGNUM **bn, const char *a)
198. {
199. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:197:1: Parameter `*a`
195. }
196.
197. > int BN_dec2bn(BIGNUM **bn, const char *a)
198. {
199. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:211:37: Array access: Offset: [0, 536870913] (⇐ [0, 2] + [0, 536870911]) Size: 2 by call to `BN_asc2bn`
209. }
210.
211. for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
^
212. continue;
213.
|
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_print.c/#L211
|
d2a_code_trace_data_44124
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/exptest.c:75: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`.
Showing all 18 steps of the trace
test/exptest.c:75:10: Call
73. goto err;
74.
75. if (!TEST_true(BN_mod_exp(r, a, p, m, ctx)))
^
76. goto err;
77.
crypto/bn/bn_exp.c:91:1: Parameter `ctx->stack.depth`
89. }
90.
91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
92. BN_CTX *ctx)
93. {
crypto/bn/bn_exp.c:149:15: Call
147. #ifdef RECP_MUL_MOD
148. {
149. ret = BN_mod_exp_recp(r, a, p, m, ctx);
^
150. }
151. #else
crypto/bn/bn_exp.c:161:1: Parameter `ctx->stack.depth`
159. }
160.
161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
162. const BIGNUM *m, BN_CTX *ctx)
163. {
crypto/bn/bn_exp.c:189:5: Call
187. }
188.
189. BN_CTX_start(ctx);
^
190. aa = BN_CTX_get(ctx);
191. val[0] = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_exp.c:208:10: Call
206. }
207.
208. if (!BN_nnmod(val[0], a, m, ctx))
^
209. goto err; /* 1 */
210. if (BN_is_zero(val[0])) {
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/bn/bn_div.c:193:5: Call
191. }
192.
193. BN_CTX_start(ctx);
^
194. tmp = BN_CTX_get(ctx);
195. snum = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_div.c:416:5: Call
414. if (no_branch)
415. bn_correct_top(res);
416. BN_CTX_end(ctx);
^
417. return (1);
418. err:
crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <LHS trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/b6e3250671654e0344127be9dd49b3fb4a82f94b/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_44125
|
static void opt_vstats (void)
{
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);
opt_vstats_file(filename);
}
ffmpeg.c:3652: error: Null Dereference
pointer `today` last assigned on line 3650 could be null and is dereferenced at line 3652, column 69.
ffmpeg.c:3646:1: start of procedure opt_vstats()
3644. }
3645.
3646. static void opt_vstats (void)
^
3647. {
3648. char filename[40];
ffmpeg.c:3649:5:
3647. {
3648. char filename[40];
3649. time_t today2 = time(NULL);
^
3650. struct tm *today = localtime(&today2);
3651.
ffmpeg.c:3650:5:
3648. char filename[40];
3649. time_t today2 = time(NULL);
3650. struct tm *today = localtime(&today2);
^
3651.
3652. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
ffmpeg.c:3652:5:
3650. struct tm *today = localtime(&today2);
3651.
3652. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
3653. today->tm_sec);
3654. opt_vstats_file(filename);
|
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L3652
|
d2a_code_trace_data_44126
|
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
{
#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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_MALLOC_FAILURE);
return 0;
}
pms[0] = s->client_version >> 8;
pms[1] = s->client_version & 0xff;
if (ssl_randbytes(s, pms + 2, (int)(pmslen - 2)) <= 0) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_MALLOC_FAILURE);
goto err;
}
if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_INTERNAL_ERROR);
return 0;
#endif
}
ssl/statem/statem_clnt.c:2869: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 2868 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2869, column 9.
Showing all 30 steps of the trace
ssl/statem/statem_clnt.c:2849:1: start of procedure tls_construct_cke_rsa()
2847. }
2848.
2849. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
2850. {
2851. #ifndef OPENSSL_NO_RSA
ssl/statem/statem_clnt.c:2852:5:
2850. {
2851. #ifndef OPENSSL_NO_RSA
2852. > unsigned char *encdata = NULL;
2853. EVP_PKEY *pkey = NULL;
2854. EVP_PKEY_CTX *pctx = NULL;
ssl/statem/statem_clnt.c:2853:5:
2851. #ifndef OPENSSL_NO_RSA
2852. unsigned char *encdata = NULL;
2853. > EVP_PKEY *pkey = NULL;
2854. EVP_PKEY_CTX *pctx = NULL;
2855. size_t enclen;
ssl/statem/statem_clnt.c:2854:5:
2852. unsigned char *encdata = NULL;
2853. EVP_PKEY *pkey = NULL;
2854. > EVP_PKEY_CTX *pctx = NULL;
2855. size_t enclen;
2856. unsigned char *pms = NULL;
ssl/statem/statem_clnt.c:2856:5:
2854. EVP_PKEY_CTX *pctx = NULL;
2855. size_t enclen;
2856. > unsigned char *pms = NULL;
2857. size_t pmslen = 0;
2858.
ssl/statem/statem_clnt.c:2857:5:
2855. size_t enclen;
2856. unsigned char *pms = NULL;
2857. > size_t pmslen = 0;
2858.
2859. if (s->session->peer == NULL) {
ssl/statem/statem_clnt.c:2859:9: Taking false branch
2857. size_t pmslen = 0;
2858.
2859. if (s->session->peer == NULL) {
^
2860. /*
2861. * We should always have a server certificate with SSL_kRSA.
ssl/statem/statem_clnt.c:2868:5:
2866. }
2867.
2868. > pkey = X509_get0_pubkey(s->session->peer);
2869. if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2870. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey()
262. }
263.
264. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
265. {
266. if (x == NULL)
crypto/x509/x509_cmp.c:266:9: Taking false branch
264. EVP_PKEY *X509_get0_pubkey(const X509 *x)
265. {
266. if (x == NULL)
^
267. return NULL;
268. return X509_PUBKEY_get0(x->cert_info.key);
crypto/x509/x509_cmp.c:268:5:
266. if (x == NULL)
267. return NULL;
268. > return X509_PUBKEY_get0(x->cert_info.key);
269. }
270.
crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0()
138. }
139.
140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. EVP_PKEY *ret = NULL;
crypto/x509/x_pubkey.c:142:5:
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. > EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
crypto/x509/x_pubkey.c:144:9: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:144:24: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:147:9: Taking false branch
145. return NULL;
146.
147. if (key->pkey != NULL)
^
148. return key->pkey;
149.
crypto/x509/x_pubkey.c:158:5:
156. * in the queue.
157. */
158. > x509_pubkey_decode(&ret, key);
159. /* If decode doesn't fail something bad happened */
160. if (ret != NULL) {
crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode()
101.
102.
103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
104. {
105. EVP_PKEY *pkey = EVP_PKEY_new();
crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs
103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
104. {
105. EVP_PKEY *pkey = EVP_PKEY_new();
^
106.
107. if (pkey == NULL) {
crypto/x509/x_pubkey.c:107:9: Taking true branch
105. EVP_PKEY *pkey = EVP_PKEY_new();
106.
107. if (pkey == NULL) {
^
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
109. return -1;
crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs
106.
107. if (pkey == NULL) {
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
^
109. return -1;
110. }
crypto/x509/x_pubkey.c:109:9:
107. if (pkey == NULL) {
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
109. > return -1;
110. }
111.
crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode
136. EVP_PKEY_free(pkey);
137. return 0;
138. > }
139.
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
crypto/x509/x_pubkey.c:160:9: Taking false branch
158. x509_pubkey_decode(&ret, key);
159. /* If decode doesn't fail something bad happened */
160. if (ret != NULL) {
^
161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR);
162. EVP_PKEY_free(ret);
crypto/x509/x_pubkey.c:165:5:
163. }
164.
165. > return NULL;
166. }
167.
crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0
164.
165. return NULL;
166. > }
167.
168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey
267. return NULL;
268. return X509_PUBKEY_get0(x->cert_info.key);
269. > }
270.
271. EVP_PKEY *X509_get_pubkey(X509 *x)
ssl/statem/statem_clnt.c:2869:9:
2867.
2868. pkey = X509_get0_pubkey(s->session->peer);
2869. > if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2870. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2871. ERR_R_INTERNAL_ERROR);
crypto/evp/p_lib.c:311:1: start of procedure EVP_PKEY_get0_RSA()
309. }
310.
311. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
312. {
313. if (pkey->type != EVP_PKEY_RSA) {
crypto/evp/p_lib.c:313:9:
311. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
312. {
313. > if (pkey->type != EVP_PKEY_RSA) {
314. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
315. return NULL;
|
https://github.com/openssl/openssl/blob/fce78bd4ede74d4fa7bd1c8195d8f7bc9403bd4c/ssl/statem/statem_clnt.c/#L2869
|
d2a_code_trace_data_44127
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/ec/ec2_smpl.c:714: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand`.
Showing all 17 steps of the trace
crypto/ec/ec2_smpl.c:688:1: Parameter `r->Y->d`
686. * s:= p, r := 2p
687. */
688. > static
689. int ec_GF2m_simple_ladder_pre(const EC_GROUP *group,
690. EC_POINT *r, EC_POINT *s,
crypto/ec/ec2_smpl.c:714:14: Call
712. /* r blinding: make sure lambda (r->Y here for storage) is not zero */
713. do {
714. if (!BN_priv_rand(r->Y, BN_num_bits(group->field) - 1,
^
715. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) {
716. ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_PRE, ERR_R_BN_LIB);
crypto/bn/bn_rand.c:121:1: Parameter `*rnd->d`
119. }
120.
121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)
122. {
123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL);
crypto/bn/bn_rand.c:123:12: Call
121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)
122. {
123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL);
^
124. }
125.
crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d`
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
crypto/bn/bn_rand.c:33:9: Call
31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
32. goto toosmall;
33. BN_zero(rnd);
^
34. return 1;
35. }
crypto/bn/bn_lib.c:361:1: Parameter `*a->d`
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:364:9: Call
362. {
363. bn_check_top(a);
364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
365. return 0;
366. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:245:1: Parameter `*b->d`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `*b->d`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
|
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_44128
|
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/s_client.c:239: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_rshift1`.
Showing all 19 steps of the trace
apps/s_client.c:238:9: Call
236. int ret =
237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
^
239. p != NULL && BN_rshift1(p, N) &&
240. /* p = (N-1)/2 */
crypto/bn/bn_prime.c:150:12: Call
148. BN_GENCB *cb)
149. {
150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
151. }
152.
crypto/bn/bn_prime.c:217:10: Call
215. if (mont == NULL)
216. goto err;
217. if (!BN_MONT_CTX_set(mont, a, ctx))
^
218. goto err;
219.
crypto/bn/bn_mont.c:338:14: Call
336. goto err; /* Ri-- (mod word size) */
337. }
338. if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
^
339. goto err;
340. /*
crypto/bn/bn_div.c:140:1: Parameter `rm->top`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
apps/s_client.c:239:22: Call
237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
239. p != NULL && BN_rshift1(p, N) &&
^
240. /* p = (N-1)/2 */
241. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
crypto/bn/bn_shift.c:46:1: Parameter `*r->d`
44. }
45.
46. > int BN_rshift1(BIGNUM *r, const BIGNUM *a)
47. {
48. BN_ULONG *ap, *rp, t, c;
crypto/bn/bn_shift.c:55:9: Call
53.
54. if (BN_is_zero(a)) {
55. BN_zero(r);
^
56. return (1);
57. }
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))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:284:1: Parameter `*b->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_rshift1`
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/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_44129
|
static void dct32(INTFLOAT *out, const INTFLOAT *tab)
{
INTFLOAT tmp0, tmp1;
INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 ,
val8 , val9 , val10, val11, val12, val13, val14, val15,
val16, val17, val18, val19, val20, val21, val22, val23,
val24, val25, val26, val27, val28, val29, val30, val31;
BF0( 0, 31, COS0_0 , 1);
BF0(15, 16, COS0_15, 5);
BF( 0, 15, COS1_0 , 1);
BF(16, 31,-COS1_0 , 1);
BF0( 7, 24, COS0_7 , 1);
BF0( 8, 23, COS0_8 , 1);
BF( 7, 8, COS1_7 , 4);
BF(23, 24,-COS1_7 , 4);
BF( 0, 7, COS2_0 , 1);
BF( 8, 15,-COS2_0 , 1);
BF(16, 23, COS2_0 , 1);
BF(24, 31,-COS2_0 , 1);
BF0( 3, 28, COS0_3 , 1);
BF0(12, 19, COS0_12, 2);
BF( 3, 12, COS1_3 , 1);
BF(19, 28,-COS1_3 , 1);
BF0( 4, 27, COS0_4 , 1);
BF0(11, 20, COS0_11, 2);
BF( 4, 11, COS1_4 , 1);
BF(20, 27,-COS1_4 , 1);
BF( 3, 4, COS2_3 , 3);
BF(11, 12,-COS2_3 , 3);
BF(19, 20, COS2_3 , 3);
BF(27, 28,-COS2_3 , 3);
BF( 0, 3, COS3_0 , 1);
BF( 4, 7,-COS3_0 , 1);
BF( 8, 11, COS3_0 , 1);
BF(12, 15,-COS3_0 , 1);
BF(16, 19, COS3_0 , 1);
BF(20, 23,-COS3_0 , 1);
BF(24, 27, COS3_0 , 1);
BF(28, 31,-COS3_0 , 1);
BF0( 1, 30, COS0_1 , 1);
BF0(14, 17, COS0_14, 3);
BF( 1, 14, COS1_1 , 1);
BF(17, 30,-COS1_1 , 1);
BF0( 6, 25, COS0_6 , 1);
BF0( 9, 22, COS0_9 , 1);
BF( 6, 9, COS1_6 , 2);
BF(22, 25,-COS1_6 , 2);
BF( 1, 6, COS2_1 , 1);
BF( 9, 14,-COS2_1 , 1);
BF(17, 22, COS2_1 , 1);
BF(25, 30,-COS2_1 , 1);
BF0( 2, 29, COS0_2 , 1);
BF0(13, 18, COS0_13, 3);
BF( 2, 13, COS1_2 , 1);
BF(18, 29,-COS1_2 , 1);
BF0( 5, 26, COS0_5 , 1);
BF0(10, 21, COS0_10, 1);
BF( 5, 10, COS1_5 , 2);
BF(21, 26,-COS1_5 , 2);
BF( 2, 5, COS2_2 , 1);
BF(10, 13,-COS2_2 , 1);
BF(18, 21, COS2_2 , 1);
BF(26, 29,-COS2_2 , 1);
BF( 1, 2, COS3_1 , 2);
BF( 5, 6,-COS3_1 , 2);
BF( 9, 10, COS3_1 , 2);
BF(13, 14,-COS3_1 , 2);
BF(17, 18, COS3_1 , 2);
BF(21, 22,-COS3_1 , 2);
BF(25, 26, COS3_1 , 2);
BF(29, 30,-COS3_1 , 2);
BF1( 0, 1, 2, 3);
BF2( 4, 5, 6, 7);
BF1( 8, 9, 10, 11);
BF2(12, 13, 14, 15);
BF1(16, 17, 18, 19);
BF2(20, 21, 22, 23);
BF1(24, 25, 26, 27);
BF2(28, 29, 30, 31);
ADD( 8, 12);
ADD(12, 10);
ADD(10, 14);
ADD(14, 9);
ADD( 9, 13);
ADD(13, 11);
ADD(11, 15);
out[ 0] = val0;
out[16] = val1;
out[ 8] = val2;
out[24] = val3;
out[ 4] = val4;
out[20] = val5;
out[12] = val6;
out[28] = val7;
out[ 2] = val8;
out[18] = val9;
out[10] = val10;
out[26] = val11;
out[ 6] = val12;
out[22] = val13;
out[14] = val14;
out[30] = val15;
ADD(24, 28);
ADD(28, 26);
ADD(26, 30);
ADD(30, 25);
ADD(25, 29);
ADD(29, 27);
ADD(27, 31);
out[ 1] = val16 + val24;
out[17] = val17 + val25;
out[ 9] = val18 + val26;
out[25] = val19 + val27;
out[ 5] = val20 + val28;
out[21] = val21 + val29;
out[13] = val22 + val30;
out[29] = val23 + val31;
out[ 3] = val24 + val20;
out[19] = val25 + val21;
out[11] = val26 + val22;
out[27] = val27 + val23;
out[ 7] = val28 + val18;
out[23] = val29 + val19;
out[15] = val30 + val17;
out[31] = val31;
}
libavcodec/mpc.c:54: error: Buffer Overrun L2
Offset: [5+min(0, `c->synth_buf_offset[*]`), 6+max(511, `c->synth_buf_offset[*]`)] (⇐ [min(0, `c->synth_buf_offset[*]`), 1+max(511, `c->synth_buf_offset[*]`)] + 5) Size: 2 by call to `ff_mpa_synth_filter`.
libavcodec/mpc.c:45:1: Parameter `c->synth_buf[*]`
43. * Process decoded Musepack data and produce PCM
44. */
45. static void mpc_synth(MPCContext *c, int16_t *out)
^
46. {
47. int dither_state = 0;
libavcodec/mpc.c:54:13: Call
52. samples_ptr = samples + ch;
53. for(i = 0; i < SAMPLES_PER_BAND; i++) {
54. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
^
55. ff_mpa_synth_window, &dither_state,
56. samples_ptr, 2,
libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr`
703. /* XXX: optimize by avoiding ring buffer usage */
704. #if !CONFIG_FLOAT
705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
^
706. MPA_INT *window, int *dither_state,
707. OUT_INT *samples, int incr,
libavcodec/mpegaudiodec.c:718:5: Assignment
716.
717. offset = *synth_buf_offset;
718. synth_buf = synth_buf_ptr + offset;
^
719.
720. #if FRAC_BITS <= 15
libavcodec/mpegaudiodec.c:728:5: Call
726. }
727. #else
728. dct32(synth_buf, sb_samples);
^
729. #endif
730.
libavcodec/dct32.c:106:1: <Length trace>
104.
105. /* DCT32 without 1/sqrt(2) coef zero scaling. */
106. static void dct32(INTFLOAT *out, const INTFLOAT *tab)
^
107. {
108. INTFLOAT tmp0, tmp1;
libavcodec/dct32.c:106:1: Parameter `*out`
104.
105. /* DCT32 without 1/sqrt(2) coef zero scaling. */
106. static void dct32(INTFLOAT *out, const INTFLOAT *tab)
^
107. {
108. INTFLOAT tmp0, tmp1;
libavcodec/dct32.c:255:5: Array access: Offset: [5+min(0, c->synth_buf_offset[*]), 6+max(511, c->synth_buf_offset[*])] (⇐ [min(0, c->synth_buf_offset[*]), 1+max(511, c->synth_buf_offset[*])] + 5) Size: 2 by call to `ff_mpa_synth_filter`
253. out[ 9] = val18 + val26;
254. out[25] = val19 + val27;
255. out[ 5] = val20 + val28;
^
256. out[21] = val21 + val29;
257. out[13] = val22 + val30;
|
https://github.com/libav/libav/blob/63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd/libavcodec/dct32.c/#L255
|
d2a_code_trace_data_44130
|
int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d)
{
static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
char *a;
int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md;
struct tm tmp;
#if defined(CHARSET_EBCDIC)
const char upper_z = 0x5A, num_zero = 0x30, period = 0x2E, minus = 0x2D, plus = 0x2B;
#else
const char upper_z = 'Z', num_zero = '0', period = '.', minus = '-', plus = '+';
#endif
if (d->type == V_ASN1_UTCTIME) {
if (d->flags & ASN1_STRING_FLAG_X509_TIME) {
min_l = 13;
strict = 1;
}
} else if (d->type == V_ASN1_GENERALIZEDTIME) {
end = 7;
btz = 6;
if (d->flags & ASN1_STRING_FLAG_X509_TIME) {
min_l = 15;
strict = 1;
} else {
min_l = 13;
}
} else {
return 0;
}
l = d->length;
a = (char *)d->data;
o = 0;
memset(&tmp, 0, sizeof(tmp));
if (l < min_l)
goto err;
for (i = 0; i < end; i++) {
if (!strict && (i == btz) && ((a[o] == upper_z) || (a[o] == plus) || (a[o] == minus))) {
i++;
break;
}
if (!ascii_isdigit(a[o]))
goto err;
n = a[o] - num_zero;
if (++o == l)
goto err;
if (!ascii_isdigit(a[o]))
goto err;
n = (n * 10) + a[o] - num_zero;
if (++o == l)
goto err;
i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
if ((n < min[i2]) || (n > max[i2]))
goto err;
switch (i2) {
case 0:
tmp.tm_year = n * 100 - 1900;
break;
case 1:
if (d->type == V_ASN1_UTCTIME)
tmp.tm_year = n < 50 ? n + 100 : n;
else
tmp.tm_year += n;
break;
case 2:
tmp.tm_mon = n - 1;
break;
case 3:
if (tmp.tm_mon == 1) {
md = mdays[1] + leap_year(tmp.tm_year + 1900);
} else {
md = mdays[tmp.tm_mon];
}
if (n > md)
goto err;
tmp.tm_mday = n;
determine_days(&tmp);
break;
case 4:
tmp.tm_hour = n;
break;
case 5:
tmp.tm_min = n;
break;
case 6:
tmp.tm_sec = n;
break;
}
}
if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == period) {
if (strict)
goto err;
if (++o == l)
goto err;
i = o;
while ((o < l) && ascii_isdigit(a[o]))
o++;
if (i == o)
goto err;
if (o == l)
goto err;
}
if (a[o] == upper_z) {
o++;
} else if (!strict && ((a[o] == plus) || (a[o] == minus))) {
int offsign = a[o] == minus ? 1 : -1;
int offset = 0;
o++;
if (o + 4 != l)
goto err;
for (i = end; i < end + 2; i++) {
if (!ascii_isdigit(a[o]))
goto err;
n = a[o] - num_zero;
o++;
if (!ascii_isdigit(a[o]))
goto err;
n = (n * 10) + a[o] - num_zero;
i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
if ((n < min[i2]) || (n > max[i2]))
goto err;
if (tm != NULL) {
if (i == end)
offset = n * 3600;
else if (i == end + 1)
offset += n * 60;
}
o++;
}
if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign))
goto err;
} else {
goto err;
}
if (o == l) {
if (tm != NULL)
*tm = tmp;
return 1;
}
err:
return 0;
}
crypto/asn1/a_time.c:238: error: BUFFER_OVERRUN_L2
Offset: [6, 9] Size: 9.
Showing all 7 steps of the trace
crypto/asn1/a_time.c:80:5: <Offset trace>
78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
79. char *a;
80. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md;
^
81. struct tm tmp;
82. #if defined(CHARSET_EBCDIC)
crypto/asn1/a_time.c:80:5: Assignment
78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
79. char *a;
80. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md;
^
81. struct tm tmp;
82. #if defined(CHARSET_EBCDIC)
crypto/asn1/a_time.c:237:18: Assignment
235. goto err;
236. n = (n * 10) + a[o] - num_zero;
237. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
^
238. if ((n < min[i2]) || (n > max[i2]))
239. goto err;
crypto/asn1/a_time.c:237:13: Assignment
235. goto err;
236. n = (n * 10) + a[o] - num_zero;
237. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
^
238. if ((n < min[i2]) || (n > max[i2]))
239. goto err;
crypto/asn1/a_time.c:76:5: <Length trace>
74. int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d)
75. {
76. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
^
77. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
crypto/asn1/a_time.c:76:5: Array declaration
74. int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d)
75. {
76. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
^
77. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
crypto/asn1/a_time.c:238:22: Array access: Offset: [6, 9] Size: 9
236. n = (n * 10) + a[o] - num_zero;
237. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
238. if ((n < min[i2]) || (n > max[i2]))
^
239. goto err;
240. /* if tm is NULL, no need to adjust */
|
https://github.com/openssl/openssl/blob/d95422761116791966dcd0dd7035b46795482482/crypto/asn1/a_time.c/#L238
|
d2a_code_trace_data_44131
|
int BN_dec2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, i, j;
int num;
if ((a == NULL) || (*a == '\0'))
return (0);
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
continue;
if (i == 0 || i > INT_MAX/4)
goto err;
num = i + neg;
if (bn == NULL)
return (num);
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return (0);
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = BN_DEC_NUM - (i % BN_DEC_NUM);
if (j == BN_DEC_NUM)
j = 0;
l = 0;
while (--i >= 0) {
l *= 10;
l += *a - '0';
a++;
if (++j == BN_DEC_NUM) {
if (!BN_mul_word(ret, BN_DEC_CONV)
|| !BN_add_word(ret, l))
goto err;
l = 0;
j = 0;
}
}
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return (num);
err:
if (*bn == NULL)
BN_free(ret);
return (0);
}
test/bntest.c:1532: error: BUFFER_OVERRUN_L2
Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `parsedecBN`.
Showing all 8 steps of the trace
test/bntest.c:1532:15: Call
1530. int st = 0;
1531.
1532. int ret = parsedecBN(&bn, "0");
^
1533. if (ret != 1 || !BN_is_zero(bn) || BN_is_negative(bn)) {
1534. fprintf(stderr, "BN_dec2bn(0) gave a bad result.\n");
test/bntest.c:98:1: Parameter `*in`
96. }
97.
98. > static int parsedecBN(BIGNUM **out, const char *in)
99. {
100. *out = NULL;
test/bntest.c:101:12: Call
99. {
100. *out = NULL;
101. return BN_dec2bn(out, in);
^
102. }
103.
crypto/bn/bn_print.c:213:10: <Offset trace>
211. }
212.
213. for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
^
214. continue;
215.
crypto/bn/bn_print.c:213:10: Assignment
211. }
212.
213. for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
^
214. continue;
215.
crypto/bn/bn_print.c:199:1: <Length trace>
197. }
198.
199. > int BN_dec2bn(BIGNUM **bn, const char *a)
200. {
201. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:199:1: Parameter `*a`
197. }
198.
199. > int BN_dec2bn(BIGNUM **bn, const char *a)
200. {
201. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:213:37: Array access: Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `parsedecBN`
211. }
212.
213. for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
^
214. continue;
215.
|
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_print.c/#L213
|
d2a_code_trace_data_44132
|
static void
doapr_outch(char **sbuffer,
char **buffer, size_t *currlen, size_t *maxlen, int c)
{
assert(*sbuffer != NULL || buffer != NULL);
assert(*currlen <= *maxlen);
if (buffer && *currlen == *maxlen) {
*maxlen += 1024;
if (*buffer == NULL) {
*buffer = OPENSSL_malloc(*maxlen);
if (!*buffer) {
return;
}
if (*currlen > 0) {
assert(*sbuffer != NULL);
memcpy(*buffer, *sbuffer, *currlen);
}
*sbuffer = NULL;
} else {
*buffer = OPENSSL_realloc(*buffer, *maxlen);
if (!*buffer) {
return;
}
}
}
if (*currlen < *maxlen) {
if (*sbuffer)
(*sbuffer)[(*currlen)++] = (char)c;
else
(*buffer)[(*currlen)++] = (char)c;
}
return;
}
crypto/ts/ts_rsp_sign.c:907: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] (⇐ [-1, 2147483647] + [0, +oo]) Size: 23 by call to `BIO_snprintf`.
Showing all 15 steps of the trace
crypto/ts/ts_rsp_sign.c:879:1: Array declaration
877. }
878.
879. > static ASN1_GENERALIZEDTIME
880. *TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time,
881. long sec, long usec, unsigned precision)
crypto/ts/ts_rsp_sign.c:886:5: Assignment
884. struct tm *tm = NULL;
885. char genTime_str[17 + TS_MAX_CLOCK_PRECISION_DIGITS];
886. char *p = genTime_str;
^
887. char *p_end = genTime_str + sizeof(genTime_str);
888.
crypto/ts/ts_rsp_sign.c:902:5: Assignment
900. * fraction-of-second details".
901. */
902. p += BIO_snprintf(p, p_end - p,
^
903. "%04d%02d%02d%02d%02d%02d",
904. tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
crypto/ts/ts_rsp_sign.c:907:9: Call
905. tm->tm_hour, tm->tm_min, tm->tm_sec);
906. if (precision > 0) {
907. BIO_snprintf(p, 2 + precision, ".%06ld", usec);
^
908. p += strlen(p);
909.
crypto/bio/b_print.c:788:1: Parameter `*buf`
786. * function should be renamed, but to what?)
787. */
788. > int BIO_snprintf(char *buf, size_t n, const char *format, ...)
789. {
790. va_list args;
crypto/bio/b_print.c:795:11: Call
793. va_start(args, format);
794.
795. ret = BIO_vsnprintf(buf, n, format, args);
^
796.
797. va_end(args);
crypto/bio/b_print.c:801:1: Parameter `*buf`
799. }
800.
801. > int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
802. {
803. size_t retlen;
crypto/bio/b_print.c:806:5: Call
804. int truncated;
805.
806. _dopr(&buf, NULL, &n, &retlen, &truncated, format, args);
^
807.
808. if (truncated)
crypto/bio/b_print.c:168:1: Parameter `*maxlen`
166. #define OSSL_MAX(p,q) ((p >= q) ? p : q)
167.
168. > static void
169. _dopr(char **sbuffer,
170. char **buffer,
crypto/bio/b_print.c:199:17: Call
197. state = DP_S_FLAGS;
198. else
199. doapr_outch(sbuffer, buffer, &currlen, maxlen, ch);
^
200. ch = *format++;
201. break;
crypto/bio/b_print.c:700:1: <Offset trace>
698. }
699.
700. > static void
701. doapr_outch(char **sbuffer,
702. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:700:1: Parameter `*maxlen`
698. }
699.
700. > static void
701. doapr_outch(char **sbuffer,
702. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:700:1: <Length trace>
698. }
699.
700. > static void
701. doapr_outch(char **sbuffer,
702. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:700:1: Parameter `**sbuffer`
698. }
699.
700. > static void
701. doapr_outch(char **sbuffer,
702. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:734:13: Array access: Offset: [-1, +oo] (⇐ [-1, 2147483647] + [0, +oo]) Size: 23 by call to `BIO_snprintf`
732. if (*currlen < *maxlen) {
733. if (*sbuffer)
734. (*sbuffer)[(*currlen)++] = (char)c;
^
735. else
736. (*buffer)[(*currlen)++] = (char)c;
|
https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/bio/b_print.c/#L734
|
d2a_code_trace_data_44133
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/dsa/dsa_ossl.c:351: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 23 steps of the trace
crypto/dsa/dsa_ossl.c:332:10: Call
330. * Calculate W = inv(S) mod Q save W in u2
331. */
332. if ((BN_mod_inverse(u2, s, dsa->q, ctx)) == NULL)
^
333. goto err;
334.
crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth`
122. BN_CTX *ctx);
123.
124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
126. {
crypto/bn/bn_gcd.c:129:10: Call
127. BIGNUM *rv;
128. int noinv;
129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
^
130. if (noinv)
131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);
crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth`
133. }
134.
135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
137. int *pnoinv)
crypto/dsa/dsa_ossl.c:351:10: Call
349.
350. /* u2 = r * w mod q */
351. if (!BN_mod_mul(u2, r, u2, dsa->q, ctx))
^
352. goto err;
353.
crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth`
191.
192. /* slow but works */
193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
194. BN_CTX *ctx)
195. {
crypto/bn/bn_mod.c:203:5: Call
201. bn_check_top(m);
202.
203. BN_CTX_start(ctx);
^
204. if ((t = BN_CTX_get(ctx)) == NULL)
205. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mod.c:204:14: Call
202.
203. BN_CTX_start(ctx);
204. if ((t = BN_CTX_get(ctx)) == NULL)
^
205. goto err;
206. if (a == b) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mod.c:207:14: Call
205. goto err;
206. if (a == b) {
207. if (!BN_sqr(t, a, ctx))
^
208. goto err;
209. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
crypto/bn/bn_sqr.c:19:15: Call
17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
^
20.
21. bn_correct_top(r);
crypto/bn/bn_sqr.c:42:5: Call
40. }
41.
42. BN_CTX_start(ctx);
^
43. rr = (a != r) ? r : BN_CTX_get(ctx);
44. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_sqr.c:104:5: Call
102. bn_check_top(rr);
103. bn_check_top(tmp);
104. BN_CTX_end(ctx);
^
105. return ret;
106. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44134
|
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
{
struct tm *ts;
#if defined(THREADS) && !defined(WIN32)
struct tm data;
#endif
#if defined(THREADS) && !defined(WIN32)
gmtime_r(&t,&data);
ts=&data;
#else
ts=gmtime(&t);
#endif
if((ts->tm_year >= 1950) && (ts->tm_year < 2050))
return ASN1_UTCTIME_set(s, t);
return ASN1_GENERALIZEDTIME_set(s,t);
}
crypto/asn1/a_time.c:105: error: NULL_DEREFERENCE
pointer `ts` last assigned on line 103 could be null and is dereferenced at line 105, column 6.
Showing all 3 steps of the trace
crypto/asn1/a_time.c:92:1: start of procedure ASN1_TIME_set()
90.
91.
92. > ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
93. {
94. struct tm *ts;
crypto/asn1/a_time.c:103:2:
101. ts=&data;
102. #else
103. > ts=gmtime(&t);
104. #endif
105. if((ts->tm_year >= 1950) && (ts->tm_year < 2050))
crypto/asn1/a_time.c:105:6:
103. ts=gmtime(&t);
104. #endif
105. > if((ts->tm_year >= 1950) && (ts->tm_year < 2050))
106. return ASN1_UTCTIME_set(s, t);
107. return ASN1_GENERALIZEDTIME_set(s,t);
|
https://github.com/openssl/openssl/blob/98f1c689a5f7e276d02ace609eb00f7b9b6e5d4a/crypto/asn1/a_time.c/#L105
|
d2a_code_trace_data_44135
|
void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
if(!(--ref->buf->refcount))
ref->buf->free(ref->buf);
av_free(ref->video);
av_free(ref);
}
libavfilter/vsrc_buffer.c:132: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`.
libavfilter/vsrc_buffer.c:128:5: Assignment
126. picref->video->pixel_aspect = c->pixel_aspect;
127. picref->video->interlaced = c->frame.interlaced_frame;
128. picref->video->top_field_first = c->frame.top_field_first;
^
129. avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
130. avfilter_draw_slice(link, 0, link->h, 1);
libavfilter/vsrc_buffer.c:129:32: Call
127. picref->video->interlaced = c->frame.interlaced_frame;
128. picref->video->top_field_first = c->frame.top_field_first;
129. avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
^
130. avfilter_draw_slice(link, 0, link->h, 1);
131. avfilter_end_frame(link);
libavfilter/avfilter.c:48:1: Parameter `ref->type`
46. #define link_spad(link) link->src->output_pads[link->srcpad]
47.
48. AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
^
49. {
50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
libavfilter/vsrc_buffer.c:129:5: Call
127. picref->video->interlaced = c->frame.interlaced_frame;
128. picref->video->top_field_first = c->frame.top_field_first;
129. avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
^
130. avfilter_draw_slice(link, 0, link->h, 1);
131. avfilter_end_frame(link);
libavfilter/avfilter.c:250:1: Parameter `picref->type`
248. /* XXX: should we do the duplicating of the picture ref here, instead of
249. * forcing the source filter to do it? */
250. void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
^
251. {
252. void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);
libavfilter/vsrc_buffer.c:130:5: Call
128. picref->video->top_field_first = c->frame.top_field_first;
129. avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
130. avfilter_draw_slice(link, 0, link->h, 1);
^
131. avfilter_end_frame(link);
132. avfilter_unref_buffer(picref);
libavfilter/avfilter.c:298:1: Parameter `link->cur_buf->linesize[*]`
296. }
297.
298. void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
^
299. {
300. uint8_t *src[4], *dst[4];
libavfilter/vsrc_buffer.c:132:5: Call
130. avfilter_draw_slice(link, 0, link->h, 1);
131. avfilter_end_frame(link);
132. avfilter_unref_buffer(picref);
^
133.
134. c->has_frame = 0;
libavfilter/avfilter.c:61:1: <LHS trace>
59. }
60.
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
62. {
63. if(!(--ref->buf->refcount))
libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount`
59. }
60.
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
62. {
63. if(!(--ref->buf->refcount))
libavfilter/avfilter.c:63:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
62. {
63. if(!(--ref->buf->refcount))
^
64. ref->buf->free(ref->buf);
65. av_free(ref->video);
|
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L63
|
d2a_code_trace_data_44136
|
void print_name(BIO *out, const char *title, X509_NAME *nm,
unsigned long lflags)
{
char *buf;
char mline = 0;
int indent = 0;
if (title)
BIO_puts(out, title);
if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
mline = 1;
indent = 4;
}
if (lflags == XN_FLAG_COMPAT) {
buf = X509_NAME_oneline(nm, 0, 0);
BIO_puts(out, buf);
BIO_puts(out, "\n");
OPENSSL_free(buf);
} else {
if (mline)
BIO_puts(out, "\n");
X509_NAME_print_ex(out, nm, indent, lflags);
BIO_puts(out, "\n");
}
}
apps/apps.c:1022: error: NULL_DEREFERENCE
pointer `null` is dereferenced by call to `X509_NAME_oneline()` at line 1022, column 15.
Showing all 36 steps of the trace
apps/apps.c:1008:1: start of procedure print_name()
1006. }
1007.
1008. > void print_name(BIO *out, const char *title, X509_NAME *nm,
1009. unsigned long lflags)
1010. {
apps/apps.c:1012:5:
1010. {
1011. char *buf;
1012. > char mline = 0;
1013. int indent = 0;
1014.
apps/apps.c:1013:5:
1011. char *buf;
1012. char mline = 0;
1013. > int indent = 0;
1014.
1015. if (title)
apps/apps.c:1015:9: Taking true branch
1013. int indent = 0;
1014.
1015. if (title)
^
1016. BIO_puts(out, title);
1017. if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
apps/apps.c:1016:9:
1014.
1015. if (title)
1016. > BIO_puts(out, title);
1017. if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
1018. mline = 1;
crypto/bio/bio_lib.c:387:1: start of procedure BIO_puts()
385. }
386.
387. > int BIO_puts(BIO *b, const char *buf)
388. {
389. int ret;
crypto/bio/bio_lib.c:390:5:
388. {
389. int ret;
390. > size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
crypto/bio/bio_lib.c:392:10: Taking false branch
390. size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
^
393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
394. return -2;
crypto/bio/bio_lib.c:392:25: Taking false branch
390. size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
^
393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
394. return -2;
crypto/bio/bio_lib.c:392:48: Taking false branch
390. size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
^
393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
394. return -2;
crypto/bio/bio_lib.c:397:9: Taking false branch
395. }
396.
397. if (b->callback != NULL || b->callback_ex != NULL) {
^
398. ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
399. if (ret <= 0)
crypto/bio/bio_lib.c:397:32: Taking false branch
395. }
396.
397. if (b->callback != NULL || b->callback_ex != NULL) {
^
398. ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
399. if (ret <= 0)
crypto/bio/bio_lib.c:403:10: Taking false branch
401. }
402.
403. if (!b->init) {
^
404. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
405. return -2;
crypto/bio/bio_lib.c:408:5: Skipping __function_pointer__(): unresolved function pointer
406. }
407.
408. ret = b->method->bputs(b, buf);
^
409.
410. if (ret > 0) {
crypto/bio/bio_lib.c:410:9: Taking false branch
408. ret = b->method->bputs(b, buf);
409.
410. if (ret > 0) {
^
411. b->num_write += (uint64_t)ret;
412. written = ret;
crypto/bio/bio_lib.c:416:9: Taking false branch
414. }
415.
416. if (b->callback != NULL || b->callback_ex != NULL)
^
417. ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0,
418. 0L, ret, &written);
crypto/bio/bio_lib.c:416:32: Taking false branch
414. }
415.
416. if (b->callback != NULL || b->callback_ex != NULL)
^
417. ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0,
418. 0L, ret, &written);
crypto/bio/bio_lib.c:420:9: Taking false branch
418. 0L, ret, &written);
419.
420. if (ret > 0) {
^
421. if (written > INT_MAX) {
422. BIOerr(BIO_F_BIO_PUTS, BIO_R_LENGTH_TOO_LONG);
crypto/bio/bio_lib.c:429:5:
427. }
428.
429. > return ret;
430. }
431.
crypto/bio/bio_lib.c:430:1: return from a call to BIO_puts
428.
429. return ret;
430. > }
431.
432. int BIO_gets(BIO *b, char *buf, int size)
apps/apps.c:1017:9: Taking true branch
1015. if (title)
1016. BIO_puts(out, title);
1017. if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
^
1018. mline = 1;
1019. indent = 4;
apps/apps.c:1018:9:
1016. BIO_puts(out, title);
1017. if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
1018. > mline = 1;
1019. indent = 4;
1020. }
apps/apps.c:1019:9:
1017. if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
1018. mline = 1;
1019. > indent = 4;
1020. }
1021. if (lflags == XN_FLAG_COMPAT) {
apps/apps.c:1021:9: Taking true branch
1019. indent = 4;
1020. }
1021. if (lflags == XN_FLAG_COMPAT) {
^
1022. buf = X509_NAME_oneline(nm, 0, 0);
1023. BIO_puts(out, buf);
apps/apps.c:1022:9:
1020. }
1021. if (lflags == XN_FLAG_COMPAT) {
1022. > buf = X509_NAME_oneline(nm, 0, 0);
1023. BIO_puts(out, buf);
1024. BIO_puts(out, "\n");
crypto/x509/x509_obj.c:24:1: start of procedure X509_NAME_oneline()
22. #define NAME_ONELINE_MAX (1024 * 1024)
23.
24. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
25. {
26. const X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:32:5:
30. char *p;
31. unsigned char *q;
32. > BUF_MEM *b = NULL;
33. static const char hex[17] = "0123456789ABCDEF";
34. int gs_doit[4];
crypto/x509/x509_obj.c:33:5:
31. unsigned char *q;
32. BUF_MEM *b = NULL;
33. > static const char hex[17] = "0123456789ABCDEF";
34. int gs_doit[4];
35. char tmp_buf[80];
crypto/x509/x509_obj.c:40:9: Taking false branch
38. #endif
39.
40. if (buf == NULL) {
^
41. if ((b = BUF_MEM_new()) == NULL)
42. goto err;
crypto/x509/x509_obj.c:47:16: Taking false branch
45. b->data[0] = '\0';
46. len = 200;
47. } else if (len == 0) {
^
48. return NULL;
49. }
crypto/x509/x509_obj.c:50:9: Taking true branch
48. return NULL;
49. }
50. if (a == NULL) {
^
51. if (b) {
52. buf = b->data;
crypto/x509/x509_obj.c:51:13: Taking false branch
49. }
50. if (a == NULL) {
51. if (b) {
^
52. buf = b->data;
53. OPENSSL_free(b);
crypto/x509/x509_obj.c:55:9:
53. OPENSSL_free(b);
54. }
55. > strncpy(buf, "NO X509_NAME", len);
56. buf[len - 1] = '\0';
57. return buf;
crypto/x509/x509_obj.c:56:9:
54. }
55. strncpy(buf, "NO X509_NAME", len);
56. > buf[len - 1] = '\0';
57. return buf;
58. }
crypto/x509/x509_obj.c:57:9:
55. strncpy(buf, "NO X509_NAME", len);
56. buf[len - 1] = '\0';
57. > return buf;
58. }
59.
crypto/x509/x509_obj.c:181:1: return from a call to X509_NAME_oneline
179. BUF_MEM_free(b);
180. return NULL;
181. > }
|
https://github.com/openssl/openssl/blob/c3612970465d0a13f2fc5b47bc28ca18516a699d/apps/apps.c/#L1022
|
d2a_code_trace_data_44137
|
static void opt_vstats (void)
{
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);
opt_vstats_file(filename);
}
ffmpeg.c:4210: error: Null Dereference
pointer `today` last assigned on line 4208 could be null and is dereferenced at line 4210, column 69.
ffmpeg.c:4204:1: start of procedure opt_vstats()
4202. }
4203.
4204. static void opt_vstats (void)
^
4205. {
4206. char filename[40];
ffmpeg.c:4207:5:
4205. {
4206. char filename[40];
4207. time_t today2 = time(NULL);
^
4208. struct tm *today = localtime(&today2);
4209.
ffmpeg.c:4208:5:
4206. char filename[40];
4207. time_t today2 = time(NULL);
4208. struct tm *today = localtime(&today2);
^
4209.
4210. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
ffmpeg.c:4210:5:
4208. struct tm *today = localtime(&today2);
4209.
4210. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
4211. today->tm_sec);
4212. opt_vstats_file(filename);
|
https://github.com/libav/libav/blob/41e21e4db623ebd77f431a6f30cf21d62d9e1f33/ffmpeg.c/#L4210
|
d2a_code_trace_data_44138
|
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
return 1;
}
ssl/t1_lib.c:1428: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 9]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 12 steps of the trace
ssl/t1_lib.c:1410:10: Call
1408. #endif
1409.
1410. if (!WPACKET_start_sub_packet_u16(pkt)
^
1411. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) {
1412. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
ssl/packet.c:224:1: Parameter `pkt->buf->length`
222. }
223.
224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
225. {
226. WPACKET_SUB *sub;
ssl/t1_lib.c:1428:14: Call
1426. if (!s->hit && s->servername_done == 1
1427. && s->session->tlsext_hostname != NULL) {
1428. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
^
1429. || !WPACKET_put_bytes_u16(pkt, 0)) {
1430. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
ssl/packet.c:261:1: Parameter `pkt->written`
259. }
260.
261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
262. {
263. unsigned char *data;
ssl/packet.c:269:17: Call
267.
268. if (size > sizeof(unsigned int)
269. || !WPACKET_allocate_bytes(pkt, size, &data)
^
270. || !put_value(data, val, size))
271. return 0;
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:36:1: <LHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `pkt->buf->length`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: <RHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `len`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 9]):unsigned64 by call to `WPACKET_put_bytes__`
44. return 0;
45.
46. if (pkt->buf->length - pkt->written < len) {
^
47. size_t newlen;
48. size_t reflen;
|
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
|
d2a_code_trace_data_44139
|
void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
{
int i;
for(i = 0; i < lp_order; i++)
lsp[i] = cos(2.0 * M_PI * lsf[i]);
}
libavcodec/amrnbdec.c:307: error: Buffer Overrun L2
Offset: [3, 12] (⇐ 3 + [0, 9]) Size: 4 by call to `lsf2lsp_for_mode12k2`.
libavcodec/amrnbdec.c:290:1: Parameter `p->lsp[*]`
288. * @param p pointer to the AMRContext
289. */
290. static void lsf2lsp_5(AMRContext *p)
^
291. {
292. const uint16_t *lsf_param = p->frame.lsf;
libavcodec/amrnbdec.c:307:5: Call
305.
306. lsf2lsp_for_mode12k2(p, p->lsp[1], lsf_no_r, lsf_quantizer, 0, lsf_param[2] & 1, 0);
307. lsf2lsp_for_mode12k2(p, p->lsp[3], lsf_no_r, lsf_quantizer, 2, lsf_param[2] & 1, 1);
^
308.
309. // interpolate LSP vectors at subframes 1 and 3
libavcodec/amrnbdec.c:252:1: Parameter `*lsp`
250. * @param update store data for computing the next frame's LSFs
251. */
252. static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER],
^
253. const float lsf_no_r[LP_FILTER_ORDER],
254. const int16_t *lsf_quantizer[5],
libavcodec/amrnbdec.c:282:5: Call
280. interpolate_lsf(p->lsf_q, lsf_q);
281.
282. ff_acelp_lsf2lspd(lsp, lsf_q, LP_FILTER_ORDER);
^
283. }
284.
libavcodec/lsp.c:68:1: <Offset trace>
66. }
67.
68. void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
^
69. {
70. int i;
libavcodec/lsp.c:68:1: Parameter `lp_order`
66. }
67.
68. void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
^
69. {
70. int i;
libavcodec/lsp.c:68:1: <Length trace>
66. }
67.
68. void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
^
69. {
70. int i;
libavcodec/lsp.c:68:1: Parameter `*lsp`
66. }
67.
68. void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
^
69. {
70. int i;
libavcodec/lsp.c:73:9: Array access: Offset: [3, 12] (⇐ 3 + [0, 9]) Size: 4 by call to `lsf2lsp_for_mode12k2`
71.
72. for(i = 0; i < lp_order; i++)
73. lsp[i] = cos(2.0 * M_PI * lsf[i]);
^
74. }
75.
|
https://github.com/libav/libav/blob/539ff40c2d685508c62f040693df0f0facda39ff/libavcodec/lsp.c/#L73
|
d2a_code_trace_data_44140
|
int HMAC_CTX_reset(HMAC_CTX *ctx)
{
hmac_ctx_cleanup(ctx);
if (ctx->i_ctx == NULL)
ctx->i_ctx = EVP_MD_CTX_new();
if (ctx->i_ctx == NULL)
goto err;
if (ctx->o_ctx == NULL)
ctx->o_ctx = EVP_MD_CTX_new();
if (ctx->o_ctx == NULL)
goto err;
if (ctx->md_ctx == NULL)
ctx->md_ctx = EVP_MD_CTX_new();
if (ctx->md_ctx == NULL)
goto err;
ctx->md = NULL;
return 1;
err:
hmac_ctx_cleanup(ctx);
return 0;
}
crypto/hmac/hmac.c:223: error: MEMORY_LEAK
memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 209, column 22 is not reachable after line 223, column 5.
Showing all 66 steps of the trace
crypto/hmac/hmac.c:205:1: start of procedure HMAC_CTX_reset()
203. }
204.
205. > int HMAC_CTX_reset(HMAC_CTX *ctx)
206. {
207. hmac_ctx_cleanup(ctx);
crypto/hmac/hmac.c:207:5: Skipping hmac_ctx_cleanup(): empty list of specs
205. int HMAC_CTX_reset(HMAC_CTX *ctx)
206. {
207. hmac_ctx_cleanup(ctx);
^
208. if (ctx->i_ctx == NULL)
209. ctx->i_ctx = EVP_MD_CTX_new();
crypto/hmac/hmac.c:208:9: Taking true branch
206. {
207. hmac_ctx_cleanup(ctx);
208. if (ctx->i_ctx == NULL)
^
209. ctx->i_ctx = EVP_MD_CTX_new();
210. if (ctx->i_ctx == NULL)
crypto/hmac/hmac.c:209:9:
207. hmac_ctx_cleanup(ctx);
208. if (ctx->i_ctx == NULL)
209. > ctx->i_ctx = EVP_MD_CTX_new();
210. if (ctx->i_ctx == NULL)
211. goto err;
crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new()
151. }
152.
153. > EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:155:5:
153. EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. }
157.
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. > }
157.
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
crypto/hmac/hmac.c:210:9: Taking false branch
208. if (ctx->i_ctx == NULL)
209. ctx->i_ctx = EVP_MD_CTX_new();
210. if (ctx->i_ctx == NULL)
^
211. goto err;
212. if (ctx->o_ctx == NULL)
crypto/hmac/hmac.c:212:9: Taking true branch
210. if (ctx->i_ctx == NULL)
211. goto err;
212. if (ctx->o_ctx == NULL)
^
213. ctx->o_ctx = EVP_MD_CTX_new();
214. if (ctx->o_ctx == NULL)
crypto/hmac/hmac.c:213:9:
211. goto err;
212. if (ctx->o_ctx == NULL)
213. > ctx->o_ctx = EVP_MD_CTX_new();
214. if (ctx->o_ctx == NULL)
215. goto err;
crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new()
151. }
152.
153. > EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:155:5:
153. EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. }
157.
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. > }
157.
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
crypto/hmac/hmac.c:214:9: Taking false branch
212. if (ctx->o_ctx == NULL)
213. ctx->o_ctx = EVP_MD_CTX_new();
214. if (ctx->o_ctx == NULL)
^
215. goto err;
216. if (ctx->md_ctx == NULL)
crypto/hmac/hmac.c:216:9: Taking true branch
214. if (ctx->o_ctx == NULL)
215. goto err;
216. if (ctx->md_ctx == NULL)
^
217. ctx->md_ctx = EVP_MD_CTX_new();
218. if (ctx->md_ctx == NULL)
crypto/hmac/hmac.c:217:9:
215. goto err;
216. if (ctx->md_ctx == NULL)
217. > ctx->md_ctx = EVP_MD_CTX_new();
218. if (ctx->md_ctx == NULL)
219. goto err;
crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new()
151. }
152.
153. > EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:155:5:
153. EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. }
157.
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking false branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. > }
157.
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
crypto/hmac/hmac.c:218:9: Taking true branch
216. if (ctx->md_ctx == NULL)
217. ctx->md_ctx = EVP_MD_CTX_new();
218. if (ctx->md_ctx == NULL)
^
219. goto err;
220. ctx->md = NULL;
crypto/hmac/hmac.c:222:2:
220. ctx->md = NULL;
221. return 1;
222. > err:
223. hmac_ctx_cleanup(ctx);
224. return 0;
crypto/hmac/hmac.c:223:5: Skipping hmac_ctx_cleanup(): empty list of specs
221. return 1;
222. err:
223. hmac_ctx_cleanup(ctx);
^
224. return 0;
225. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/hmac/hmac.c/#L223
|
d2a_code_trace_data_44141
|
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
{
X509_NAME_ENTRY *ne;
int i;
int n, lold, l, l1, l2, num, j, type;
const char *s;
char *p;
unsigned char *q;
BUF_MEM *b = NULL;
static const char hex[17] = "0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
unsigned char ebcdic_buf[1024];
#endif
if (buf == NULL) {
if ((b = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(b, 200))
goto err;
b->data[0] = '\0';
len = 200;
} else if (len == 0) {
return NULL;
}
if (a == NULL) {
if (b) {
buf = b->data;
OPENSSL_free(b);
}
strncpy(buf, "NO X509_NAME", len);
buf[len - 1] = '\0';
return buf;
}
len--;
l = 0;
for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
ne = sk_X509_NAME_ENTRY_value(a->entries, i);
n = OBJ_obj2nid(ne->object);
if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
s = tmp_buf;
}
l1 = strlen(s);
type = ne->value->type;
num = ne->value->length;
if (num > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
q = ne->value->data;
#ifdef CHARSET_EBCDIC
if (type == V_ASN1_GENERALSTRING ||
type == V_ASN1_VISIBLESTRING ||
type == V_ASN1_PRINTABLESTRING ||
type == V_ASN1_TELETEXSTRING ||
type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) {
ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf))
? (int)sizeof(ebcdic_buf) : num);
q = ebcdic_buf;
}
#endif
if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
for (j = 0; j < num; j++)
if (q[j] != 0)
gs_doit[j & 3] = 1;
if (gs_doit[0] | gs_doit[1] | gs_doit[2])
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
else {
gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
gs_doit[3] = 1;
}
} else
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
for (l2 = j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
l2++;
#ifndef CHARSET_EBCDIC
if ((q[j] < ' ') || (q[j] > '~'))
l2 += 3;
#else
if ((os_toascii[q[j]] < os_toascii[' ']) ||
(os_toascii[q[j]] > os_toascii['~']))
l2 += 3;
#endif
}
lold = l;
l += 1 + l1 + 1 + l2;
if (l > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
if (b != NULL) {
if (!BUF_MEM_grow(b, l + 1))
goto err;
p = &(b->data[lold]);
} else if (l > len) {
break;
} else
p = &(buf[lold]);
*(p++) = '/';
memcpy(p, s, (unsigned int)l1);
p += l1;
*(p++) = '=';
#ifndef CHARSET_EBCDIC
q = ne->value->data;
#endif
for (j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
#ifndef CHARSET_EBCDIC
n = q[j];
if ((n < ' ') || (n > '~')) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = n;
#else
n = os_toascii[q[j]];
if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = q[j];
#endif
}
*p = '\0';
}
if (b != NULL) {
p = b->data;
OPENSSL_free(b);
} else
p = buf;
if (i == 0)
*p = '\0';
return (p);
err:
X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
end:
BUF_MEM_free(b);
return (NULL);
}
crypto/x509v3/v3_alt.c:146: error: BUFFER_OVERRUN_L2
Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline`.
Showing all 8 steps of the trace
crypto/x509v3/v3_alt.c:113:1: Array declaration
111. }
112.
113. > STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
114. GENERAL_NAME *gen,
115. STACK_OF(CONF_VALUE) *ret)
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:110:5: <Offset trace>
108.
109. len--; /* space for '\0' */
110. l = 0;
^
111. for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
112. ne = sk_X509_NAME_ENTRY_value(a->entries, i);
crypto/x509/x509_obj.c:110:5: Assignment
108.
109. len--; /* space for '\0' */
110. l = 0;
^
111. for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
112. ne = sk_X509_NAME_ENTRY_value(a->entries, i);
crypto/x509/x509_obj.c:168:9: Assignment
166. }
167.
168. lold = l;
^
169. l += 1 + l1 + 1 + l2;
170. if (l > NAME_ONELINE_MAX) {
crypto/x509/x509_obj.c:73:1: <Length trace>
71. #define NAME_ONELINE_MAX (1024 * 1024)
72.
73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
74. {
75. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:73:1: Parameter `*buf`
71. #define NAME_ONELINE_MAX (1024 * 1024)
72.
73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
74. {
75. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:181:13: Array access: Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline`
179. break;
180. } else
181. p = &(buf[lold]);
^
182. *(p++) = '/';
183. memcpy(p, s, (unsigned int)l1);
|
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L181
|
d2a_code_trace_data_44142
|
void
TIFFSwabLong8(uint64* lp)
{
register unsigned char* cp = (unsigned char*) lp;
unsigned char t;
assert(sizeof(uint64)==8);
t = cp[7]; cp[7] = cp[0]; cp[0] = t;
t = cp[6]; cp[6] = cp[1]; cp[1] = t;
t = cp[5]; cp[5] = cp[2]; cp[2] = t;
t = cp[4]; cp[4] = cp[3]; cp[3] = t;
}
libtiff/tif_dirread.c:1651: error: Buffer Overrun L3
Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8`.
libtiff/tif_dirread.c:1539:6: Call
1537. return(TIFFReadDirEntryErrType);
1538. }
1539. err=TIFFReadDirEntryArray(tif,direntry,&count,4,&origdata);
^
1540. if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
1541. {
libtiff/tif_dirread.c:756:1: Parameter `**value`
754. }
755.
756. static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize, void** value)
^
757. {
758. int typesize;
libtiff/tif_dirread.c:1646:5: Assignment
1644. uint32* mb;
1645. uint32 n;
1646. ma=(uint64*)origdata;
^
1647. mb=data;
1648. for (n=0; n<count; n++)
libtiff/tif_dirread.c:1651:7: Call
1649. {
1650. if (tif->tif_flags&TIFF_SWAB)
1651. TIFFSwabLong8(ma);
^
1652. err=TIFFReadDirEntryCheckRangeLongLong8(*ma);
1653. if (err!=TIFFReadDirEntryErrOk)
libtiff/tif_swab.c:58:1: <Length trace>
56.
57. #ifndef TIFFSwabLong8
58. void
^
59. TIFFSwabLong8(uint64* lp)
60. {
libtiff/tif_swab.c:58:1: Parameter `*lp`
56.
57. #ifndef TIFFSwabLong8
58. void
^
59. TIFFSwabLong8(uint64* lp)
60. {
libtiff/tif_swab.c:61:2: Assignment
59. TIFFSwabLong8(uint64* lp)
60. {
61. register unsigned char* cp = (unsigned char*) lp;
^
62. unsigned char t;
63. assert(sizeof(uint64)==8);
libtiff/tif_swab.c:64:6: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8`
62. unsigned char t;
63. assert(sizeof(uint64)==8);
64. t = cp[7]; cp[7] = cp[0]; cp[0] = t;
^
65. t = cp[6]; cp[6] = cp[1]; cp[1] = t;
66. t = cp[5]; cp[5] = cp[2]; cp[2] = t;
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L64
|
d2a_code_trace_data_44143
|
void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
AVIOContext *pb = s->pb;
if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
(s->flags & AVFMT_FLAG_CUSTOM_IO))
pb = NULL;
flush_packet_queue(s);
if (s->iformat)
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
*ps = NULL;
avio_close(pb);
}
libavformat/utils.c:2659: error: Null Dereference
pointer `pb` last assigned on line 2647 could be null and is dereferenced by call to `avio_close()` at line 2659, column 5.
libavformat/utils.c:2640:1: start of procedure avformat_close_input()
2638. }
2639.
2640. void avformat_close_input(AVFormatContext **ps)
^
2641. {
2642. AVFormatContext *s = *ps;
libavformat/utils.c:2642:5:
2640. void avformat_close_input(AVFormatContext **ps)
2641. {
2642. AVFormatContext *s = *ps;
^
2643. AVIOContext *pb = s->pb;
2644.
libavformat/utils.c:2643:5:
2641. {
2642. AVFormatContext *s = *ps;
2643. AVIOContext *pb = s->pb;
^
2644.
2645. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
libavformat/utils.c:2645:10: Taking true branch
2643. AVIOContext *pb = s->pb;
2644.
2645. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2646. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2647. pb = NULL;
libavformat/utils.c:2645:24: Taking false branch
2643. AVIOContext *pb = s->pb;
2644.
2645. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2646. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2647. pb = NULL;
libavformat/utils.c:2646:10: Taking true branch
2644.
2645. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2646. (s->flags & AVFMT_FLAG_CUSTOM_IO))
^
2647. pb = NULL;
2648.
libavformat/utils.c:2647:9:
2645. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2646. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2647. pb = NULL;
^
2648.
2649. flush_packet_queue(s);
libavformat/utils.c:2649:5: Skipping flush_packet_queue(): empty list of specs
2647. pb = NULL;
2648.
2649. flush_packet_queue(s);
^
2650.
2651. if (s->iformat)
libavformat/utils.c:2651:9: Taking true branch
2649. flush_packet_queue(s);
2650.
2651. if (s->iformat)
^
2652. if (s->iformat->read_close)
2653. s->iformat->read_close(s);
libavformat/utils.c:2652:13: Taking true branch
2650.
2651. if (s->iformat)
2652. if (s->iformat->read_close)
^
2653. s->iformat->read_close(s);
2654.
libavformat/utils.c:2653:13: Skipping __function_pointer__(): unresolved function pointer
2651. if (s->iformat)
2652. if (s->iformat->read_close)
2653. s->iformat->read_close(s);
^
2654.
2655. avformat_free_context(s);
libavformat/utils.c:2655:5: Skipping avformat_free_context(): empty list of specs
2653. s->iformat->read_close(s);
2654.
2655. avformat_free_context(s);
^
2656.
2657. *ps = NULL;
libavformat/utils.c:2657:5:
2655. avformat_free_context(s);
2656.
2657. *ps = NULL;
^
2658.
2659. avio_close(pb);
libavformat/utils.c:2659:5:
2657. *ps = NULL;
2658.
2659. avio_close(pb);
^
2660. }
2661.
libavformat/aviobuf.c:794:1: start of procedure avio_close()
792. }
793.
794. int avio_close(AVIOContext *s)
^
795. {
796. URLContext *h;
libavformat/aviobuf.c:798:10: Taking false branch
796. URLContext *h;
797.
798. if (!s)
^
799. return 0;
800.
libavformat/aviobuf.c:801:5:
799. return 0;
800.
801. avio_flush(s);
^
802. h = s->opaque;
803. av_freep(&s->buffer);
libavformat/aviobuf.c:180:1: start of procedure avio_flush()
178. }
179.
180. void avio_flush(AVIOContext *s)
^
181. {
182. flush_buffer(s);
libavformat/aviobuf.c:182:5:
180. void avio_flush(AVIOContext *s)
181. {
182. flush_buffer(s);
^
183. s->must_flush = 0;
184. }
libavformat/aviobuf.c:124:1: start of procedure flush_buffer()
122. }
123.
124. static void flush_buffer(AVIOContext *s)
^
125. {
126. if (s->buf_ptr > s->buffer) {
libavformat/aviobuf.c:126:9:
124. static void flush_buffer(AVIOContext *s)
125. {
126. if (s->buf_ptr > s->buffer) {
^
127. if (s->write_packet && !s->error) {
128. int ret = s->write_packet(s->opaque, s->buffer,
|
https://github.com/libav/libav/blob/e46ad30a808744ddf3855567e162292a4eaabac7/libavformat/utils.c/#L2659
|
d2a_code_trace_data_44144
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_exp.c:72: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_sqr`.
Showing all 18 steps of the trace
crypto/bn/bn_exp.c:41:1: Parameter `ctx->stack.depth`
39.
40. /* this one works - simple but works */
41. > int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
42. {
43. int i, bits, ret = 0;
crypto/bn/bn_exp.c:53:5: Call
51. }
52.
53. BN_CTX_start(ctx);
^
54. rr = ((r == a) || (r == p)) ? BN_CTX_get(ctx) : r;
55. v = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:55:9: Call
53. BN_CTX_start(ctx);
54. rr = ((r == a) || (r == p)) ? BN_CTX_get(ctx) : r;
55. v = BN_CTX_get(ctx);
^
56. if (rr == NULL || v == NULL)
57. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:72:14: Call
70.
71. for (i = 1; i < bits; i++) {
72. if (!BN_sqr(v, v, ctx))
^
73. goto err;
74. if (BN_is_bit_set(p, i)) {
crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
crypto/bn/bn_sqr.c:19:15: Call
17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
^
20.
21. bn_correct_top(r);
crypto/bn/bn_sqr.c:42:5: Call
40. }
41.
42. BN_CTX_start(ctx);
^
43. rr = (a != r) ? r : BN_CTX_get(ctx);
44. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_sqr.c:104:5: Call
102. bn_check_top(rr);
103. bn_check_top(tmp);
104. BN_CTX_end(ctx);
^
105. return ret;
106. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_sqr`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44145
|
static int flic_decode_frame_8BPP(AVCodecContext *avctx,
void *data, int *got_frame,
const uint8_t *buf, int buf_size)
{
FlicDecodeContext *s = avctx->priv_data;
GetByteContext g2;
int stream_ptr_after_color_chunk;
int pixel_ptr;
int palette_ptr;
unsigned char palette_idx1;
unsigned char palette_idx2;
unsigned int frame_size;
int num_chunks;
unsigned int chunk_size;
int chunk_type;
int i, j, ret;
int color_packets;
int color_changes;
int color_shift;
unsigned char r, g, b;
int lines;
int compressed_lines;
int starting_line;
signed short line_packets;
int y_ptr;
int byte_run;
int pixel_skip;
int pixel_countdown;
unsigned char *pixels;
unsigned int pixel_limit;
bytestream2_init(&g2, buf, buf_size);
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return ret;
}
pixels = s->frame->data[0];
pixel_limit = s->avctx->height * s->frame->linesize[0];
frame_size = bytestream2_get_le32(&g2);
bytestream2_skip(&g2, 2);
num_chunks = bytestream2_get_le16(&g2);
bytestream2_skip(&g2, 8);
frame_size -= 16;
while ((frame_size > 0) && (num_chunks > 0)) {
chunk_size = bytestream2_get_le32(&g2);
chunk_type = bytestream2_get_le16(&g2);
switch (chunk_type) {
case FLI_256_COLOR:
case FLI_COLOR:
stream_ptr_after_color_chunk = bytestream2_tell(&g2) + chunk_size - 6;
if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE))
color_shift = 0;
else
color_shift = 2;
color_packets = bytestream2_get_le16(&g2);
palette_ptr = 0;
for (i = 0; i < color_packets; i++) {
palette_ptr += bytestream2_get_byte(&g2);
color_changes = bytestream2_get_byte(&g2);
if (color_changes == 0)
color_changes = 256;
for (j = 0; j < color_changes; j++) {
unsigned int entry;
if ((unsigned)palette_ptr >= 256)
palette_ptr = 0;
r = bytestream2_get_byte(&g2) << color_shift;
g = bytestream2_get_byte(&g2) << color_shift;
b = bytestream2_get_byte(&g2) << color_shift;
entry = (r << 16) | (g << 8) | b;
if (s->palette[palette_ptr] != entry)
s->new_palette = 1;
s->palette[palette_ptr++] = entry;
}
}
if (stream_ptr_after_color_chunk - bytestream2_tell(&g2) > 0)
bytestream2_skip(&g2, stream_ptr_after_color_chunk - bytestream2_tell(&g2));
break;
case FLI_DELTA:
y_ptr = 0;
compressed_lines = bytestream2_get_le16(&g2);
while (compressed_lines > 0) {
line_packets = bytestream2_get_le16(&g2);
if ((line_packets & 0xC000) == 0xC000) {
line_packets = -line_packets;
y_ptr += line_packets * s->frame->linesize[0];
} else if ((line_packets & 0xC000) == 0x4000) {
av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets);
} else if ((line_packets & 0xC000) == 0x8000) {
pixel_ptr= y_ptr + s->frame->linesize[0] - 1;
CHECK_PIXEL_PTR(0);
pixels[pixel_ptr] = line_packets & 0xff;
} else {
compressed_lines--;
pixel_ptr = y_ptr;
CHECK_PIXEL_PTR(0);
pixel_countdown = s->avctx->width;
for (i = 0; i < line_packets; i++) {
pixel_skip = bytestream2_get_byte(&g2);
pixel_ptr += pixel_skip;
pixel_countdown -= pixel_skip;
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (byte_run < 0) {
byte_run = -byte_run;
palette_idx1 = bytestream2_get_byte(&g2);
palette_idx2 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run * 2);
for (j = 0; j < byte_run; j++, pixel_countdown -= 2) {
pixels[pixel_ptr++] = palette_idx1;
pixels[pixel_ptr++] = palette_idx2;
}
} else {
CHECK_PIXEL_PTR(byte_run * 2);
for (j = 0; j < byte_run * 2; j++, pixel_countdown--) {
pixels[pixel_ptr++] = bytestream2_get_byte(&g2);
}
}
}
y_ptr += s->frame->linesize[0];
}
}
break;
case FLI_LC:
starting_line = bytestream2_get_le16(&g2);
y_ptr = 0;
y_ptr += starting_line * s->frame->linesize[0];
compressed_lines = bytestream2_get_le16(&g2);
while (compressed_lines > 0) {
pixel_ptr = y_ptr;
CHECK_PIXEL_PTR(0);
pixel_countdown = s->avctx->width;
line_packets = bytestream2_get_byte(&g2);
if (line_packets > 0) {
for (i = 0; i < line_packets; i++) {
pixel_skip = bytestream2_get_byte(&g2);
pixel_ptr += pixel_skip;
pixel_countdown -= pixel_skip;
byte_run = sign_extend(bytestream2_get_byte(&g2),8);
if (byte_run > 0) {
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++, pixel_countdown--) {
pixels[pixel_ptr++] = bytestream2_get_byte(&g2);
}
} else if (byte_run < 0) {
byte_run = -byte_run;
palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++, pixel_countdown--) {
pixels[pixel_ptr++] = palette_idx1;
}
}
}
}
y_ptr += s->frame->linesize[0];
compressed_lines--;
}
break;
case FLI_BLACK:
memset(pixels, 0,
s->frame->linesize[0] * s->avctx->height);
break;
case FLI_BRUN:
y_ptr = 0;
for (lines = 0; lines < s->avctx->height; lines++) {
pixel_ptr = y_ptr;
bytestream2_skip(&g2, 1);
pixel_countdown = s->avctx->width;
while (pixel_countdown > 0) {
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (!byte_run) {
av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
return AVERROR_INVALIDDATA;
}
if (byte_run > 0) {
palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++) {
pixels[pixel_ptr++] = palette_idx1;
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
pixel_countdown, lines);
}
} else {
byte_run = -byte_run;
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++) {
pixels[pixel_ptr++] = bytestream2_get_byte(&g2);
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
pixel_countdown, lines);
}
}
}
y_ptr += s->frame->linesize[0];
}
break;
case FLI_COPY:
if (chunk_size - 6 > s->avctx->width * s->avctx->height) {
av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
"bigger than image, skipping chunk\n", chunk_size - 6);
bytestream2_skip(&g2, chunk_size - 6);
} else {
for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
y_ptr += s->frame->linesize[0]) {
bytestream2_get_buffer(&g2, &pixels[y_ptr],
s->avctx->width);
}
}
break;
case FLI_MINI:
bytestream2_skip(&g2, chunk_size - 6);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
break;
}
frame_size -= chunk_size;
num_chunks--;
}
if ((bytestream2_get_bytes_left(&g2) != 0) &&
(bytestream2_get_bytes_left(&g2) != 1))
av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
"and final chunk ptr = %d\n", buf_size,
buf_size - bytestream2_get_bytes_left(&g2));
memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
if (s->new_palette) {
s->frame->palette_has_changed = 1;
s->new_palette = 0;
}
if ((ret = av_frame_ref(data, s->frame)) < 0)
return ret;
*got_frame = 1;
return buf_size;
}
libavcodec/flicvideo.c:390: error: Integer Overflow L2
([min(0, `buf->l`), max(0, `buf->l`)] - 6):unsigned32.
libavcodec/flicvideo.c:135:1: <LHS trace>
133. }
134.
135. static int flic_decode_frame_8BPP(AVCodecContext *avctx,
^
136. void *data, int *got_frame,
137. const uint8_t *buf, int buf_size)
libavcodec/flicvideo.c:135:1: Parameter `*buf`
133. }
134.
135. static int flic_decode_frame_8BPP(AVCodecContext *avctx,
^
136. void *data, int *got_frame,
137. const uint8_t *buf, int buf_size)
libavcodec/flicvideo.c:394:21: Call
392. for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
393. y_ptr += s->frame->linesize[0]) {
394. bytestream2_get_buffer(&g2, &pixels[y_ptr],
^
395. s->avctx->width);
396. }
libavcodec/bytestream.h:260:1: Parameter `*g->buffer`
258. }
259.
260. static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g,
^
261. uint8_t *dst,
262. unsigned int size)
libavcodec/flicvideo.c:390:17: Binary operation: ([min(0, buf->l), max(0, buf->l)] - 6):unsigned32
388. av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
389. "bigger than image, skipping chunk\n", chunk_size - 6);
390. bytestream2_skip(&g2, chunk_size - 6);
^
391. } else {
392. for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
|
https://github.com/libav/libav/blob/004ea63714e31ed43326ad00d7420d104f0dab38/libavcodec/flicvideo.c/#L390
|
d2a_code_trace_data_44146
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
ssl/statem/statem_srvr.c:3094: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_generate_server_master_secret`.
Showing all 29 steps of the trace
ssl/statem/statem_srvr.c:3076:25: Call
3074. return 0;
3075. }
3076. if ((s->srp_ctx.A = BN_bin2bn(data, i, NULL)) == NULL) {
^
3077. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_SRP,
3078. ERR_R_BN_LIB);
crypto/bn/bn_lib.c:416:9: Assignment
414. n = len;
415. if (n == 0) {
416. ret->top = 0;
^
417. return ret;
418. }
ssl/statem/statem_srvr.c:3094:10: Call
3092. }
3093.
3094. if (!srp_generate_server_master_secret(s)) {
^
3095. /* SSLfatal() already called */
3096. return 0;
ssl/tls_srp.c:245:1: Parameter `s->srp_ctx.A->top`
243. }
244.
245. > int srp_generate_server_master_secret(SSL *s)
246. {
247. BIGNUM *K = NULL, *u = NULL;
ssl/tls_srp.c:251:10: Call
249. unsigned char *tmp = NULL;
250.
251. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N))
^
252. goto err;
253. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL)
crypto/srp/srp_lib.c:233:1: Parameter `A->top`
231. }
232.
233. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N)
234. {
235. /* Checks if A % N == 0 */
crypto/srp/srp_lib.c:236:12: Call
234. {
235. /* Checks if A % N == 0 */
236. return SRP_Verify_B_mod_N(A, N);
^
237. }
238.
crypto/srp/srp_lib.c:212:1: Parameter `B->top`
210. }
211.
212. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N)
213. {
214. BIGNUM *r;
ssl/tls_srp.c:253:14: Call
251. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N))
252. goto err;
253. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL)
^
254. goto err;
255. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b,
crypto/srp/srp_lib.c:47:1: Parameter `A->top`
45. }
46.
47. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
48. {
49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
crypto/srp/srp_lib.c:50:12: Call
48. {
49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
50. return srp_Calc_xy(A, B, N);
^
51. }
52.
crypto/srp/srp_lib.c:19:1: Parameter `x->top`
17. /* calculate = SHA1(PAD(x) || PAD(y)) */
18.
19. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N)
20. {
21. unsigned char digest[SHA_DIGEST_LENGTH];
ssl/tls_srp.c:255:14: Call
253. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL)
254. goto err;
255. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b,
^
256. s->srp_ctx.N)) == NULL)
257. goto err;
crypto/srp/srp_lib.c:53:1: Parameter `A->top`
51. }
52.
53. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,
54. const BIGNUM *b, const BIGNUM *N)
55. {
crypto/srp/srp_lib.c:69:10: Call
67. if (!BN_mod_exp(tmp, v, u, N, bn_ctx))
68. goto err;
69. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx))
^
70. goto err;
71.
crypto/bn/bn_mod.c:73:1: Parameter `a->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:116:5: Assignment
114. rp[0] = rp[max - 1] = 0;
115. rp++;
116. j = n;
^
117.
118. if (--j > 0) {
crypto/bn/bn_sqr.c:118:9: Assignment
116. j = n;
117.
118. if (--j > 0) {
^
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
115. rp++;
^
116. j = n;
117.
crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_generate_server_master_secret`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
|
https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/crypto/bn/bn_sqr.c/#L120
|
d2a_code_trace_data_44147
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_chk.c:105: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mul`.
Showing all 19 steps of the trace
crypto/rsa/rsa_chk.c:84:9: Call
82.
83. /* q prime? */
84. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) {
^
85. ret = 0;
86. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME);
crypto/bn/bn_prime.c:183:12: Call
181. BN_GENCB *cb)
182. {
183. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
184. }
185.
crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth`
185.
186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */
187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed,
188. int do_trial_division, BN_GENCB *cb)
189. {
crypto/rsa/rsa_chk.c:99:10: Call
97.
98. /* n = p*q * r_3...r_i? */
99. if (!BN_mul(i, key->p, key->q, ctx)) {
^
100. ret = -1;
101. 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:507:1: Parameter `ctx->stack.depth`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
crypto/rsa/rsa_chk.c:105:14: Call
103. for (idx = 0; idx < ex_primes; idx++) {
104. pinfo = sk_RSA_PRIME_INFO_value(key->prime_infos, idx);
105. if (!BN_mul(i, i, pinfo->r, ctx)) {
^
106. ret = -1;
107. 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:507:1: Parameter `ctx->stack.depth`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
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.depth`
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.depth`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <LHS trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_44148
|
static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){
MpegEncContext * const s = &h->s;
static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};
int level[16];
int zeros_left, coeff_num, coeff_token, total_coeff, i, j, trailing_ones, run_before;
if(n == CHROMA_DC_BLOCK_INDEX){
coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);
total_coeff= coeff_token>>2;
}else{
if(n == LUMA_DC_BLOCK_INDEX){
total_coeff= pred_non_zero_count(h, 0);
coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
total_coeff= coeff_token>>2;
}else{
total_coeff= pred_non_zero_count(h, n);
coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
total_coeff= coeff_token>>2;
h->non_zero_count_cache[ scan8[n] ]= total_coeff;
}
}
if(total_coeff==0)
return 0;
if(total_coeff > (unsigned)max_coeff) {
av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff);
return -1;
}
trailing_ones= coeff_token&3;
tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);
assert(total_coeff<=16);
for(i=0; i<trailing_ones; i++){
level[i]= 1 - 2*get_bits1(gb);
}
if(i<total_coeff) {
int level_code, mask;
int suffix_length = total_coeff > 10 && trailing_ones < 3;
int prefix= get_level_prefix(gb);
if(prefix<14){
if(suffix_length)
level_code= (prefix<<suffix_length) + get_bits(gb, suffix_length);
else
level_code= (prefix<<suffix_length);
}else if(prefix==14){
if(suffix_length)
level_code= (prefix<<suffix_length) + get_bits(gb, suffix_length);
else
level_code= prefix + get_bits(gb, 4);
}else if(prefix==15){
level_code= (prefix<<suffix_length) + get_bits(gb, 12);
if(suffix_length==0) level_code+=15;
}else{
av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if(trailing_ones < 3) level_code += 2;
suffix_length = 1;
if(level_code > 5)
suffix_length++;
mask= -(level_code&1);
level[i]= (((2+level_code)>>1) ^ mask) - mask;
i++;
for(;i<total_coeff;i++) {
static const int suffix_limit[7] = {0,5,11,23,47,95,INT_MAX };
prefix = get_level_prefix(gb);
if(prefix<15){
level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);
}else if(prefix==15){
level_code = (prefix<<suffix_length) + get_bits(gb, 12);
}else{
av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mask= -(level_code&1);
level[i]= (((2+level_code)>>1) ^ mask) - mask;
if(level_code > suffix_limit[suffix_length])
suffix_length++;
}
}
if(total_coeff == max_coeff)
zeros_left=0;
else{
if(n == CHROMA_DC_BLOCK_INDEX)
zeros_left= get_vlc2(gb, chroma_dc_total_zeros_vlc[ total_coeff-1 ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);
else
zeros_left= get_vlc2(gb, total_zeros_vlc[ total_coeff-1 ].table, TOTAL_ZEROS_VLC_BITS, 1);
}
coeff_num = zeros_left + total_coeff - 1;
j = scantable[coeff_num];
if(n > 24){
block[j] = level[0];
for(i=1;i<total_coeff;i++) {
if(zeros_left <= 0)
run_before = 0;
else if(zeros_left < 7){
run_before= get_vlc2(gb, run_vlc[zeros_left-1].table, RUN_VLC_BITS, 1);
}else{
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
}
zeros_left -= run_before;
coeff_num -= 1 + run_before;
j= scantable[ coeff_num ];
block[j]= level[i];
}
}else{
block[j] = (level[0] * qmul[j] + 32)>>6;
for(i=1;i<total_coeff;i++) {
if(zeros_left <= 0)
run_before = 0;
else if(zeros_left < 7){
run_before= get_vlc2(gb, run_vlc[zeros_left-1].table, RUN_VLC_BITS, 1);
}else{
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
}
zeros_left -= run_before;
coeff_num -= 1 + run_before;
j= scantable[ coeff_num ];
block[j]= (level[i] * qmul[j] + 32)>>6;
}
}
if(zeros_left<0){
av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
return 0;
}
libavcodec/h264.c:4400: error: Uninitialized Value
The value read from level[_] was never initialized.
libavcodec/h264.c:4400:9:
4398. j = scantable[coeff_num];
4399. if(n > 24){
4400. block[j] = level[0];
^
4401. for(i=1;i<total_coeff;i++) {
4402. if(zeros_left <= 0)
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L4400
|
d2a_code_trace_data_44149
|
static int run_cert(X509 *crt, const char *nameincert,
const struct set_name_fn *fn)
{
const char *const *pname = names;
int failed = 0;
for (; *pname != NULL; ++pname) {
int samename = strcasecmp(nameincert, *pname) == 0;
size_t namelen = strlen(*pname);
char *name = OPENSSL_malloc(namelen);
int match, ret;
memcpy(name, *pname, namelen);
match = -1;
if (!TEST_int_ge(ret = X509_check_host(crt, name, namelen, 0, NULL),
0)) {
failed = 1;
} else if (fn->host) {
if (ret == 1 && !samename)
match = 1;
if (ret == 0 && samename)
match = 0;
} else if (ret == 1)
match = 1;
if (!TEST_true(check_message(fn, "host", nameincert, match, *pname)))
failed = 1;
match = -1;
if (!TEST_int_ge(ret = X509_check_host(crt, name, namelen,
X509_CHECK_FLAG_NO_WILDCARDS,
NULL), 0)) {
failed = 1;
} else if (fn->host) {
if (ret == 1 && !samename)
match = 1;
if (ret == 0 && samename)
match = 0;
} else if (ret == 1)
match = 1;
if (!TEST_true(check_message(fn, "host-no-wildcards",
nameincert, match, *pname)))
failed = 1;
match = -1;
ret = X509_check_email(crt, name, namelen, 0);
if (fn->email) {
if (ret && !samename)
match = 1;
if (!ret && samename && strchr(nameincert, '@') != NULL)
match = 0;
} else if (ret)
match = 1;
if (!TEST_true(check_message(fn, "email", nameincert, match, *pname)))
failed = 1;
OPENSSL_free(name);
}
return failed == 0;
}
test/v3nametest.c:295: error: NULL_DEREFERENCE
pointer `name` last assigned on line 292 could be null and is dereferenced by call to `memcpy()` at line 295, column 9.
Showing all 20 steps of the trace
test/v3nametest.c:283:1: start of procedure run_cert()
281. }
282.
283. > static int run_cert(X509 *crt, const char *nameincert,
284. const struct set_name_fn *fn)
285. {
test/v3nametest.c:286:5:
284. const struct set_name_fn *fn)
285. {
286. > const char *const *pname = names;
287. int failed = 0;
288.
test/v3nametest.c:287:5:
285. {
286. const char *const *pname = names;
287. > int failed = 0;
288.
289. for (; *pname != NULL; ++pname) {
test/v3nametest.c:289:12: Loop condition is true. Entering loop body
287. int failed = 0;
288.
289. for (; *pname != NULL; ++pname) {
^
290. int samename = strcasecmp(nameincert, *pname) == 0;
291. size_t namelen = strlen(*pname);
test/v3nametest.c:290:24: Condition is false
288.
289. for (; *pname != NULL; ++pname) {
290. int samename = strcasecmp(nameincert, *pname) == 0;
^
291. size_t namelen = strlen(*pname);
292. char *name = OPENSSL_malloc(namelen);
test/v3nametest.c:290:9:
288.
289. for (; *pname != NULL; ++pname) {
290. > int samename = strcasecmp(nameincert, *pname) == 0;
291. size_t namelen = strlen(*pname);
292. char *name = OPENSSL_malloc(namelen);
test/v3nametest.c:291:9:
289. for (; *pname != NULL; ++pname) {
290. int samename = strcasecmp(nameincert, *pname) == 0;
291. > size_t namelen = strlen(*pname);
292. char *name = OPENSSL_malloc(namelen);
293. int match, ret;
test/v3nametest.c:292:9:
290. int samename = strcasecmp(nameincert, *pname) == 0;
291. size_t namelen = strlen(*pname);
292. > char *name = OPENSSL_malloc(namelen);
293. int match, ret;
294.
crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
190. #endif
191.
192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. void *ret = NULL;
crypto/mem.c:194:5:
192. void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. > void *ret = NULL;
195.
196. INCREMENT(malloc_count);
crypto/mem.c:197:9: Taking true branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:197:32: Taking false branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:200:9: Taking false branch
198. return malloc_impl(num, file, line);
199.
200. if (num == 0)
^
201. return NULL;
202.
crypto/mem.c:204:5:
202.
203. FAILTEST();
204. > allow_customize = 0;
205. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
206. if (call_malloc_debug) {
crypto/mem.c:214:5:
212. }
213. #else
214. > (void)(file); (void)(line);
215. ret = malloc(num);
216. #endif
crypto/mem.c:214:19:
212. }
213. #else
214. > (void)(file); (void)(line);
215. ret = malloc(num);
216. #endif
crypto/mem.c:215:5:
213. #else
214. (void)(file); (void)(line);
215. > ret = malloc(num);
216. #endif
217.
crypto/mem.c:218:5:
216. #endif
217.
218. > return ret;
219. }
220.
crypto/mem.c:219:1: return from a call to CRYPTO_malloc
217.
218. return ret;
219. > }
220.
221. void *CRYPTO_zalloc(size_t num, const char *file, int line)
test/v3nametest.c:295:9:
293. int match, ret;
294.
295. > memcpy(name, *pname, namelen);
296.
297. match = -1;
|
https://github.com/openssl/openssl/blob/2b1aa1988189773497d6edba443cf77f5c31feba/test/v3nametest.c/#L295
|
d2a_code_trace_data_44150
|
void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
const char *file, int line)
{
void *ret = NULL;
if (str == NULL)
return CRYPTO_malloc(num, file, line);
if (num == 0) {
CRYPTO_clear_free(str, old_len);
return NULL;
}
if (num < old_len) {
memset((char*)str + num, 0, old_len - num);
return str;
}
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);
ret = malloc(num);
CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);
} else {
ret = malloc(num);
}
#else
(void)file;
(void)line;
ret = malloc(num);
#endif
if (ret)
memcpy(ret, str, old_len);
CRYPTO_clear_free(str, old_len);
return ret;
}
crypto/asn1/tasn_dec.c:769: error: INTEGER_OVERFLOW_L2
([2, 2147483644] - [1, 2147483644]):unsigned64 by call to `BUF_MEM_grow_clean`.
Showing all 11 steps of the trace
crypto/asn1/tasn_dec.c:671:19: Assignment
669. char cst, inf, free_cont = 0;
670. const unsigned char *p;
671. BUF_MEM buf = { 0, NULL, 0, 0 };
^
672. const unsigned char *cont = NULL;
673. long len;
crypto/asn1/tasn_dec.c:764:14: Call
762. * So instead just check for UNIVERSAL class and ignore the tag.
763. */
764. if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
^
765. goto err;
766. }
crypto/asn1/tasn_dec.c:1003:1: Parameter `buf->max`
1001. #endif
1002.
1003. > static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len,
1004. char inf, int tag, int aclass, int depth)
1005. {
crypto/asn1/tasn_dec.c:769:14: Call
767. len = buf.length;
768. /* Append a final null to string */
769. if (!BUF_MEM_grow_clean(&buf, len + 1)) {
^
770. ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
771. goto err;
crypto/buffer/buffer.c:158:1: Parameter `len`
156. }
157.
158. > size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
159. {
160. char *ret;
crypto/buffer/buffer.c:182:15: Call
180. ret = sec_alloc_realloc(str, n);
181. else
182. ret = OPENSSL_clear_realloc(str->data, str->max, n);
^
183. if (ret == NULL) {
184. BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE);
crypto/mem.c:193:1: <LHS trace>
191. }
192.
193. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
194. const char *file, int line)
195. {
crypto/mem.c:193:1: Parameter `num`
191. }
192.
193. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
194. const char *file, int line)
195. {
crypto/mem.c:193:1: <RHS trace>
191. }
192.
193. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
194. const char *file, int line)
195. {
crypto/mem.c:193:1: Parameter `num`
191. }
192.
193. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
194. const char *file, int line)
195. {
crypto/mem.c:208:9: Binary operation: ([2, 2147483644] - [1, 2147483644]):unsigned64 by call to `BUF_MEM_grow_clean`
206. /* Can't shrink the buffer since memcpy below copies |old_len| bytes. */
207. if (num < old_len) {
208. memset((char*)str + num, 0, old_len - num);
^
209. return str;
210. }
|
https://github.com/openssl/openssl/blob/68ed0b2480023424f280e98cda7199d913f3d7cc/crypto/mem.c/#L208
|
d2a_code_trace_data_44151
|
static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
{
MOVMuxContext *mov = s->priv_data;
MOVTrack *track = &mov->tracks[tracknum];
AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
int i, len;
track->mode = mov->mode;
track->tag = MKTAG('t','e','x','t');
track->timescale = MOV_TIMESCALE;
track->enc = avcodec_alloc_context3(NULL);
track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
for (i = 0; i < s->nb_chapters; i++) {
AVChapter *c = s->chapters[i];
AVDictionaryEntry *t;
int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
pkt.duration = end - pkt.dts;
if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
len = strlen(t->value);
pkt.size = len+2;
pkt.data = av_malloc(pkt.size);
AV_WB16(pkt.data, len);
memcpy(pkt.data+2, t->value, len);
ff_mov_write_packet(s, &pkt);
av_freep(&pkt.data);
}
}
}
libavformat/movenc.c:3003: error: Null Dereference
pointer `pkt.data` last assigned on line 3002 could be null and is dereferenced at line 3003, column 13.
libavformat/movenc.c:2978:1: start of procedure mov_create_chapter_track()
2976. // QuickTime chapters involve an additional text track with the chapter names
2977. // as samples, and a tref pointing from the other tracks to the chapter one.
2978. static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
^
2979. {
2980. MOVMuxContext *mov = s->priv_data;
libavformat/movenc.c:2980:5:
2978. static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
2979. {
2980. MOVMuxContext *mov = s->priv_data;
^
2981. MOVTrack *track = &mov->tracks[tracknum];
2982. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
libavformat/movenc.c:2981:5:
2979. {
2980. MOVMuxContext *mov = s->priv_data;
2981. MOVTrack *track = &mov->tracks[tracknum];
^
2982. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
2983. int i, len;
libavformat/movenc.c:2982:5:
2980. MOVMuxContext *mov = s->priv_data;
2981. MOVTrack *track = &mov->tracks[tracknum];
2982. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
^
2983. int i, len;
2984.
libavformat/movenc.c:2985:5:
2983. int i, len;
2984.
2985. track->mode = mov->mode;
^
2986. track->tag = MKTAG('t','e','x','t');
2987. track->timescale = MOV_TIMESCALE;
libavformat/movenc.c:2986:5:
2984.
2985. track->mode = mov->mode;
2986. track->tag = MKTAG('t','e','x','t');
^
2987. track->timescale = MOV_TIMESCALE;
2988. track->enc = avcodec_alloc_context3(NULL);
libavformat/movenc.c:2987:5:
2985. track->mode = mov->mode;
2986. track->tag = MKTAG('t','e','x','t');
2987. track->timescale = MOV_TIMESCALE;
^
2988. track->enc = avcodec_alloc_context3(NULL);
2989. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
libavformat/movenc.c:2988:5:
2986. track->tag = MKTAG('t','e','x','t');
2987. track->timescale = MOV_TIMESCALE;
2988. track->enc = avcodec_alloc_context3(NULL);
^
2989. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
2990.
libavcodec/options.c:123:1: start of procedure avcodec_alloc_context3()
121. }
122.
123. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
^
124. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
125.
libavcodec/options.c:124:5:
122.
123. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
124. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
^
125.
126. if(avctx==NULL) return NULL;
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)
libavcodec/options.c:126:8: Taking false branch
124. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
125.
126. if(avctx==NULL) return NULL;
^
127.
128. if(avcodec_get_context_defaults3(avctx, codec) < 0){
libavcodec/options.c:128:8: Taking false branch
126. if(avctx==NULL) return NULL;
127.
128. if(avcodec_get_context_defaults3(avctx, codec) < 0){
^
129. av_free(avctx);
130. return NULL;
libavcodec/options.c:133:5:
131. }
132.
133. return avctx;
^
134. }
135.
libavcodec/options.c:134:1: return from a call to avcodec_alloc_context3
132.
133. return avctx;
134. }
^
135.
136. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
libavformat/movenc.c:2989:5:
2987. track->timescale = MOV_TIMESCALE;
2988. track->enc = avcodec_alloc_context3(NULL);
2989. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
^
2990.
2991. for (i = 0; i < s->nb_chapters; i++) {
libavformat/movenc.c:2991:10:
2989. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
2990.
2991. for (i = 0; i < s->nb_chapters; i++) {
^
2992. AVChapter *c = s->chapters[i];
2993. AVDictionaryEntry *t;
libavformat/movenc.c:2991:17: Loop condition is true. Entering loop body
2989. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
2990.
2991. for (i = 0; i < s->nb_chapters; i++) {
^
2992. AVChapter *c = s->chapters[i];
2993. AVDictionaryEntry *t;
libavformat/movenc.c:2992:9:
2990.
2991. for (i = 0; i < s->nb_chapters; i++) {
2992. AVChapter *c = s->chapters[i];
^
2993. AVDictionaryEntry *t;
2994.
libavformat/movenc.c:2995:9:
2993. AVDictionaryEntry *t;
2994.
2995. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
^
2996. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
2997. pkt.duration = end - pkt.dts;
libavutil/mathematics.c:141:1: start of procedure av_rescale_q()
139. }
140.
141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
^
142. {
143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
libavutil/mathematics.c:143:5:
141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
142. {
143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
^
144. }
145.
libavutil/mathematics.c:133:1: start of procedure av_rescale_q_rnd()
131. }
132.
133. int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
^
134. enum AVRounding rnd)
135. {
libavutil/mathematics.c:136:5:
134. enum AVRounding rnd)
135. {
136. int64_t b= bq.num * (int64_t)cq.den;
^
137. int64_t c= cq.num * (int64_t)bq.den;
138. return av_rescale_rnd(a, b, c, rnd);
libavutil/mathematics.c:137:5:
135. {
136. int64_t b= bq.num * (int64_t)cq.den;
137. int64_t c= cq.num * (int64_t)bq.den;
^
138. return av_rescale_rnd(a, b, c, rnd);
139. }
libavutil/mathematics.c:138:5: Skipping av_rescale_rnd(): empty list of specs
136. int64_t b= bq.num * (int64_t)cq.den;
137. int64_t c= cq.num * (int64_t)bq.den;
138. return av_rescale_rnd(a, b, c, rnd);
^
139. }
140.
libavutil/mathematics.c:139:1: return from a call to av_rescale_q_rnd
137. int64_t c= cq.num * (int64_t)bq.den;
138. return av_rescale_rnd(a, b, c, rnd);
139. }
^
140.
141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
libavutil/mathematics.c:144:1: return from a call to av_rescale_q
142. {
143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
144. }
^
145.
146. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
libavformat/movenc.c:2996:9:
2994.
2995. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
2996. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
^
2997. pkt.duration = end - pkt.dts;
2998.
libavutil/mathematics.c:141:1: start of procedure av_rescale_q()
139. }
140.
141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
^
142. {
143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
libavutil/mathematics.c:143:5:
141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
142. {
143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
^
144. }
145.
libavutil/mathematics.c:133:1: start of procedure av_rescale_q_rnd()
131. }
132.
133. int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
^
134. enum AVRounding rnd)
135. {
libavutil/mathematics.c:136:5:
134. enum AVRounding rnd)
135. {
136. int64_t b= bq.num * (int64_t)cq.den;
^
137. int64_t c= cq.num * (int64_t)bq.den;
138. return av_rescale_rnd(a, b, c, rnd);
libavutil/mathematics.c:137:5:
135. {
136. int64_t b= bq.num * (int64_t)cq.den;
137. int64_t c= cq.num * (int64_t)bq.den;
^
138. return av_rescale_rnd(a, b, c, rnd);
139. }
libavutil/mathematics.c:138:5: Skipping av_rescale_rnd(): empty list of specs
136. int64_t b= bq.num * (int64_t)cq.den;
137. int64_t c= cq.num * (int64_t)bq.den;
138. return av_rescale_rnd(a, b, c, rnd);
^
139. }
140.
libavutil/mathematics.c:139:1: return from a call to av_rescale_q_rnd
137. int64_t c= cq.num * (int64_t)bq.den;
138. return av_rescale_rnd(a, b, c, rnd);
139. }
^
140.
141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
libavutil/mathematics.c:144:1: return from a call to av_rescale_q
142. {
143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
144. }
^
145.
146. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
libavformat/movenc.c:2997:9:
2995. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
2996. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
2997. pkt.duration = end - pkt.dts;
^
2998.
2999. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
libavformat/movenc.c:2999:14: Taking true branch
2997. pkt.duration = end - pkt.dts;
2998.
2999. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
^
3000. len = strlen(t->value);
3001. pkt.size = len+2;
libavformat/movenc.c:3000:13:
2998.
2999. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
3000. len = strlen(t->value);
^
3001. pkt.size = len+2;
3002. pkt.data = av_malloc(pkt.size);
libavformat/movenc.c:3001:13:
2999. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
3000. len = strlen(t->value);
3001. pkt.size = len+2;
^
3002. pkt.data = av_malloc(pkt.size);
3003. AV_WB16(pkt.data, len);
libavformat/movenc.c:3002:13:
3000. len = strlen(t->value);
3001. pkt.size = len+2;
3002. pkt.data = av_malloc(pkt.size);
^
3003. AV_WB16(pkt.data, len);
3004. memcpy(pkt.data+2, t->value, len);
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking true branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:73:9:
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
73. return NULL;
^
74.
75. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavformat/movenc.c:3003:13:
3001. pkt.size = len+2;
3002. pkt.data = av_malloc(pkt.size);
3003. AV_WB16(pkt.data, len);
^
3004. memcpy(pkt.data+2, t->value, len);
3005. ff_mov_write_packet(s, &pkt);
libavutil/bswap.h:58:1: start of procedure av_bswap16()
56.
57. #ifndef av_bswap16
58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
^
59. {
60. x= (x>>8) | (x<<8);
libavutil/bswap.h:60:5:
58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
59. {
60. x= (x>>8) | (x<<8);
^
61. return x;
62. }
libavutil/bswap.h:61:5:
59. {
60. x= (x>>8) | (x<<8);
61. return x;
^
62. }
63. #endif
libavutil/bswap.h:62:1: return from a call to av_bswap16
60. x= (x>>8) | (x<<8);
61. return x;
62. }
^
63. #endif
64.
|
https://github.com/libav/libav/blob/d5ed5e7d0c1fa46de348db0de4c82b0f621db3d4/libavformat/movenc.c/#L3003
|
d2a_code_trace_data_44152
|
void RAND_add(const void *buf, int num, double randomness)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->add != NULL)
meth->add(buf, num, randomness);
}
crypto/rand/rand_lib.c:800: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 798 could be null and is dereferenced at line 800, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:796:1: start of procedure RAND_add()
794. }
795.
796. > void RAND_add(const void *buf, int num, double randomness)
797. {
798. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:798:5:
796. void RAND_add(const void *buf, int num, double randomness)
797. {
798. > const RAND_METHOD *meth = RAND_get_rand_method();
799.
800. if (meth->add != NULL)
crypto/rand/rand_lib.c:732:1: start of procedure RAND_get_rand_method()
730. }
731.
732. > const RAND_METHOD *RAND_get_rand_method(void)
733. {
734. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:734:5:
732. const RAND_METHOD *RAND_get_rand_method(void)
733. {
734. > const RAND_METHOD *tmp_meth = NULL;
735.
736. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:736:10:
734. const RAND_METHOD *tmp_meth = NULL;
735.
736. > if (!RUN_ONCE(&rand_init, do_rand_init))
737. return NULL;
738.
crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
109. }
110.
111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:113:9: Taking true branch
111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
^
114. return 0;
115.
crypto/threads_pthread.c:114:9:
112. {
113. if (pthread_once(once, init) != 0)
114. > return 0;
115.
116. return 1;
crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
115.
116. return 1;
117. > }
118.
119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:736:10: Condition is false
734. const RAND_METHOD *tmp_meth = NULL;
735.
736. if (!RUN_ONCE(&rand_init, do_rand_init))
^
737. return NULL;
738.
crypto/rand/rand_lib.c:736:10: Taking true branch
734. const RAND_METHOD *tmp_meth = NULL;
735.
736. if (!RUN_ONCE(&rand_init, do_rand_init))
^
737. return NULL;
738.
crypto/rand/rand_lib.c:737:9:
735.
736. if (!RUN_ONCE(&rand_init, do_rand_init))
737. > return NULL;
738.
739. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:760:1: return from a call to RAND_get_rand_method
758. CRYPTO_THREAD_unlock(rand_meth_lock);
759. return tmp_meth;
760. > }
761.
762. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:800:9:
798. const RAND_METHOD *meth = RAND_get_rand_method();
799.
800. > if (meth->add != NULL)
801. meth->add(buf, num, randomness);
802. }
|
https://github.com/openssl/openssl/blob/95658c32436017aeeef3d8598957071baf6769a9/crypto/rand/rand_lib.c/#L800
|
d2a_code_trace_data_44153
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_mont.c:194: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`.
Showing all 25 steps of the trace
crypto/ec/ecp_mont.c:172:1: Parameter `ctx->stack.depth`
170. }
171.
172. > int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
173. const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
174. {
crypto/ec/ecp_mont.c:194:10: Call
192. if (mont == NULL)
193. goto err;
194. if (!BN_MONT_CTX_set(mont, p, ctx)) {
^
195. ECerr(EC_F_EC_GFP_MONT_GROUP_SET_CURVE, ERR_R_BN_LIB);
196. goto err;
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.