id stringlengths 25 25 | content stringlengths 649 72.1k | max_stars_repo_path stringlengths 91 133 |
|---|---|---|
d2a_code_trace_data_42154 | int BN_set_bit(BIGNUM *a, int n)
{
int i, j, k;
if (n < 0)
return 0;
i = n / BN_BITS2;
j = n % BN_BITS2;
if (a->top <= i) {
if (bn_wexpand(a, i + 1) == NULL)
return 0;
for (k = a->top; k < i + 1; k++)
a->d[k] = 0;
a->top = i + 1;
a->flags &= ~BN_FLG_FIXED_TOP;
}
a->d[i] |= (((BN_ULONG)1) << j);
bn_check_top(a);
return 1;
}
test/ectest.c:1825: error: BUFFER_OVERRUN_L2
Offset: [-oo, 9223372036854775807] Size: [0, 8388607] by call to `EC_GROUP_new_from_ecparameters`.
Showing all 10 steps of the trace
test/ectest.c:1825:13: Call
1823. if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_secp224r1))
1824. || !TEST_ptr(ecparameters = EC_GROUP_get_ecparameters(group, NULL))
1825. || !TEST_ptr(group2 = EC_GROUP_new_from_ecparameters(ecparameters))
^
1826. || !TEST_int_eq(EC_GROUP_cmp(group, group2, NULL), 0))
1827. goto err;
crypto/ec/ec_asn1.c:568:1: Parameter `params->fieldID->p.char_two->m`
566. }
567.
568. > EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params)
569. {
570. int ok = 0, tmp;
crypto/ec/ec_asn1.c:652:18: Call
650. if (!BN_set_bit(p, (int)char_two->m))
651. goto err;
652. if (!BN_set_bit(p, (int)tmp_long))
^
653. goto err;
654. if (!BN_set_bit(p, 0))
crypto/bn/bn_lib.c:628:1: <Offset trace>
626. }
627.
628. > int BN_set_bit(BIGNUM *a, int n)
629. {
630. int i, j, k;
crypto/bn/bn_lib.c:628:1: Parameter `a->top`
626. }
627.
628. > int BN_set_bit(BIGNUM *a, int n)
629. {
630. int i, j, k;
crypto/bn/bn_lib.c:628:1: <Length trace>
626. }
627.
628. > int BN_set_bit(BIGNUM *a, int n)
629. {
630. int i, j, k;
crypto/bn/bn_lib.c:628:1: Parameter `*a->d`
626. }
627.
628. > int BN_set_bit(BIGNUM *a, int n)
629. {
630. int i, j, k;
crypto/bn/bn_lib.c:638:13: Call
636. j = n % BN_BITS2;
637. if (a->top <= i) {
638. if (bn_wexpand(a, i + 1) == NULL)
^
639. return 0;
640. for (k = a->top; k < i + 1; k++)
crypto/bn/bn_lib.c:962:1: Parameter `*a->d`
960. }
961.
962. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
963. {
964. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:641:13: Array access: Offset: [-oo, 9223372036854775807] Size: [0, 8388607] by call to `EC_GROUP_new_from_ecparameters`
639. return 0;
640. for (k = a->top; k < i + 1; k++)
641. a->d[k] = 0;
^
642. a->top = i + 1;
643. a->flags &= ~BN_FLG_FIXED_TOP;
| https://github.com/openssl/openssl/blob/b11327929294cf825e4759d97af6f174bd6b081c/crypto/bn/bn_lib.c/#L641 |
d2a_code_trace_data_42155 | 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)) {
OPENSSL_free(onp);
return 0;
}
}
return 1;
}
crypto/objects/o_names.c:211: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_malloc()` at line 197, column 11 is not reachable after line 211, column 14.
Showing all 53 steps of the trace
crypto/objects/o_names.c:186:1: start of procedure OBJ_NAME_add()
184. }
185.
186. > int OBJ_NAME_add(const char *name, int type, const char *data)
187. {
188. OBJ_NAME *onp, *ret;
crypto/objects/o_names.c:191:10: Taking true branch
189. int alias;
190.
191. if ((names_lh == NULL) && !OBJ_NAME_init())
^
192. return (0);
193.
crypto/objects/o_names.c:191:32:
189. int alias;
190.
191. > if ((names_lh == NULL) && !OBJ_NAME_init())
192. return (0);
193.
crypto/objects/o_names.c:65:1: start of procedure OBJ_NAME_init()
63. static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b);
64.
65. > int OBJ_NAME_init(void)
66. {
67. if (names_lh != NULL)
crypto/objects/o_names.c:67:9: Taking false branch
65. int OBJ_NAME_init(void)
66. {
67. if (names_lh != NULL)
^
68. return (1);
69. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
crypto/objects/o_names.c:69:5:
67. if (names_lh != NULL)
68. return (1);
69. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
70. names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
71. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
crypto/mem_dbg.c:108:1: start of procedure CRYPTO_mem_ctrl()
106. #endif
107.
108. > int CRYPTO_mem_ctrl(int mode)
109. {
110. #ifdef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem_dbg.c:111:5:
109. {
110. #ifdef OPENSSL_NO_CRYPTO_MDEBUG
111. > return mode - mode;
112. #else
113. int ret = mh_mode;
crypto/mem_dbg.c:178:1: return from a call to CRYPTO_mem_ctrl
176. return (ret);
177. #endif
178. > }
179.
180. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/objects/o_names.c:70:5:
68. return (1);
69. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
70. > names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
71. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
72. return (names_lh != NULL);
crypto/objects/obj_lcl.h:12:1: start of procedure lh_OBJ_NAME_new()
10. typedef struct name_funcs_st NAME_FUNCS;
11. DEFINE_STACK_OF(NAME_FUNCS)
12. > DEFINE_LHASH_OF(OBJ_NAME);
13. typedef struct added_obj_st ADDED_OBJ;
14. DEFINE_LHASH_OF(ADDED_OBJ);
crypto/objects/obj_lcl.h:12:1: return from a call to lh_OBJ_NAME_new
10. typedef struct name_funcs_st NAME_FUNCS;
11. DEFINE_STACK_OF(NAME_FUNCS)
12. > DEFINE_LHASH_OF(OBJ_NAME);
13. typedef struct added_obj_st ADDED_OBJ;
14. DEFINE_LHASH_OF(ADDED_OBJ);
crypto/objects/o_names.c:71:5:
69. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
70. names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
71. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
72. return (names_lh != NULL);
73. }
crypto/mem_dbg.c:108:1: start of procedure CRYPTO_mem_ctrl()
106. #endif
107.
108. > int CRYPTO_mem_ctrl(int mode)
109. {
110. #ifdef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem_dbg.c:111:5:
109. {
110. #ifdef OPENSSL_NO_CRYPTO_MDEBUG
111. > return mode - mode;
112. #else
113. int ret = mh_mode;
crypto/mem_dbg.c:178:1: return from a call to CRYPTO_mem_ctrl
176. return (ret);
177. #endif
178. > }
179.
180. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/objects/o_names.c:72:13: Condition is true
70. names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
71. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
72. return (names_lh != NULL);
^
73. }
74.
crypto/objects/o_names.c:72:5:
70. names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
71. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
72. > return (names_lh != NULL);
73. }
74.
crypto/objects/o_names.c:73:1: return from a call to OBJ_NAME_init
71. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
72. return (names_lh != NULL);
73. > }
74.
75. int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
crypto/objects/o_names.c:191:32: Taking false branch
189. int alias;
190.
191. if ((names_lh == NULL) && !OBJ_NAME_init())
^
192. return (0);
193.
crypto/objects/o_names.c:194:5:
192. return (0);
193.
194. > alias = type & OBJ_NAME_ALIAS;
195. type &= ~OBJ_NAME_ALIAS;
196.
crypto/objects/o_names.c:195:5:
193.
194. alias = type & OBJ_NAME_ALIAS;
195. > type &= ~OBJ_NAME_ALIAS;
196.
197. onp = OPENSSL_malloc(sizeof(*onp));
crypto/objects/o_names.c:197:5:
195. type &= ~OBJ_NAME_ALIAS;
196.
197. > onp = OPENSSL_malloc(sizeof(*onp));
198. if (onp == NULL) {
199. /* ERROR */
crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
69. }
70.
71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. void *ret = NULL;
crypto/mem.c:73:5:
71. void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. > void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:75:9: Taking false branch
73. void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
76. return malloc_impl(num, file, line);
77.
crypto/mem.c:78:9: Taking false branch
76. return malloc_impl(num, file, line);
77.
78. if (num <= 0)
^
79. return NULL;
80.
crypto/mem.c:81:5:
79. return NULL;
80.
81. > allow_customize = 0;
82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
83. if (call_malloc_debug) {
crypto/mem.c:91:5:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:91:24:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:92:5:
90. #else
91. osslargused(file); osslargused(line);
92. > ret = malloc(num);
93. #endif
94.
crypto/mem.c:95:5:
93. #endif
94.
95. > return ret;
96. }
97.
crypto/mem.c:96:1: return from a call to CRYPTO_malloc
94.
95. return ret;
96. > }
97.
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/objects/o_names.c:198:9: Taking false branch
196.
197. onp = OPENSSL_malloc(sizeof(*onp));
198. if (onp == NULL) {
^
199. /* ERROR */
200. return 0;
crypto/objects/o_names.c:203:5:
201. }
202.
203. > onp->name = name;
204. onp->alias = alias;
205. onp->type = type;
crypto/objects/o_names.c:204:5:
202.
203. onp->name = name;
204. > onp->alias = alias;
205. onp->type = type;
206. onp->data = data;
crypto/objects/o_names.c:205:5:
203. onp->name = name;
204. onp->alias = alias;
205. > onp->type = type;
206. onp->data = data;
207.
crypto/objects/o_names.c:206:5:
204. onp->alias = alias;
205. onp->type = type;
206. > onp->data = data;
207.
208. ret = lh_OBJ_NAME_insert(names_lh, onp);
crypto/objects/o_names.c:208:5:
206. onp->data = data;
207.
208. > ret = lh_OBJ_NAME_insert(names_lh, onp);
209. if (ret != NULL) {
210. /* free things */
crypto/objects/obj_lcl.h:12:1: start of procedure lh_OBJ_NAME_insert()
10. typedef struct name_funcs_st NAME_FUNCS;
11. DEFINE_STACK_OF(NAME_FUNCS)
12. > DEFINE_LHASH_OF(OBJ_NAME);
13. typedef struct added_obj_st ADDED_OBJ;
14. DEFINE_LHASH_OF(ADDED_OBJ);
crypto/lhash/lhash.c:70:1: start of procedure OPENSSL_LH_insert()
68. }
69.
70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
71. {
72. unsigned long hash;
crypto/lhash/lhash.c:76:5:
74. void *ret;
75.
76. > lh->error = 0;
77. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
78. return NULL; /* 'lh->error++' already done in 'expand' */
crypto/lhash/lhash.c:77:10: Taking false branch
75.
76. lh->error = 0;
77. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
^
78. return NULL; /* 'lh->error++' already done in 'expand' */
79.
crypto/lhash/lhash.c:80:5: Skipping getrn(): empty list of specs
78. return NULL; /* 'lh->error++' already done in 'expand' */
79.
80. rn = getrn(lh, data, &hash);
^
81.
82. if (*rn == NULL) {
crypto/lhash/lhash.c:82:9: Taking false branch
80. rn = getrn(lh, data, &hash);
81.
82. if (*rn == NULL) {
^
83. if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
84. lh->error++;
crypto/lhash/lhash.c:96:9:
94. } else { /* replace same key */
95.
96. > ret = (*rn)->data;
97. (*rn)->data = data;
98. lh->num_replace++;
crypto/lhash/lhash.c:97:9:
95.
96. ret = (*rn)->data;
97. > (*rn)->data = data;
98. lh->num_replace++;
99. }
crypto/lhash/lhash.c:98:9:
96. ret = (*rn)->data;
97. (*rn)->data = data;
98. > lh->num_replace++;
99. }
100. return (ret);
crypto/lhash/lhash.c:100:5:
98. lh->num_replace++;
99. }
100. > return (ret);
101. }
102.
crypto/lhash/lhash.c:101:1: return from a call to OPENSSL_LH_insert
99. }
100. return (ret);
101. > }
102.
103. void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
crypto/objects/obj_lcl.h:12:1: return from a call to lh_OBJ_NAME_insert
10. typedef struct name_funcs_st NAME_FUNCS;
11. DEFINE_STACK_OF(NAME_FUNCS)
12. > DEFINE_LHASH_OF(OBJ_NAME);
13. typedef struct added_obj_st ADDED_OBJ;
14. DEFINE_LHASH_OF(ADDED_OBJ);
crypto/objects/o_names.c:209:9: Taking true branch
207.
208. ret = lh_OBJ_NAME_insert(names_lh, onp);
209. if (ret != NULL) {
^
210. /* free things */
211. if ((name_funcs_stack != NULL)
crypto/objects/o_names.c:211:14:
209. if (ret != NULL) {
210. /* free things */
211. > if ((name_funcs_stack != NULL)
212. && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) {
213. /*
| https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/objects/o_names.c/#L211 |
d2a_code_trace_data_42156 | void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
const uint8_t *src_data[4], const int src_linesizes[4],
enum PixelFormat pix_fmt, int width, int height)
{
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
if (desc->flags & PIX_FMT_HWACCEL)
return;
if (desc->flags & PIX_FMT_PAL) {
av_image_copy_plane(dst_data[0], dst_linesizes[0],
src_data[0], src_linesizes[0],
width, height);
memcpy(dst_data[1], src_data[1], 4*256);
} else {
int i, planes_nb = 0;
for (i = 0; i < desc->nb_components; i++)
planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
for (i = 0; i < planes_nb; i++) {
int h = height;
int bwidth = av_image_get_linesize(pix_fmt, width, i);
if (i == 1 || i == 2) {
h= -((-height)>>desc->log2_chroma_h);
}
av_image_copy_plane(dst_data[i], dst_linesizes[i],
src_data[i], src_linesizes[i],
bwidth, h);
}
}
}
libavcodec/imgconvert.c:809: error: Buffer Overrun L1
Offset added: 1024 Size: 32 by call to `av_image_copy`.
libavcodec/imgconvert.c:806:1: Parameter `src->data[*]`
804. #endif
805.
806. void av_picture_copy(AVPicture *dst, const AVPicture *src,
^
807. enum PixelFormat pix_fmt, int width, int height)
808. {
libavcodec/imgconvert.c:809:5: Call
807. enum PixelFormat pix_fmt, int width, int height)
808. {
809. av_image_copy(dst->data, dst->linesize, src->data,
^
810. src->linesize, pix_fmt, width, height);
811. }
libavcore/imgutils.c:155:1: <Length trace>
153. }
154.
155. void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
^
156. const uint8_t *src_data[4], const int src_linesizes[4],
157. enum PixelFormat pix_fmt, int width, int height)
libavcore/imgutils.c:155:1: Parameter `**src_data`
153. }
154.
155. void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
^
156. const uint8_t *src_data[4], const int src_linesizes[4],
157. enum PixelFormat pix_fmt, int width, int height)
libavcore/imgutils.c:169:9: Array access: Offset added: 1024 Size: 32 by call to `av_image_copy`
167. width, height);
168. /* copy the palette */
169. memcpy(dst_data[1], src_data[1], 4*256);
^
170. } else {
171. int i, planes_nb = 0;
| https://github.com/libav/libav/blob/539ff40c2d685508c62f040693df0f0facda39ff/libavcore/imgutils.c/#L169 |
d2a_code_trace_data_42157 | BIO *BIO_new_file(const char *filename, const char *mode)
{
BIO *ret;
FILE *file;
if ((file=fopen(filename,mode)) == NULL)
{
SYSerr(SYS_F_FOPEN,get_last_sys_error());
ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
return(NULL);
}
if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
return(NULL);
BIO_set_fp(ret,file,BIO_CLOSE);
return(ret);
}
crypto/bio/bss_file.c:110: error: RESOURCE_LEAK
resource of type `_IO_FILE` acquired to `return` by call to `fopen()` at line 102, column 12 is not released after line 110, column 3.
Showing all 33 steps of the trace
crypto/bio/bss_file.c:97:1: start of procedure BIO_new_file()
95. };
96.
97. > BIO *BIO_new_file(const char *filename, const char *mode)
98. {
99. BIO *ret;
crypto/bio/bss_file.c:102:6: Taking false branch
100. FILE *file;
101.
102. if ((file=fopen(filename,mode)) == NULL)
^
103. {
104. SYSerr(SYS_F_FOPEN,get_last_sys_error());
crypto/bio/bss_file.c:109:6:
107. return(NULL);
108. }
109. > if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
110. return(NULL);
111.
crypto/bio/bss_file.c:127:1: start of procedure BIO_s_file()
125. }
126.
127. > BIO_METHOD *BIO_s_file(void)
128. {
129. return(&methods_filep);
crypto/bio/bss_file.c:129:2:
127. BIO_METHOD *BIO_s_file(void)
128. {
129. > return(&methods_filep);
130. }
131.
crypto/bio/bss_file.c:130:2: return from a call to BIO_s_file
128. {
129. return(&methods_filep);
130. }
^
131.
132. static int MS_CALLBACK file_new(BIO *bi)
crypto/bio/bio_lib.c:69:1: start of procedure BIO_new()
67. static int bio_meth_num=0;
68.
69. > BIO *BIO_new(BIO_METHOD *method)
70. {
71. BIO *ret=NULL;
crypto/bio/bio_lib.c:71:2:
69. BIO *BIO_new(BIO_METHOD *method)
70. {
71. > BIO *ret=NULL;
72.
73. ret=(BIO *)Malloc(sizeof(BIO));
crypto/bio/bio_lib.c:73:2:
71. BIO *ret=NULL;
72.
73. > ret=(BIO *)Malloc(sizeof(BIO));
74. if (ret == NULL)
75. {
crypto/mem.c:194:1: start of procedure CRYPTO_malloc()
192. }
193.
194. > void *CRYPTO_malloc(int num, const char *file, int line)
195. {
196. char *ret = NULL;
crypto/mem.c:196:2:
194. void *CRYPTO_malloc(int num, const char *file, int line)
195. {
196. > char *ret = NULL;
197.
198. allow_customize = 0;
crypto/mem.c:198:2:
196. char *ret = NULL;
197.
198. > allow_customize = 0;
199. if (malloc_debug_func != NULL)
200. {
crypto/mem.c:199:6: Taking false branch
197.
198. allow_customize = 0;
199. if (malloc_debug_func != NULL)
^
200. {
201. allow_customize_debug = 0;
crypto/mem.c:204:2: Skipping __function_pointer__(): unresolved function pointer
202. malloc_debug_func(NULL, num, file, line, 0);
203. }
204. ret = malloc_func(num);
^
205. #ifdef LEVITTE_DEBUG
206. fprintf(stderr, "LEVITTE_DEBUG: > 0x%p (%d)\n", ret, num);
crypto/mem.c:208:6: Taking false branch
206. fprintf(stderr, "LEVITTE_DEBUG: > 0x%p (%d)\n", ret, num);
207. #endif
208. if (malloc_debug_func != NULL)
^
209. malloc_debug_func(ret, num, file, line, 1);
210.
crypto/mem.c:211:2:
209. malloc_debug_func(ret, num, file, line, 1);
210.
211. > return ret;
212. }
213.
crypto/mem.c:212:2: return from a call to CRYPTO_malloc
210.
211. return ret;
212. }
^
213.
214. void *CRYPTO_realloc(void *str, int num, const char *file, int line)
crypto/bio/bio_lib.c:74:6: Taking true branch
72.
73. ret=(BIO *)Malloc(sizeof(BIO));
74. if (ret == NULL)
^
75. {
76. BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
crypto/bio/bio_lib.c:76:3:
74. if (ret == NULL)
75. {
76. > BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
77. return(NULL);
78. }
crypto/err/err.c:246:1: start of procedure ERR_put_error()
244. /********************************************************/
245.
246. > void ERR_put_error(int lib, int func, int reason, const char *file,
247. int line)
248. {
crypto/err/err.c:270:2: Skipping ERR_get_state(): empty list of specs
268. }
269. #endif
270. es=ERR_get_state();
^
271.
272. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:272:2:
270. es=ERR_get_state();
271.
272. > es->top=(es->top+1)%ERR_NUM_ERRORS;
273. if (es->top == es->bottom)
274. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:273:6: Taking false branch
271.
272. es->top=(es->top+1)%ERR_NUM_ERRORS;
273. if (es->top == es->bottom)
^
274. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
275. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
crypto/err/err.c:275:2:
273. if (es->top == es->bottom)
274. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
275. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
276. es->err_file[es->top]=file;
277. es->err_line[es->top]=line;
crypto/err/err.c:276:2:
274. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
275. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
276. > es->err_file[es->top]=file;
277. es->err_line[es->top]=line;
278. err_clear_data(es,es->top);
crypto/err/err.c:277:2:
275. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
276. es->err_file[es->top]=file;
277. > es->err_line[es->top]=line;
278. err_clear_data(es,es->top);
279. }
crypto/err/err.c:278:2: Taking true branch
276. es->err_file[es->top]=file;
277. es->err_line[es->top]=line;
278. err_clear_data(es,es->top);
^
279. }
280.
crypto/err/err.c:278:2: Taking false branch
276. es->err_file[es->top]=file;
277. es->err_line[es->top]=line;
278. err_clear_data(es,es->top);
^
279. }
280.
crypto/err/err.c:279:2: return from a call to ERR_put_error
277. es->err_line[es->top]=line;
278. err_clear_data(es,es->top);
279. }
^
280.
281. void ERR_clear_error(void)
crypto/bio/bio_lib.c:77:3:
75. {
76. BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
77. > return(NULL);
78. }
79. if (!BIO_set(ret,method))
crypto/bio/bio_lib.c:85:2: return from a call to BIO_new
83. }
84. return(ret);
85. }
^
86.
87. int BIO_set(BIO *bio, BIO_METHOD *method)
crypto/bio/bss_file.c:109:6: Taking true branch
107. return(NULL);
108. }
109. if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
^
110. return(NULL);
111.
crypto/bio/bss_file.c:110:3:
108. }
109. if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
110. > return(NULL);
111.
112. BIO_set_fp(ret,file,BIO_CLOSE);
| https://github.com/openssl/openssl/blob/9dd2b2a94092a4a467f9a5fde6973b4df872fd6b/crypto/bio/bss_file.c/#L110 |
d2a_code_trace_data_42158 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
{
int ret;
if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen) {
EVPerr(EVP_F_EVP_PKEY_KEYGEN,
EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
if (ctx->operation != EVP_PKEY_OP_KEYGEN) {
EVPerr(EVP_F_EVP_PKEY_KEYGEN, EVP_R_OPERATON_NOT_INITIALIZED);
return -1;
}
if (ppkey == NULL)
return -1;
if (*ppkey == NULL)
*ppkey = EVP_PKEY_new();
if (*ppkey == NULL)
return -1;
ret = ctx->pmeth->keygen(ctx, *ppkey);
if (ret <= 0) {
EVP_PKEY_free(*ppkey);
*ppkey = NULL;
}
return ret;
}
crypto/evp/pmeth_gn.c:160: error: MEMORY_LEAK
memory dynamically allocated to `*ppkey` by call to `EVP_PKEY_new()` at line 153, column 18 is not reachable after line 160, column 9.
Showing all 60 steps of the trace
crypto/evp/pmeth_gn.c:135:1: start of procedure EVP_PKEY_keygen()
133. }
134.
135. > int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
136. {
137. int ret;
crypto/evp/pmeth_gn.c:139:10: Taking false branch
137. int ret;
138.
139. if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen) {
^
140. EVPerr(EVP_F_EVP_PKEY_KEYGEN,
141. EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
crypto/evp/pmeth_gn.c:139:18: Taking false branch
137. int ret;
138.
139. if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen) {
^
140. EVPerr(EVP_F_EVP_PKEY_KEYGEN,
141. EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
crypto/evp/pmeth_gn.c:139:33: Taking false branch
137. int ret;
138.
139. if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen) {
^
140. EVPerr(EVP_F_EVP_PKEY_KEYGEN,
141. EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
crypto/evp/pmeth_gn.c:144:9: Taking false branch
142. return -2;
143. }
144. if (ctx->operation != EVP_PKEY_OP_KEYGEN) {
^
145. EVPerr(EVP_F_EVP_PKEY_KEYGEN, EVP_R_OPERATON_NOT_INITIALIZED);
146. return -1;
crypto/evp/pmeth_gn.c:149:9: Taking false branch
147. }
148.
149. if (ppkey == NULL)
^
150. return -1;
151.
crypto/evp/pmeth_gn.c:152:9: Taking true branch
150. return -1;
151.
152. if (*ppkey == NULL)
^
153. *ppkey = EVP_PKEY_new();
154. if (*ppkey == NULL)
crypto/evp/pmeth_gn.c:153:9:
151.
152. if (*ppkey == NULL)
153. > *ppkey = EVP_PKEY_new();
154. if (*ppkey == NULL)
155. return -1;
crypto/evp/p_lib.c:187:1: start of procedure EVP_PKEY_new()
185. }
186.
187. > EVP_PKEY *EVP_PKEY_new(void)
188. {
189. EVP_PKEY *ret;
crypto/evp/p_lib.c:191:5:
189. EVP_PKEY *ret;
190.
191. > ret = OPENSSL_malloc(sizeof(*ret));
192. if (ret == NULL) {
193. EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);
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/evp/p_lib.c:192:9: Taking false branch
190.
191. ret = OPENSSL_malloc(sizeof(*ret));
192. if (ret == NULL) {
^
193. EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);
194. return (NULL);
crypto/evp/p_lib.c:196:5:
194. return (NULL);
195. }
196. > ret->type = EVP_PKEY_NONE;
197. ret->save_type = EVP_PKEY_NONE;
198. ret->references = 1;
crypto/evp/p_lib.c:197:5:
195. }
196. ret->type = EVP_PKEY_NONE;
197. > ret->save_type = EVP_PKEY_NONE;
198. ret->references = 1;
199. ret->ameth = NULL;
crypto/evp/p_lib.c:198:5:
196. ret->type = EVP_PKEY_NONE;
197. ret->save_type = EVP_PKEY_NONE;
198. > ret->references = 1;
199. ret->ameth = NULL;
200. ret->engine = NULL;
crypto/evp/p_lib.c:199:5:
197. ret->save_type = EVP_PKEY_NONE;
198. ret->references = 1;
199. > ret->ameth = NULL;
200. ret->engine = NULL;
201. ret->pkey.ptr = NULL;
crypto/evp/p_lib.c:200:5:
198. ret->references = 1;
199. ret->ameth = NULL;
200. > ret->engine = NULL;
201. ret->pkey.ptr = NULL;
202. ret->attributes = NULL;
crypto/evp/p_lib.c:201:5:
199. ret->ameth = NULL;
200. ret->engine = NULL;
201. > ret->pkey.ptr = NULL;
202. ret->attributes = NULL;
203. ret->save_parameters = 1;
crypto/evp/p_lib.c:202:5:
200. ret->engine = NULL;
201. ret->pkey.ptr = NULL;
202. > ret->attributes = NULL;
203. ret->save_parameters = 1;
204. return (ret);
crypto/evp/p_lib.c:203:5:
201. ret->pkey.ptr = NULL;
202. ret->attributes = NULL;
203. > ret->save_parameters = 1;
204. return (ret);
205. }
crypto/evp/p_lib.c:204:5:
202. ret->attributes = NULL;
203. ret->save_parameters = 1;
204. > return (ret);
205. }
206.
crypto/evp/p_lib.c:205:1: return from a call to EVP_PKEY_new
203. ret->save_parameters = 1;
204. return (ret);
205. > }
206.
207. void EVP_PKEY_up_ref(EVP_PKEY *pkey)
crypto/evp/pmeth_gn.c:154:9: Taking false branch
152. if (*ppkey == NULL)
153. *ppkey = EVP_PKEY_new();
154. if (*ppkey == NULL)
^
155. return -1;
156.
crypto/evp/pmeth_gn.c:157:5: Skipping __function_pointer__(): unresolved function pointer
155. return -1;
156.
157. ret = ctx->pmeth->keygen(ctx, *ppkey);
^
158. if (ret <= 0) {
159. EVP_PKEY_free(*ppkey);
crypto/evp/pmeth_gn.c:158:9: Taking true branch
156.
157. ret = ctx->pmeth->keygen(ctx, *ppkey);
158. if (ret <= 0) {
^
159. EVP_PKEY_free(*ppkey);
160. *ppkey = NULL;
crypto/evp/pmeth_gn.c:159:9:
157. ret = ctx->pmeth->keygen(ctx, *ppkey);
158. if (ret <= 0) {
159. > EVP_PKEY_free(*ppkey);
160. *ppkey = NULL;
161. }
crypto/evp/p_lib.c:420:1: start of procedure EVP_PKEY_free()
418. }
419.
420. > void EVP_PKEY_free(EVP_PKEY *x)
421. {
422. int i;
crypto/evp/p_lib.c:424:9: Taking false branch
422. int i;
423.
424. if (x == NULL)
^
425. return;
426.
crypto/evp/p_lib.c:427:5:
425. return;
426.
427. > i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_EVP_PKEY);
428. #ifdef REF_PRINT
429. REF_PRINT("EVP_PKEY", x);
crypto/lock.c:456:1: start of procedure CRYPTO_add_lock()
454. }
455.
456. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
457. int line)
458. {
crypto/lock.c:459:5:
457. int line)
458. {
459. > int ret = 0;
460.
461. if (add_lock_callback != NULL) {
crypto/lock.c:461:9: Taking false branch
459. int ret = 0;
460.
461. if (add_lock_callback != NULL) {
^
462. #ifdef LOCK_DEBUG
463. int before = *pointer;
crypto/lock.c:477:9:
475. #endif
476. } else {
477. > CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
478.
479. ret = *pointer + amount;
crypto/lock.c:414:1: start of procedure CRYPTO_lock()
412. }
413.
414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
415. {
416. #ifdef LOCK_DEBUG
crypto/lock.c:441:9: Taking false branch
439. }
440. #endif
441. if (type < 0) {
^
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
crypto/lock.c:452:16: Taking false branch
450. CRYPTO_destroy_dynlockid(type);
451. }
452. } else if (locking_callback != NULL)
^
453. locking_callback(mode, type, file, line);
454. }
crypto/lock.c:441:5:
439. }
440. #endif
441. > if (type < 0) {
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
crypto/lock.c:454:1: return from a call to CRYPTO_lock
452. } else if (locking_callback != NULL)
453. locking_callback(mode, type, file, line);
454. > }
455.
456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/lock.c:479:9:
477. CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
478.
479. > ret = *pointer + amount;
480. #ifdef LOCK_DEBUG
481. {
crypto/lock.c:490:9:
488. }
489. #endif
490. > *pointer = ret;
491. CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
492. }
crypto/lock.c:491:9:
489. #endif
490. *pointer = ret;
491. > CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
492. }
493. return (ret);
crypto/lock.c:414:1: start of procedure CRYPTO_lock()
412. }
413.
414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
415. {
416. #ifdef LOCK_DEBUG
crypto/lock.c:441:9: Taking false branch
439. }
440. #endif
441. if (type < 0) {
^
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
crypto/lock.c:452:16: Taking false branch
450. CRYPTO_destroy_dynlockid(type);
451. }
452. } else if (locking_callback != NULL)
^
453. locking_callback(mode, type, file, line);
454. }
crypto/lock.c:441:5:
439. }
440. #endif
441. > if (type < 0) {
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
crypto/lock.c:454:1: return from a call to CRYPTO_lock
452. } else if (locking_callback != NULL)
453. locking_callback(mode, type, file, line);
454. > }
455.
456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/lock.c:493:5:
491. CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
492. }
493. > return (ret);
494. }
495.
crypto/lock.c:494:1: return from a call to CRYPTO_add_lock
492. }
493. return (ret);
494. > }
495.
496. const char *CRYPTO_get_lock_name(int type)
crypto/evp/p_lib.c:431:9: Taking true branch
429. REF_PRINT("EVP_PKEY", x);
430. #endif
431. if (i > 0)
^
432. return;
433. #ifdef REF_CHECK
crypto/evp/p_lib.c:432:9:
430. #endif
431. if (i > 0)
432. > return;
433. #ifdef REF_CHECK
434. if (i < 0) {
crypto/evp/p_lib.c:442:1: return from a call to EVP_PKEY_free
440. sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
441. OPENSSL_free(x);
442. > }
443.
444. static void EVP_PKEY_free_it(EVP_PKEY *x)
crypto/evp/pmeth_gn.c:160:9:
158. if (ret <= 0) {
159. EVP_PKEY_free(*ppkey);
160. > *ppkey = NULL;
161. }
162. return ret;
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/evp/pmeth_gn.c/#L160 |
d2a_code_trace_data_42159 | void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
{
#ifdef POLY1305_ASM
poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;
#endif
size_t rem, num;
if ((num = ctx->num)) {
rem = POLY1305_BLOCK_SIZE - num;
if (len >= rem) {
memcpy(ctx->data + num, inp, rem);
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
inp += rem;
len -= rem;
} else {
memcpy(ctx->data + num, inp, len);
ctx->num = num + len;
return;
}
}
rem = len % POLY1305_BLOCK_SIZE;
len -= rem;
if (len >= POLY1305_BLOCK_SIZE) {
poly1305_blocks(ctx->opaque, inp, len, 1);
inp += len;
}
if (rem)
memcpy(ctx->data, inp, rem);
ctx->num = rem;
}
crypto/evp/e_chacha20_poly1305.c:452: error: INTEGER_OVERFLOW_L2
(13 - [16-max(0, `ctx->cipher_data->num`), 15]):unsigned64 by call to `chacha20_poly1305_cipher`.
Showing all 9 steps of the trace
crypto/evp/e_chacha20_poly1305.c:360:1: Parameter `ctx->cipher_data->num`
358. }
359.
360. > static int chacha20_poly1305_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
361. void *ptr)
362. {
crypto/evp/e_chacha20_poly1305.c:452:13: Call
450. actx->key.counter[3] = actx->nonce[2] ^ CHACHA_U8TOU32(aad+4);
451. actx->mac_inited = 0;
452. chacha20_poly1305_cipher(ctx, NULL, aad, EVP_AEAD_TLS1_AAD_LEN);
^
453. return POLY1305_BLOCK_SIZE; /* tag length */
454. }
crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `len`
231. }
232.
233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
234. const unsigned char *in, size_t len)
235. {
crypto/evp/e_chacha20_poly1305.c:254:13: Call
252. if (in) { /* aad or text */
253. if (out == NULL) { /* aad */
254. Poly1305_Update(POLY1305_ctx(actx), in, len);
^
255. actx->len.aad += len;
256. actx->aad = 1;
crypto/poly1305/poly1305.c:466:1: <LHS trace>
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: Parameter `len`
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: <RHS trace>
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: Parameter `len`
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:485:13: Binary operation: (13 - [16-max(0, ctx->cipher_data->num), 15]):unsigned64 by call to `chacha20_poly1305_cipher`
483. poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
484. inp += rem;
485. len -= rem;
^
486. } else {
487. /* Still not enough data to process a block. */
| https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L485 |
d2a_code_trace_data_42160 | static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d;
int dmin;
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
LOAD_COMMON2
if(c->pre_pass){
penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1];
}else{
penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
}
map_generation= update_map_generation(c);
assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
&& ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
c->skip=1;
return dmin;
}
CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(c->avctx->last_predictor_count){
const int count= c->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1059: error: Uninitialized Value
The value read from xmax was never initialized.
libavcodec/motion_est_template.c:1059:9:
1057. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
^
1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1059 |
d2a_code_trace_data_42161 | int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table)
{
int len, index;
uint32_t bits = 0;
for (len = 32; len > 0; len--) {
for (index = 0; index < 256; index++) {
if (len_table[index] == len)
dst[index] = bits++;
}
if (bits & 1) {
av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
return -1;
}
bits >>= 1;
}
return 0;
}
libavcodec/huffyuvdec.c:197: error: Buffer Overrun L2
Offset: [0, 257] (⇐ [0, 2] + [0, 255]) Size: 3 by call to `ff_huffyuv_generate_bits_table`.
libavcodec/huffyuvdec.c:186:1: Parameter `s->len[*]`
184. }
185.
186. static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
^
187. {
188. GetBitContext gb;
libavcodec/huffyuvdec.c:197:20: Call
195. if ((ret = read_len_table(s->len[i], &gb)) < 0)
196. return ret;
197. if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i])) < 0)
^
198. return ret;
199. ff_free_vlc(&s->vlc[i]);
libavcodec/huffyuv.c:45:14: <Offset trace>
43.
44. for (len = 32; len > 0; len--) {
45. for (index = 0; index < 256; index++) {
^
46. if (len_table[index] == len)
47. dst[index] = bits++;
libavcodec/huffyuv.c:45:14: Assignment
43.
44. for (len = 32; len > 0; len--) {
45. for (index = 0; index < 256; index++) {
^
46. if (len_table[index] == len)
47. dst[index] = bits++;
libavcodec/huffyuv.c:39:1: <Length trace>
37. #include "huffyuv.h"
38.
39. int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table)
^
40. {
41. int len, index;
libavcodec/huffyuv.c:39:1: Parameter `*len_table`
37. #include "huffyuv.h"
38.
39. int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table)
^
40. {
41. int len, index;
libavcodec/huffyuv.c:46:17: Array access: Offset: [0, 257] (⇐ [0, 2] + [0, 255]) Size: 3 by call to `ff_huffyuv_generate_bits_table`
44. for (len = 32; len > 0; len--) {
45. for (index = 0; index < 256; index++) {
46. if (len_table[index] == len)
^
47. dst[index] = bits++;
48. }
| https://github.com/libav/libav/blob/eb9244f20210fd420fb9b3c98126f9cae525d1cc/libavcodec/huffyuv.c/#L46 |
d2a_code_trace_data_42162 | static int
TIFFStartTile(TIFF* tif, uint32 tile)
{
TIFFDirectory *td = &tif->tif_dir;
if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
if (!(*tif->tif_setupdecode)(tif))
return (0);
tif->tif_flags |= TIFF_CODERSETUP;
}
tif->tif_curtile = tile;
tif->tif_row =
(tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) *
td->td_tilelength;
tif->tif_col =
(tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) *
td->td_tilewidth;
tif->tif_flags &= ~TIFF_BUF4WRITE;
if (tif->tif_flags&TIFF_NOREADRAW)
{
tif->tif_rawcp = NULL;
tif->tif_rawcc = 0;
}
else
{
tif->tif_rawcp = tif->tif_rawdata;
tif->tif_rawcc = (tmsize_t)td->td_stripbytecount[tile];
}
return ((*tif->tif_predecode)(tif,
(uint16)(tile/td->td_stripsperimage)));
}
tools/tiffcrop.c:751: error: Integer Overflow L2
([0, `in->tif_dir.td_tilelength`] - 1):unsigned32 by call to `TIFFReadTile`.
tools/tiffcrop.c:725:1: Parameter `in->tif_dir.td_tilelength`
723. };
724.
725. static int readContigTilesIntoBuffer (TIFF* in, uint8* buf,
^
726. uint32 imagelength,
727. uint32 imagewidth,
tools/tiffcrop.c:731:32: Call
729. {
730. int status = 1;
731. tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in));
^
732. uint32 imagew = TIFFScanlineSize(in);
733. uint32 tilew = TIFFTileRowSize(in);
libtiff/tif_tile.c:274:1: Parameter `tif->tif_dir.td_tilelength`
272. return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
273. }
274. tmsize_t
^
275. TIFFTileSize(TIFF* tif)
276. {
libtiff/tif_tile.c:280:4: Call
278. uint64 m;
279. tmsize_t n;
280. m=TIFFTileSize64(tif);
^
281. n=(tmsize_t)m;
282. if ((uint64)n!=m)
libtiff/tif_tile.c:269:1: Parameter `tif->tif_dir.td_tilelength`
267. * Compute the # bytes in a row-aligned tile.
268. */
269. uint64
^
270. TIFFTileSize64(TIFF* tif)
271. {
libtiff/tif_tile.c:272:10: Call
270. TIFFTileSize64(TIFF* tif)
271. {
272. return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
^
273. }
274. tmsize_t
libtiff/tif_tile.c:203:1: Parameter `tif->tif_dir.td_tilelength`
201. * Compute the # bytes in a variable length, row-aligned tile.
202. */
203. uint64
^
204. TIFFVTileSize64(TIFF* tif, uint32 nrows)
205. {
tools/tiffcrop.c:733:18: Call
731. tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in));
732. uint32 imagew = TIFFScanlineSize(in);
733. uint32 tilew = TIFFTileRowSize(in);
^
734. int iskew = imagew - tilew;
735. uint8* bufp = (uint8*) buf;
libtiff/tif_tile.c:184:1: Parameter `tif->tif_dir.td_tilelength`
182. return (TIFFhowmany8_64(rowsize));
183. }
184. tmsize_t
^
185. TIFFTileRowSize(TIFF* tif)
186. {
libtiff/tif_tile.c:190:4: Call
188. uint64 m;
189. tmsize_t n;
190. m=TIFFTileRowSize64(tif);
^
191. n=(tmsize_t)m;
192. if ((uint64)n!=m)
libtiff/tif_tile.c:169:1: Parameter `tif->tif_dir.td_tilelength`
167. * Compute the # bytes in each row of a tile.
168. */
169. uint64
^
170. TIFFTileRowSize64(TIFF* tif)
171. {
tools/tiffcrop.c:751:8: Call
749.
750. for (col = 0; col < imagewidth; col += tw) {
751. if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0
^
752. && !ignore) {
753. TIFFError(TIFFFileName(in),
libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_tilelength`
413. * tile is selected by the (x,y,z,s) coordinates.
414. */
415. tmsize_t
^
416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s)
417. {
libtiff/tif_read.c:420:10: Call
418. if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
419. return ((tmsize_t)(-1));
420. return (TIFFReadEncodedTile(tif,
^
421. TIFFComputeTile(tif, x, y, z, s), buf, (tmsize_t)(-1)));
422. }
libtiff/tif_read.c:428:1: Parameter `tif->tif_dir.td_tilelength`
426. * amount into the user-supplied buffer.
427. */
428. tmsize_t
^
429. TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
430. {
libtiff/tif_read.c:447:6: Call
445. else if (size > tilesize)
446. size = tilesize;
447. if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif,
^
448. (uint8*) buf, size, (uint16)(tile/td->td_stripsperimage))) {
449. (*tif->tif_postdecode)(tif, (uint8*) buf, size);
libtiff/tif_read.c:568:1: Parameter `tif->tif_dir.td_tilelength`
566. * expanded, as necessary, to hold the tile's data.
567. */
568. int
^
569. TIFFFillTile(TIFF* tif, uint32 tile)
570. {
libtiff/tif_read.c:657:10: Call
655. }
656. }
657. return (TIFFStartTile(tif, tile));
^
658. }
659.
libtiff/tif_read.c:737:1: <LHS trace>
735. * tile has just been read in.
736. */
737. static int
^
738. TIFFStartTile(TIFF* tif, uint32 tile)
739. {
libtiff/tif_read.c:737:1: Parameter `tif->tif_dir.td_tilelength`
735. * tile has just been read in.
736. */
737. static int
^
738. TIFFStartTile(TIFF* tif, uint32 tile)
739. {
libtiff/tif_read.c:751:2: Binary operation: ([0, in->tif_dir.td_tilelength] - 1):unsigned32 by call to `TIFFReadTile`
749. (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) *
750. td->td_tilelength;
751. tif->tif_col =
^
752. (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) *
753. td->td_tilewidth;
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_read.c/#L751 |
d2a_code_trace_data_42163 | static int vp3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
static int counter = 0;
int i;
init_get_bits(&gb, buf, buf_size * 8);
if (s->theora && get_bits1(&gb))
{
av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
return -1;
}
s->keyframe = !get_bits1(&gb);
if (!s->theora)
skip_bits(&gb, 1);
for (i = 0; i < 3; i++)
s->last_qps[i] = s->qps[i];
s->nqps=0;
do{
s->qps[s->nqps++]= get_bits(&gb, 6);
} while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb));
for (i = s->nqps; i < 3; i++)
s->qps[i] = -1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
s->keyframe?"key":"", counter, s->qps[0]);
counter++;
if (s->qps[0] != s->last_qps[0])
init_loop_filter(s);
for (i = 0; i < s->nqps; i++)
if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
init_dequantizer(s, i);
if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
return buf_size;
s->current_frame.reference = 3;
s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
if (avctx->get_buffer(avctx, &s->current_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
if (s->keyframe) {
if (!s->theora)
{
skip_bits(&gb, 4);
skip_bits(&gb, 4);
if (s->version)
{
s->version = get_bits(&gb, 5);
if (counter == 1)
av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
}
}
if (s->version || s->theora)
{
if (get_bits1(&gb))
av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2);
}
} else {
if (!s->golden_frame.data[0]) {
av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n");
s->golden_frame.reference = 3;
s->golden_frame.pict_type = FF_I_TYPE;
if (avctx->get_buffer(avctx, &s->golden_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
s->last_frame = s->golden_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
}
s->current_frame.qscale_table= s->qscale_table;
s->current_frame.qstride= 0;
memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
if (unpack_superblocks(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
goto error;
}
if (unpack_modes(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
goto error;
}
if (unpack_vectors(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
goto error;
}
if (unpack_block_qpis(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
goto error;
}
if (unpack_dct_coeffs(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
goto error;
}
for (i = 0; i < 3; i++) {
int height = s->height >> (i && s->chroma_y_shift);
if (s->flipped_image)
s->data_offset[i] = 0;
else
s->data_offset[i] = (height-1) * s->current_frame.linesize[i];
}
s->last_slice_end = 0;
for (i = 0; i < s->c_superblock_height; i++)
render_slice(s, i);
for (i = 0; i < 3; i++) {
int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1;
apply_loop_filter(s, i, row, row+1);
}
vp3_draw_horiz_band(s, s->height);
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->current_frame;
if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY)
avctx->release_buffer(avctx, &s->last_frame);
s->last_frame= s->current_frame;
if (s->keyframe) {
if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
s->golden_frame = s->current_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
s->current_frame.data[0]= NULL;
return buf_size;
error:
if (s->current_frame.data[0])
avctx->release_buffer(avctx, &s->current_frame);
return -1;
}
libavcodec/vp3.c:1722: error: Null Dereference
pointer `&gb->buffer` last assigned on line 1720 could be null and is dereferenced by call to `get_bits1()` at line 1722, column 22.
libavcodec/vp3.c:1709:1: start of procedure vp3_decode_frame()
1707. * This is the ffmpeg/libavcodec API frame decode function.
1708. */
1709. static int vp3_decode_frame(AVCodecContext *avctx,
^
1710. void *data, int *data_size,
1711. AVPacket *avpkt)
libavcodec/vp3.c:1713:5:
1711. AVPacket *avpkt)
1712. {
1713. const uint8_t *buf = avpkt->data;
^
1714. int buf_size = avpkt->size;
1715. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1714:5:
1712. {
1713. const uint8_t *buf = avpkt->data;
1714. int buf_size = avpkt->size;
^
1715. Vp3DecodeContext *s = avctx->priv_data;
1716. GetBitContext gb;
libavcodec/vp3.c:1715:5:
1713. const uint8_t *buf = avpkt->data;
1714. int buf_size = avpkt->size;
1715. Vp3DecodeContext *s = avctx->priv_data;
^
1716. GetBitContext gb;
1717. static int counter = 0;
libavcodec/vp3.c:1717:5:
1715. Vp3DecodeContext *s = avctx->priv_data;
1716. GetBitContext gb;
1717. static int counter = 0;
^
1718. int i;
1719.
libavcodec/vp3.c:1720:5:
1718. int i;
1719.
1720. init_get_bits(&gb, buf, buf_size * 8);
^
1721.
1722. if (s->theora && get_bits1(&gb))
libavcodec/get_bits.h:473:1: start of procedure init_get_bits()
471. * responsible for checking for the buffer end yourself (take advantage of the padding)!
472. */
473. static inline void init_get_bits(GetBitContext *s,
^
474. const uint8_t *buffer, int bit_size)
475. {
libavcodec/get_bits.h:476:5:
474. const uint8_t *buffer, int bit_size)
475. {
476. int buffer_size= (bit_size+7)>>3;
^
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
libavcodec/get_bits.h:477:8: Taking true branch
475. {
476. int buffer_size= (bit_size+7)>>3;
477. if(buffer_size < 0 || bit_size < 0) {
^
478. buffer_size = bit_size = 0;
479. buffer = NULL;
libavcodec/get_bits.h:478:9:
476. int buffer_size= (bit_size+7)>>3;
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
^
479. buffer = NULL;
480. }
libavcodec/get_bits.h:479:9:
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
479. buffer = NULL;
^
480. }
481.
libavcodec/get_bits.h:482:5:
480. }
481.
482. s->buffer= buffer;
^
483. s->size_in_bits= bit_size;
484. s->buffer_end= buffer + buffer_size;
libavcodec/get_bits.h:483:5:
481.
482. s->buffer= buffer;
483. s->size_in_bits= bit_size;
^
484. s->buffer_end= buffer + buffer_size;
485. #ifdef ALT_BITSTREAM_READER
libavcodec/get_bits.h:484:5:
482. s->buffer= buffer;
483. s->size_in_bits= bit_size;
484. s->buffer_end= buffer + buffer_size;
^
485. #ifdef ALT_BITSTREAM_READER
486. s->index=0;
libavcodec/get_bits.h:486:5:
484. s->buffer_end= buffer + buffer_size;
485. #ifdef ALT_BITSTREAM_READER
486. s->index=0;
^
487. #elif defined LIBMPEG2_BITSTREAM_READER
488. s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
libavcodec/get_bits.h:496:1: return from a call to init_get_bits
494. skip_bits_long(s, 0);
495. #endif
496. }
^
497.
498. static inline void align_get_bits(GetBitContext *s)
libavcodec/vp3.c:1722:9: Taking true branch
1720. init_get_bits(&gb, buf, buf_size * 8);
1721.
1722. if (s->theora && get_bits1(&gb))
^
1723. {
1724. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/vp3.c:1722:22:
1720. init_get_bits(&gb, buf, buf_size * 8);
1721.
1722. if (s->theora && get_bits1(&gb))
^
1723. {
1724. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/get_bits.h:393:1: start of procedure get_bits1()
391. }
392.
393. static inline unsigned int get_bits1(GetBitContext *s){
^
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
libavcodec/get_bits.h:395:5:
393. static inline unsigned int get_bits1(GetBitContext *s){
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
^
396. uint8_t result= s->buffer[ index>>3 ];
397. #ifdef ALT_BITSTREAM_READER_LE
libavcodec/get_bits.h:396:5:
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
396. uint8_t result= s->buffer[ index>>3 ];
^
397. #ifdef ALT_BITSTREAM_READER_LE
398. result>>= (index&0x07);
| https://github.com/libav/libav/blob/eb6a6cd788a172f146534c5fab9b98d6cbf59520/libavcodec/vp3.c/#L1722 |
d2a_code_trace_data_42164 | static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
{
int i, j, k, m, dir, mode;
int cbp = 0;
uint32_t vlc;
int8_t *top, *left;
MpegEncContext *const s = (MpegEncContext *) h;
const int mb_xy = h->mb_xy;
const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
h->topright_samples_available = 0xFFFF;
if (mb_type == 0) {
if (s->pict_type == FF_P_TYPE || s->next_picture.mb_type[mb_xy] == -1) {
svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0);
if (s->pict_type == FF_B_TYPE) {
svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1);
}
mb_type = MB_TYPE_SKIP;
} else {
mb_type = FFMIN(s->next_picture.mb_type[mb_xy], 6);
if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 0, 0) < 0)
return -1;
if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 1, 1) < 0)
return -1;
mb_type = MB_TYPE_16x16;
}
} else if (mb_type < 8) {
if (h->thirdpel_flag && h->halfpel_flag == !get_bits1 (&s->gb)) {
mode = THIRDPEL_MODE;
} else if (h->halfpel_flag && h->thirdpel_flag == !get_bits1 (&s->gb)) {
mode = HALFPEL_MODE;
} else {
mode = FULLPEL_MODE;
}
for (m = 0; m < 2; m++) {
if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] != -1) {
for (i = 0; i < 4; i++) {
*(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride];
}
} else {
for (i = 0; i < 4; i++) {
*(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0;
}
}
if (s->mb_y > 0) {
memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t));
memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
if (s->mb_x < (s->mb_width - 1)) {
*(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4];
h->ref_cache[m][scan8[0] + 4 - 1*8] =
(h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 ||
h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride ] ] == -1) ? PART_NOT_AVAILABLE : 1;
}else
h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
if (s->mb_x > 0) {
*(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1];
h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1;
}else
h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE;
}else
memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8);
if (s->pict_type != FF_B_TYPE)
break;
}
if (s->pict_type == FF_P_TYPE) {
if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0)
return -1;
} else {
if (mb_type != 2) {
if (svq3_mc_dir(h, 0, mode, 0, 0) < 0)
return -1;
} else {
for (i = 0; i < 4; i++) {
memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
}
}
if (mb_type != 1) {
if (svq3_mc_dir(h, 0, mode, 1, (mb_type == 3)) < 0)
return -1;
} else {
for (i = 0; i < 4; i++) {
memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
}
}
}
mb_type = MB_TYPE_16x16;
} else if (mb_type == 8 || mb_type == 33) {
memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t));
if (mb_type == 8) {
if (s->mb_x > 0) {
for (i = 0; i < 4; i++) {
h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6-i];
}
if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) {
h->left_samples_available = 0x5F5F;
}
}
if (s->mb_y > 0) {
h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+0];
h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+1];
h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+2];
h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+3];
if (h->intra4x4_pred_mode_cache[4+8*0] == -1) {
h->top_samples_available = 0x33FF;
}
}
for (i = 0; i < 16; i+=2) {
vlc = svq3_get_ue_golomb(&s->gb);
if (vlc >= 25){
av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc);
return -1;
}
left = &h->intra4x4_pred_mode_cache[scan8[i] - 1];
top = &h->intra4x4_pred_mode_cache[scan8[i] - 8];
left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]];
left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
if (left[1] == -1 || left[2] == -1){
av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n");
return -1;
}
}
} else {
for (i = 0; i < 4; i++) {
memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_PRED, 4);
}
}
ff_h264_write_back_intra_pred_mode(h);
if (mb_type == 8) {
ff_h264_check_intra4x4_pred_mode(h);
h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
} else {
for (i = 0; i < 4; i++) {
memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_128_PRED, 4);
}
h->top_samples_available = 0x33FF;
h->left_samples_available = 0x5F5F;
}
mb_type = MB_TYPE_INTRA4x4;
} else {
dir = i_mb_type_info[mb_type - 8].pred_mode;
dir = (dir >> 1) ^ 3*(dir & 1) ^ 1;
if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir)) == -1){
av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
return -1;
}
cbp = i_mb_type_info[mb_type - 8].cbp;
mb_type = MB_TYPE_INTRA16x16;
}
if (!IS_INTER(mb_type) && s->pict_type != FF_I_TYPE) {
for (i = 0; i < 4; i++) {
memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
}
if (s->pict_type == FF_B_TYPE) {
for (i = 0; i < 4; i++) {
memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
}
}
}
if (!IS_INTRA4x4(mb_type)) {
memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8);
}
if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) {
memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t));
s->dsp.clear_blocks(h->mb);
}
if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE)) {
if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){
av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc);
return -1;
}
cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc];
}
if (IS_INTRA16x16(mb_type) || (s->pict_type != FF_I_TYPE && s->adaptive_quant && cbp)) {
s->qscale += svq3_get_se_golomb(&s->gb);
if (s->qscale > 31){
av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
return -1;
}
}
if (IS_INTRA16x16(mb_type)) {
if (svq3_decode_block(&s->gb, h->mb, 0, 0)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
return -1;
}
}
if (cbp) {
const int index = IS_INTRA16x16(mb_type) ? 1 : 0;
const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1);
for (i = 0; i < 4; i++) {
if ((cbp & (1 << i))) {
for (j = 0; j < 4; j++) {
k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j);
h->non_zero_count_cache[ scan8[k] ] = 1;
if (svq3_decode_block(&s->gb, &h->mb[16*k], index, type)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n");
return -1;
}
}
}
}
if ((cbp & 0x30)) {
for (i = 0; i < 2; ++i) {
if (svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
return -1;
}
}
if ((cbp & 0x20)) {
for (i = 0; i < 8; i++) {
h->non_zero_count_cache[ scan8[16+i] ] = 1;
if (svq3_decode_block(&s->gb, &h->mb[16*(16 + i)], 1, 1)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
return -1;
}
}
}
}
}
h->cbp= cbp;
s->current_picture.mb_type[mb_xy] = mb_type;
if (IS_INTRA(mb_type)) {
h->chroma_pred_mode = ff_h264_check_intra_pred_mode(h, DC_PRED8x8);
}
return 0;
}
libavcodec/svq3.c:491: error: Buffer Overrun L1
Offset added: 16 Size: 4.
libavcodec/svq3.c:430:1: <Length trace>
428. }
429.
430. static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
^
431. {
432. int i, j, k, m, dir, mode;
libavcodec/svq3.c:430:1: Parameter `h->mv_cache[*][*][*]`
428. }
429.
430. static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
^
431. {
432. int i, j, k, m, dir, mode;
libavcodec/svq3.c:491:17: Array access: Offset added: 16 Size: 4
489. }
490. if (s->mb_y > 0) {
491. memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t));
^
492. memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
493.
| https://github.com/libav/libav/blob/479e1e617078476f14598cd62769b4c9ca4025e2/libavcodec/svq3.c/#L491 |
d2a_code_trace_data_42165 | 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:123: error: UNINITIALIZED_VALUE
The value read from mtus[_] was never initialized.
Showing all 1 steps of the trace
test/dtls_mtu_test.c:123:17:
121. goto out;
122. }
123. > if (s > mtus[i] && reclen <= (size_t)(500 + i)) {
124. /* We sent a *larger* packet than mtus[i] and that *still*
125. * fits within the record MTU 500+i, so DTLS_get_data_mtu()
| https://github.com/openssl/openssl/blob/8aefa08cfbc7db7cc10765ee9684090e37983f45/test/dtls_mtu_test.c/#L123 |
d2a_code_trace_data_42166 | ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
ASN1_GENERALIZEDTIME **out)
{
ASN1_GENERALIZEDTIME *ret = NULL;
char *str;
if (!ASN1_TIME_check(t))
return NULL;
if (out == NULL || *out == NULL) {
if ((ret = ASN1_GENERALIZEDTIME_new()) == NULL)
goto err;
} else
ret = *out;
if (t->type == V_ASN1_GENERALIZEDTIME) {
if (!ASN1_STRING_set(ret, t->data, t->length))
goto err;
goto done;
}
if (!ASN1_STRING_set(ret, NULL, t->length + 2))
goto err;
str = (char *)ret->data;
memcpy(str, t->data[0] >= '5' ? "19" : "20", 2);
OPENSSL_strlcpy(str + 2, (const char *)t->data, t->length + 1);
done:
if (out != NULL && *out == NULL)
*out = ret;
return ret;
err:
if (out == NULL || *out != ret)
ASN1_GENERALIZEDTIME_free(ret);
return NULL;
}
crypto/asn1/a_time.c:92: error: BUFFER_OVERRUN_L3
Offset added: 2 Size: [1, +oo].
Showing all 6 steps of the trace
crypto/asn1/a_time.c:62:1: <Length trace>
60.
61. /* Convert an ASN1_TIME structure to GeneralizedTime */
62. > ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
63. ASN1_GENERALIZEDTIME **out)
64. {
crypto/asn1/a_time.c:62:1: Parameter `*(*out)->data`
60.
61. /* Convert an ASN1_TIME structure to GeneralizedTime */
62. > ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
63. ASN1_GENERALIZEDTIME **out)
64. {
crypto/asn1/a_time.c:88:10: Call
86. * The actual allocation is t->length + 3 to include a terminator byte.
87. */
88. if (!ASN1_STRING_set(ret, NULL, t->length + 2))
^
89. goto err;
90. str = (char *)ret->data;
crypto/asn1/asn1_lib.c:264:1: Parameter `*str->data`
262. }
263.
264. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
265. {
266. unsigned char *c;
crypto/asn1/a_time.c:90:5: Assignment
88. if (!ASN1_STRING_set(ret, NULL, t->length + 2))
89. goto err;
90. str = (char *)ret->data;
^
91. /* Work out the century and prepend */
92. memcpy(str, t->data[0] >= '5' ? "19" : "20", 2);
crypto/asn1/a_time.c:92:5: Array access: Offset added: 2 Size: [1, +oo]
90. str = (char *)ret->data;
91. /* Work out the century and prepend */
92. memcpy(str, t->data[0] >= '5' ? "19" : "20", 2);
^
93. /*
94. * t->length + 1 is the size of the data and the allocated buffer has
| https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/crypto/asn1/a_time.c/#L92 |
d2a_code_trace_data_42167 | static int mpegts_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
MpegTSContext *ts = s->priv_data;
ByteIOContext *pb = s->pb;
uint8_t buf[1024];
int len;
int64_t pos;
if (ap) {
ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr;
if(ap->mpeg2ts_raw){
av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n");
return -1;
}
}
pos = url_ftell(pb);
len = get_buffer(pb, buf, sizeof(buf));
if (len != sizeof(buf))
goto fail;
ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
if (ts->raw_packet_size <= 0)
goto fail;
ts->stream = s;
ts->auto_guess = 0;
if (s->iformat == &mpegts_demuxer) {
url_fseek(pb, pos, SEEK_SET);
mpegts_scan_sdt(ts);
mpegts_set_service(ts);
handle_packets(ts, s->probesize);
ts->auto_guess = 1;
#ifdef DEBUG_SI
av_log(ts->stream, AV_LOG_DEBUG, "tuning done\n");
#endif
s->ctx_flags |= AVFMTCTX_NOHEADER;
} else {
AVStream *st;
int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;
int64_t pcrs[2], pcr_h;
int packet_count[2];
uint8_t packet[TS_PACKET_SIZE];
st = av_new_stream(s, 0);
if (!st)
goto fail;
av_set_pts_info(st, 60, 1, 27000000);
st->codec->codec_type = CODEC_TYPE_DATA;
st->codec->codec_id = CODEC_ID_MPEG2TS;
pcr_pid = -1;
nb_pcrs = 0;
nb_packets = 0;
for(;;) {
ret = read_packet(s->pb, packet, ts->raw_packet_size);
if (ret < 0)
return -1;
pid = AV_RB16(packet + 1) & 0x1fff;
if ((pcr_pid == -1 || pcr_pid == pid) &&
parse_pcr(&pcr_h, &pcr_l, packet) == 0) {
pcr_pid = pid;
packet_count[nb_pcrs] = nb_packets;
pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;
nb_pcrs++;
if (nb_pcrs >= 2)
break;
}
nb_packets++;
}
ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0];
s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
st->codec->bit_rate = s->bit_rate;
st->start_time = ts->cur_pcr;
#if 0
av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n",
st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);
#endif
}
url_fseek(pb, pos, SEEK_SET);
return 0;
fail:
return -1;
}
libavformat/mpegts.c:1293: error: Uninitialized Value
The value read from pcrs[_] was never initialized.
libavformat/mpegts.c:1293:9:
1291. /* NOTE2: it is only the bitrate of the start of the stream */
1292. ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
1293. ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0];
^
1294. s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
1295. st->codec->bit_rate = s->bit_rate;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegts.c/#L1293 |
d2a_code_trace_data_42168 | void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
if (!ref)
return;
if (!(--ref->buf->refcount))
ref->buf->free(ref->buf);
if (ref->extended_data != ref->data)
av_freep(&ref->extended_data);
av_free(ref->video);
av_free(ref->audio);
av_free(ref);
}
avconv.c:1799: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`.
avconv.c:1789:13: Call
1787. break;
1788.
1789. avfilter_copy_buf_props(filtered_frame, picref);
^
1790. if (picref->pts != AV_NOPTS_VALUE)
1791. filtered_frame->pts = av_rescale_q(picref->pts,
libavfilter/buffer.c:113:1: Parameter `dst->width`
111. }
112.
113. int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
^
114. {
115. int planes, nb_channels;
avconv.c:1799:17: Call
1797.
1798. if (of->start_time && filtered_frame->pts < of->start_time) {
1799. avfilter_unref_buffer(picref);
^
1800. continue;
1801. }
libavfilter/buffer.c:74:1: <LHS trace>
72. }
73.
74. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
75. {
76. if (!ref)
libavfilter/buffer.c:74:1: Parameter `ref->buf->refcount`
72. }
73.
74. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
75. {
76. if (!ref)
libavfilter/buffer.c:78:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`
76. if (!ref)
77. return;
78. if (!(--ref->buf->refcount))
^
79. ref->buf->free(ref->buf);
80. if (ref->extended_data != ref->data)
| https://github.com/libav/libav/blob/8ccc1c597534ece9f3710a979b8a3fd6e43220a6/libavfilter/buffer.c/#L78 |
d2a_code_trace_data_42169 | int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt = 0;
int i;
int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;
char *f = NULL;
int f_len = 0;
i = tm->length;
v = (char *)tm->data;
if (i < 12)
goto err;
if (v[i - 1] == 'Z')
gmt = 1;
for (i = 0; i < 12; i++)
if ((v[i] > '9') || (v[i] < '0'))
goto err;
y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
+ (v[2] - '0') * 10 + (v[3] - '0');
M = (v[4] - '0') * 10 + (v[5] - '0');
if ((M > 12) || (M < 1))
goto err;
d = (v[6] - '0') * 10 + (v[7] - '0');
h = (v[8] - '0') * 10 + (v[9] - '0');
m = (v[10] - '0') * 10 + (v[11] - '0');
if (tm->length >= 14 &&
(v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9')) {
s = (v[12] - '0') * 10 + (v[13] - '0');
if (tm->length >= 15 && v[14] == '.') {
int l = tm->length;
f = &v[14];
f_len = 1;
while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
++f_len;
}
}
if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
_asn1_mon[M - 1], d, h, m, s, f_len, f, y,
(gmt) ? " GMT" : "") <= 0)
return (0);
else
return (1);
err:
BIO_write(bp, "Bad time value", 14);
return (0);
}
crypto/x509/t_crl.c:105: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`.
Showing all 17 steps of the trace
crypto/x509/t_crl.c:96:9: Call
94.
95. BIO_printf(out, "Certificate Revocation List (CRL):\n");
96. l = X509_CRL_get_version(x);
^
97. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l);
98. X509_CRL_get0_signature(&sig, &sig_alg, x);
crypto/x509/x509cset.c:141:1: Parameter `*crl->crl.version->data`
139. }
140.
141. > long X509_CRL_get_version(X509_CRL *crl)
142. {
143. return ASN1_INTEGER_get(crl->crl.version);
crypto/x509/x509cset.c:143:12: Call
141. long X509_CRL_get_version(X509_CRL *crl)
142. {
143. return ASN1_INTEGER_get(crl->crl.version);
^
144. }
145.
crypto/asn1/a_int.c:608:1: Parameter `*a->data`
606. }
607.
608. > long ASN1_INTEGER_get(const ASN1_INTEGER *a)
609. {
610. int i;
crypto/x509/t_crl.c:100:5: Call
98. X509_CRL_get0_signature(&sig, &sig_alg, x);
99. i = X509_CRL_get_signature_nid(x);
100. X509_signature_print(out, sig_alg, NULL);
^
101. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);
102. BIO_printf(out, "%8sIssuer: %s\n", "", p);
crypto/x509/t_x509.c:326:1: Parameter `*sig->data`
324. }
325.
326. > int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
327. {
328. int sig_nid;
crypto/x509/t_crl.c:101:9: Call
99. i = X509_CRL_get_signature_nid(x);
100. X509_signature_print(out, sig_alg, NULL);
101. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);
^
102. BIO_printf(out, "%8sIssuer: %s\n", "", p);
103. OPENSSL_free(p);
crypto/x509/x509_obj.c:67:1: Parameter `*buf`
65. #include "internal/x509_int.h"
66.
67. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
68. {
69. X509_NAME_ENTRY *ne;
crypto/x509/t_crl.c:105:5: Call
103. OPENSSL_free(p);
104. BIO_printf(out, "%8sLast Update: ", "");
105. ASN1_TIME_print(out, X509_CRL_get_lastUpdate(x));
^
106. BIO_printf(out, "\n%8sNext Update: ", "");
107. if (X509_CRL_get_nextUpdate(x))
crypto/asn1/a_time.c:202:1: Parameter `*tm->data`
200. }
201.
202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
203. {
204. if (tm->type == V_ASN1_UTCTIME)
crypto/asn1/a_time.c:207:16: Call
205. return ASN1_UTCTIME_print(bp, tm);
206. if (tm->type == V_ASN1_GENERALIZEDTIME)
207. return ASN1_GENERALIZEDTIME_print(bp, tm);
^
208. BIO_write(bp, "Bad time value", 14);
209. return (0);
crypto/asn1/a_gentm.c:266:1: <Offset trace>
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data`
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:287:5: Assignment
285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
286. + (v[2] - '0') * 10 + (v[3] - '0');
287. M = (v[4] - '0') * 10 + (v[5] - '0');
^
288. if ((M > 12) || (M < 1))
289. goto err;
crypto/asn1/a_gentm.c:261:1: <Length trace>
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:261:1: Array declaration
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`
306.
307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y,
^
309. (gmt) ? " GMT" : "") <= 0)
310. return (0);
| https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308 |
d2a_code_trace_data_42170 | static char *dlfcn_merger(DSO *dso, const char *filespec1,
const char *filespec2)
{
char *merged;
if (!filespec1 && !filespec2) {
DSOerr(DSO_F_DLFCN_MERGER, ERR_R_PASSED_NULL_PARAMETER);
return NULL;
}
if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) {
merged = OPENSSL_strdup(filespec1);
if (merged == NULL) {
DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
return NULL;
}
}
else if (!filespec1) {
merged = OPENSSL_strdup(filespec2);
if (merged == NULL) {
DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
return NULL;
}
} else {
int spec2len, len;
spec2len = strlen(filespec2);
len = spec2len + strlen(filespec1);
if (spec2len && filespec2[spec2len - 1] == '/') {
spec2len--;
len--;
}
merged = OPENSSL_malloc(len + 2);
if (merged == NULL) {
DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
return NULL;
}
strcpy(merged, filespec2);
merged[spec2len] = '/';
strcpy(&merged[spec2len + 1], filespec1);
}
return merged;
}
crypto/dso/dso_dlfcn.c:238: error: BUFFER_OVERRUN_S2
Offset: [`filespec1->strlen` + 1, `filespec1->strlen` + `filespec2->strlen` + 1] (⇐ [1, `filespec2->strlen` + 1] + `filespec1->strlen`) Size: [1, `filespec1->strlen` + `filespec2->strlen` + 2].
Showing all 6 steps of the trace
crypto/dso/dso_dlfcn.c:185:1: <Offset trace>
183. }
184.
185. > static char *dlfcn_merger(DSO *dso, const char *filespec1,
186. const char *filespec2)
187. {
crypto/dso/dso_dlfcn.c:185:1: Parameter `filespec1->strlen`
183. }
184.
185. > static char *dlfcn_merger(DSO *dso, const char *filespec1,
186. const char *filespec2)
187. {
crypto/dso/dso_dlfcn.c:185:1: <Length trace>
183. }
184.
185. > static char *dlfcn_merger(DSO *dso, const char *filespec1,
186. const char *filespec2)
187. {
crypto/dso/dso_dlfcn.c:185:1: Parameter `filespec2->strlen`
183. }
184.
185. > static char *dlfcn_merger(DSO *dso, const char *filespec1,
186. const char *filespec2)
187. {
crypto/dso/dso_dlfcn.c:224:9: Assignment
222. int spec2len, len;
223.
224. spec2len = strlen(filespec2);
^
225. len = spec2len + strlen(filespec1);
226.
crypto/dso/dso_dlfcn.c:238:9: Array access: Offset: [filespec1->strlen + 1, filespec1->strlen + filespec2->strlen + 1] (⇐ [1, filespec2->strlen + 1] + filespec1->strlen) Size: [1, filespec1->strlen + filespec2->strlen + 2]
236. strcpy(merged, filespec2);
237. merged[spec2len] = '/';
238. strcpy(&merged[spec2len + 1], filespec1);
^
239. }
240. return merged;
| https://github.com/openssl/openssl/blob/9b02dc97e4963969da69675a871dbe80e6d31cda/crypto/dso/dso_dlfcn.c/#L238 |
d2a_code_trace_data_42171 | 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:1061: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 13]):unsigned64 by call to `WPACKET_start_sub_packet_len__`.
Showing all 12 steps of the trace
ssl/t1_lib.c:1059:21: Call
1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
1058. /* Sub-packet for server_name extension */
1059. || !WPACKET_start_sub_packet_u16(pkt)
^
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c: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:1061:21: Call
1059. || !WPACKET_start_sub_packet_u16(pkt)
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
^
1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
ssl/packet.c:224:1: Parameter `pkt->written`
222. }
223.
224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
225. {
226. WPACKET_SUB *sub;
ssl/packet.c:248:10: Call
246. }
247.
248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
249. return 0;
250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:36:1: <LHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `pkt->buf->length`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: <RHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `len`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 13]):unsigned64 by call to `WPACKET_start_sub_packet_len__`
44. return 0;
45.
46. if (pkt->buf->length - pkt->written < len) {
^
47. size_t newlen;
48. size_t reflen;
| https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46 |
d2a_code_trace_data_42172 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:1502: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`.
Showing all 25 steps of the trace
test/bntest.c:1502:10: Call
1500. goto err;
1501.
1502. if (!TEST_true(BN_mod_exp(ret, a, e, m, ctx))
^
1503. || !equalBN("A ^ E (mod M)", mod_exp, ret))
1504. goto err;
crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth`
87. }
88.
89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
90. BN_CTX *ctx)
91. {
crypto/bn/bn_exp.c: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:191:5: Call
189. }
190.
191. BN_CTX_start(ctx);
^
192. aa = BN_CTX_get(ctx);
193. val[0] = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:192:10: Call
190.
191. BN_CTX_start(ctx);
192. aa = BN_CTX_get(ctx);
^
193. val[0] = BN_CTX_get(ctx);
194. if (val[0] == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:193:14: Call
191. BN_CTX_start(ctx);
192. aa = BN_CTX_get(ctx);
193. val[0] = BN_CTX_get(ctx);
^
194. if (val[0] == NULL)
195. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:210:10: Call
208. }
209.
210. if (!BN_nnmod(val[0], a, m, ctx))
^
211. goto err; /* 1 */
212. if (BN_is_zero(val[0])) {
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_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_exp`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268 |
d2a_code_trace_data_42173 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
int i, nw, lb, rb;
BN_ULONG *t, *f;
BN_ULONG l;
bn_check_top(r);
bn_check_top(a);
if (n < 0) {
BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
return 0;
}
r->neg = a->neg;
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return (0);
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return (1);
}
crypto/rsa/rsa_ossl.c:642: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`.
Showing all 16 steps of the trace
crypto/rsa/rsa_ossl.c:587:1: Parameter `rsa->p->top`
585. }
586.
587. > static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
588. {
589. BIGNUM *r1, *m1, *vrfy;
crypto/rsa/rsa_ossl.c:610:9: Call
608. goto err;
609. }
610. BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME);
^
611. BN_with_flags(q, rsa->q, BN_FLG_CONSTTIME);
612.
crypto/bn/bn_lib.c:949:1: Parameter `b->top`
947. }
948.
949. > void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags)
950. {
951. dest->d = b->d;
crypto/bn/bn_lib.c:952:5: Assignment
950. {
951. dest->d = b->d;
952. dest->top = b->top;
^
953. dest->dmax = b->dmax;
954. dest->neg = b->neg;
crypto/rsa/rsa_ossl.c:642:14: Call
640. BN_with_flags(c, I, BN_FLG_CONSTTIME);
641.
642. if (!BN_mod(r1, c, rsa->q, ctx)) {
^
643. BN_free(c);
644. goto err;
crypto/bn/bn_div.c:140:1: Parameter `num->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. {
crypto/bn/bn_div.c:210:11: Call
208. sdiv->neg = 0;
209. norm_shift += BN_BITS2;
210. if (!(BN_lshift(snum, num, norm_shift)))
^
211. goto err;
212. snum->neg = 0;
crypto/bn/bn_shift.c:81:1: <Offset trace>
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:81:1: Parameter `n`
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:96:5: Assignment
94.
95. r->neg = a->neg;
96. nw = n / BN_BITS2;
^
97. if (bn_wexpand(r, a->top + nw + 1) == NULL)
98. return (0);
crypto/bn/bn_shift.c:81:1: <Length trace>
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:81:1: Parameter `*r->d`
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:9: Call
95. r->neg = a->neg;
96. nw = n / BN_BITS2;
97. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
98. return (0);
99. lb = n % BN_BITS2;
crypto/bn/bn_lib.c:1014:1: Parameter `*a->d`
1012. }
1013.
1014. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
1015. {
1016. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:102:5: Assignment
100. rb = BN_BITS2 - lb;
101. f = a->d;
102. t = r->d;
^
103. t[a->top + nw] = 0;
104. if (lb == 0)
crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`
108. for (i = a->top - 1; i >= 0; i--) {
109. l = f[i];
110. t[nw + i + 1] |= (l >> rb) & BN_MASK2;
^
111. t[nw + i] = (l << lb) & BN_MASK2;
112. }
| https://github.com/openssl/openssl/blob/ec772a817afc0f788c38006f623204a7d76221ec/crypto/bn/bn_shift.c/#L110 |
d2a_code_trace_data_42174 | int RAND_poll(void)
{
int ret = 0;
RAND_POOL *pool = NULL;
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth == RAND_OpenSSL()) {
RAND_DRBG *drbg = RAND_DRBG_get0_master();
if (drbg == NULL)
return 0;
rand_drbg_lock(drbg);
ret = rand_drbg_restart(drbg, NULL, 0, 0);
rand_drbg_unlock(drbg);
return ret;
} else {
pool = rand_pool_new(RAND_DRBG_STRENGTH,
RAND_DRBG_STRENGTH / 8,
RAND_POOL_MAX_LENGTH);
if (pool == NULL)
return 0;
if (rand_pool_acquire_entropy(pool) == 0)
goto err;
if (meth->add == NULL
|| meth->add(rand_pool_buffer(pool),
rand_pool_length(pool),
(rand_pool_entropy(pool) / 8.0)) == 0)
goto err;
ret = 1;
}
err:
rand_pool_free(pool);
return ret;
}
crypto/rand/rand_lib.c:412: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 386 could be null and is dereferenced at line 412, column 13.
Showing all 24 steps of the trace
crypto/rand/rand_lib.c:380:1: start of procedure RAND_poll()
378. * configurable via the --with-rand-seed configure option.
379. */
380. > int RAND_poll(void)
381. {
382. int ret = 0;
crypto/rand/rand_lib.c:382:5:
380. int RAND_poll(void)
381. {
382. > int ret = 0;
383.
384. RAND_POOL *pool = NULL;
crypto/rand/rand_lib.c:384:5:
382. int ret = 0;
383.
384. > RAND_POOL *pool = NULL;
385.
386. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:386:5:
384. RAND_POOL *pool = NULL;
385.
386. > const RAND_METHOD *meth = RAND_get_rand_method();
387.
388. if (meth == RAND_OpenSSL()) {
crypto/rand/rand_lib.c:714:1: start of procedure RAND_get_rand_method()
712. }
713.
714. > const RAND_METHOD *RAND_get_rand_method(void)
715. {
716. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:716:5:
714. const RAND_METHOD *RAND_get_rand_method(void)
715. {
716. > const RAND_METHOD *tmp_meth = NULL;
717.
718. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:718:10:
716. const RAND_METHOD *tmp_meth = NULL;
717.
718. > if (!RUN_ONCE(&rand_init, do_rand_init))
719. return NULL;
720.
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:718:10: Condition is false
716. const RAND_METHOD *tmp_meth = NULL;
717.
718. if (!RUN_ONCE(&rand_init, do_rand_init))
^
719. return NULL;
720.
crypto/rand/rand_lib.c:718:10: Taking true branch
716. const RAND_METHOD *tmp_meth = NULL;
717.
718. if (!RUN_ONCE(&rand_init, do_rand_init))
^
719. return NULL;
720.
crypto/rand/rand_lib.c:719:9:
717.
718. if (!RUN_ONCE(&rand_init, do_rand_init))
719. > return NULL;
720.
721. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:742:1: return from a call to RAND_get_rand_method
740. CRYPTO_THREAD_unlock(rand_meth_lock);
741. return tmp_meth;
742. > }
743.
744. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:388:9:
386. const RAND_METHOD *meth = RAND_get_rand_method();
387.
388. > if (meth == RAND_OpenSSL()) {
389. /* fill random pool and seed the master DRBG */
390. RAND_DRBG *drbg = RAND_DRBG_get0_master();
crypto/rand/drbg_lib.c:1152:1: start of procedure RAND_OpenSSL()
1150. };
1151.
1152. > RAND_METHOD *RAND_OpenSSL(void)
1153. {
1154. return &rand_meth;
crypto/rand/drbg_lib.c:1154:5:
1152. RAND_METHOD *RAND_OpenSSL(void)
1153. {
1154. > return &rand_meth;
1155. }
crypto/rand/drbg_lib.c:1155:1: return from a call to RAND_OpenSSL
1153. {
1154. return &rand_meth;
1155. > }
crypto/rand/rand_lib.c:388:9: Taking false branch
386. const RAND_METHOD *meth = RAND_get_rand_method();
387.
388. if (meth == RAND_OpenSSL()) {
^
389. /* fill random pool and seed the master DRBG */
390. RAND_DRBG *drbg = RAND_DRBG_get0_master();
crypto/rand/rand_lib.c:403:9: Skipping rand_pool_new(): empty list of specs
401. } else {
402. /* fill random pool and seed the current legacy RNG */
403. pool = rand_pool_new(RAND_DRBG_STRENGTH,
^
404. RAND_DRBG_STRENGTH / 8,
405. RAND_POOL_MAX_LENGTH);
crypto/rand/rand_lib.c:406:13: Taking false branch
404. RAND_DRBG_STRENGTH / 8,
405. RAND_POOL_MAX_LENGTH);
406. if (pool == NULL)
^
407. return 0;
408.
crypto/rand/rand_lib.c:409:13: Taking false branch
407. return 0;
408.
409. if (rand_pool_acquire_entropy(pool) == 0)
^
410. goto err;
411.
crypto/rand/rand_lib.c:412:13:
410. goto err;
411.
412. > if (meth->add == NULL
413. || meth->add(rand_pool_buffer(pool),
414. rand_pool_length(pool),
| https://github.com/openssl/openssl/blob/92ebf6c4c21ff4b41ba1fd69af74b2039e138114/crypto/rand/rand_lib.c/#L412 |
d2a_code_trace_data_42175 | int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
&& md_size <= EVP_MAX_MD_SIZE))
return 0;
#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);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i++) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
}
ssl/record/ssl3_record.c:547: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac`.
Showing all 9 steps of the trace
ssl/record/ssl3_record.c:256:29: Call
254. if (!PACKET_get_1(&pkt, &type)
255. || !PACKET_get_net_2(&pkt, &version)
256. || !PACKET_get_net_2_len(&pkt, &thisrr->length)) {
^
257. al = SSL_AD_DECODE_ERROR;
258. SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR);
ssl/packet_locl.h:164:8: Parameter `*data`
162.
163. /* Same as PACKET_get_net_2() but for a size_t */
164. __owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data)
^
165. {
166. unsigned int i;
ssl/record/ssl3_record.c:547:22: Call
545. */
546. mac = mac_tmp;
547. if (!ssl3_cbc_copy_mac(mac_tmp, thisrr, mac_size)) {
^
548. al = SSL_AD_INTERNAL_ERROR;
549. SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR);
ssl/record/ssl3_record.c:1420:1: <LHS trace>
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1420:1: Parameter `rec->length`
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1433:5: Assignment
1431. * mac_end is the index of |rec->data| just after the end of the MAC.
1432. */
1433. size_t mac_end = rec->length;
^
1434. size_t mac_start = mac_end - md_size;
1435. size_t in_mac;
ssl/record/ssl3_record.c:1420:1: <RHS trace>
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1420:1: Parameter `md_size`
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1434:5: Binary operation: ([0, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac`
1432. */
1433. size_t mac_end = rec->length;
1434. size_t mac_start = mac_end - md_size;
^
1435. size_t in_mac;
1436. /*
| https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/record/ssl3_record.c/#L1434 |
d2a_code_trace_data_42176 | static int opt_streamid(const char *opt, const char *arg)
{
int idx;
char *p;
char idx_str[16];
av_strlcpy(idx_str, arg, sizeof(idx_str));
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:3751: error: Null Dereference
pointer `p` last assigned on line 3751 could be null and is dereferenced at line 3751, column 5.
ffmpeg.c:3737:1: start of procedure opt_streamid()
3735.
3736. /* arg format is "output-stream-index:streamid-value". */
3737. static int opt_streamid(const char *opt, const char *arg)
^
3738. {
3739. int idx;
ffmpeg.c:3743:5:
3741. char idx_str[16];
3742.
3743. av_strlcpy(idx_str, arg, sizeof(idx_str));
^
3744. p = strchr(idx_str, ':');
3745. if (!p) {
libavutil/avstring.c:64:1: start of procedure av_strlcpy()
62. }
63.
64. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
65. {
66. size_t len = 0;
libavutil/avstring.c:66:5:
64. size_t av_strlcpy(char *dst, const char *src, size_t size)
65. {
66. size_t len = 0;
^
67. while (++len < size && *src)
68. *dst++ = *src++;
libavutil/avstring.c:67:12: Loop condition is true. Entering loop body
65. {
66. size_t len = 0;
67. while (++len < size && *src)
^
68. *dst++ = *src++;
69. if (len <= size)
libavutil/avstring.c:67:28: Loop condition is false. Leaving loop
65. {
66. size_t len = 0;
67. while (++len < size && *src)
^
68. *dst++ = *src++;
69. if (len <= size)
libavutil/avstring.c:69:9: Taking true branch
67. while (++len < size && *src)
68. *dst++ = *src++;
69. if (len <= size)
^
70. *dst = 0;
71. return len + strlen(src) - 1;
libavutil/avstring.c:70:9:
68. *dst++ = *src++;
69. if (len <= size)
70. *dst = 0;
^
71. return len + strlen(src) - 1;
72. }
libavutil/avstring.c:71:5:
69. if (len <= size)
70. *dst = 0;
71. return len + strlen(src) - 1;
^
72. }
73.
libavutil/avstring.c:72:1: return from a call to av_strlcpy
70. *dst = 0;
71. return len + strlen(src) - 1;
72. }
^
73.
74. size_t av_strlcat(char *dst, const char *src, size_t size)
ffmpeg.c:3744:5:
3742.
3743. av_strlcpy(idx_str, arg, sizeof(idx_str));
3744. p = strchr(idx_str, ':');
^
3745. if (!p) {
3746. fprintf(stderr,
ffmpeg.c:3745:10: Taking true branch
3743. av_strlcpy(idx_str, arg, sizeof(idx_str));
3744. p = strchr(idx_str, ':');
3745. if (!p) {
^
3746. fprintf(stderr,
3747. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
ffmpeg.c:3746:9:
3744. p = strchr(idx_str, ':');
3745. if (!p) {
3746. fprintf(stderr,
^
3747. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3748. arg, opt);
ffmpeg.c:3749:9: Skipping ffmpeg_exit(): empty list of specs
3747. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3748. arg, opt);
3749. ffmpeg_exit(1);
^
3750. }
3751. *p++ = '\0';
ffmpeg.c:3751:5:
3749. ffmpeg_exit(1);
3750. }
3751. *p++ = '\0';
^
3752. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3753. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
| https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L3751 |
d2a_code_trace_data_42177 | 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:199: error: INTEGER_OVERFLOW_L2
(1 - [-37, 15]):unsigned64 by call to `ctr_BCC_update`.
Showing all 13 steps of the trace
crypto/rand/drbg_ctr.c:195:5: Assignment
193. *p++ = 0;
194. *p = (unsigned char)((ctr->keylen + 16) & 0xff);
195. ctr->bltmp_pos = 8;
^
196. if (!ctr_BCC_update(ctr, in1, in1len)
197. || !ctr_BCC_update(ctr, in2, in2len)
crypto/rand/drbg_ctr.c:196:10: Call
194. *p = (unsigned char)((ctr->keylen + 16) & 0xff);
195. ctr->bltmp_pos = 8;
196. if (!ctr_BCC_update(ctr, in1, in1len)
^
197. || !ctr_BCC_update(ctr, in2, in2len)
198. || !ctr_BCC_update(ctr, in3, in3len)
crypto/rand/drbg_ctr.c:120:8: Parameter `ctr->bltmp_pos`
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:197:13: Call
195. ctr->bltmp_pos = 8;
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)
crypto/rand/drbg_ctr.c:120:8: Parameter `ctr->bltmp_pos`
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: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: Parameter `ctr->bltmp_pos`
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:199:13: Call
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))
201. return 0;
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 - [-37, 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_42178 | static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
{
AVDictionary **meta_in = NULL;
AVDictionary **meta_out;
int i, ret = 0;
char type_in, type_out;
const char *istream_spec = NULL, *ostream_spec = NULL;
int idx_in = 0, idx_out = 0;
parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
if (type_in == 'g' || type_out == 'g')
o->metadata_global_manual = 1;
if (type_in == 's' || type_out == 's')
o->metadata_streams_manual = 1;
if (type_in == 'c' || type_out == 'c')
o->metadata_chapters_manual = 1;
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
if ((index) < 0 || (index) >= (nb_elems)) {\
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
(desc), (index));\
exit_program(1);\
}
#define SET_DICT(type, meta, context, index)\
switch (type) {\
case 'g':\
meta = &context->metadata;\
break;\
case 'c':\
METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
meta = &context->chapters[index]->metadata;\
break;\
case 'p':\
METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
meta = &context->programs[index]->metadata;\
break;\
}\
SET_DICT(type_in, meta_in, ic, idx_in);
SET_DICT(type_out, meta_out, oc, idx_out);
if (type_in == 's') {
for (i = 0; i < ic->nb_streams; i++) {
if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {
meta_in = &ic->streams[i]->metadata;
break;
} else if (ret < 0)
exit_program(1);
}
if (!meta_in) {
av_log(NULL, AV_LOG_FATAL, "Stream specifier %s does not match any streams.\n", istream_spec);
exit_program(1);
}
}
if (type_out == 's') {
for (i = 0; i < oc->nb_streams; i++) {
if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {
meta_out = &oc->streams[i]->metadata;
av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
} else if (ret < 0)
exit_program(1);
}
} else
av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
return 0;
}
avconv.c:3066: error: Null Dereference
pointer `meta_in` last assigned on line 3000 could be null and is dereferenced at line 3066, column 32.
avconv.c:2998:1: start of procedure copy_metadata()
2996. }
2997.
2998. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
^
2999. {
3000. AVDictionary **meta_in = NULL;
avconv.c:3000:5:
2998. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
2999. {
3000. AVDictionary **meta_in = NULL;
^
3001. AVDictionary **meta_out;
3002. int i, ret = 0;
avconv.c:3002:5:
3000. AVDictionary **meta_in = NULL;
3001. AVDictionary **meta_out;
3002. int i, ret = 0;
^
3003. char type_in, type_out;
3004. const char *istream_spec = NULL, *ostream_spec = NULL;
avconv.c:3004:5:
3002. int i, ret = 0;
3003. char type_in, type_out;
3004. const char *istream_spec = NULL, *ostream_spec = NULL;
^
3005. int idx_in = 0, idx_out = 0;
3006.
avconv.c:3005:5:
3003. char type_in, type_out;
3004. const char *istream_spec = NULL, *ostream_spec = NULL;
3005. int idx_in = 0, idx_out = 0;
^
3006.
3007. parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
avconv.c:3007:5:
3005. int idx_in = 0, idx_out = 0;
3006.
3007. parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
^
3008. parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
3009.
avconv.c:2971:1: start of procedure parse_meta_type()
2969. * @param stream_spec for type s, the stream specifier is written here
2970. */
2971. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
^
2972. {
2973. if (*arg) {
avconv.c:2973:9: Taking true branch
2971. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
2972. {
2973. if (*arg) {
^
2974. *type = *arg;
2975. switch (*arg) {
avconv.c:2974:9:
2972. {
2973. if (*arg) {
2974. *type = *arg;
^
2975. switch (*arg) {
2976. case 'g':
avconv.c:2975:9:
2973. if (*arg) {
2974. *type = *arg;
2975. switch (*arg) {
^
2976. case 'g':
2977. break;
avconv.c:2976:9: Switch condition is false. Skipping switch case
2974. *type = *arg;
2975. switch (*arg) {
2976. case 'g':
^
2977. break;
2978. case 's':
avconv.c:2978:9: Switch condition is false. Skipping switch case
2976. case 'g':
2977. break;
2978. case 's':
^
2979. if (*(++arg) && *arg != ':') {
2980. av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", arg);
avconv.c:2985:9: Switch condition is false. Skipping switch case
2983. *stream_spec = *arg == ':' ? arg + 1 : "";
2984. break;
2985. case 'c':
^
2986. case 'p':
2987. if (*(++arg) == ':')
avconv.c:2986:9: Switch condition is false. Skipping switch case
2984. break;
2985. case 'c':
2986. case 'p':
^
2987. if (*(++arg) == ':')
2988. *index = strtol(++arg, NULL, 0);
avconv.c:2991:13: Skipping av_log(): empty list of specs
2989. break;
2990. default:
2991. av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
^
2992. exit_program(1);
2993. }
avconv.c:2992:13: Skipping exit_program(): empty list of specs
2990. default:
2991. av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
2992. exit_program(1);
^
2993. }
2994. } else
avconv.c:2973:5:
2971. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
2972. {
2973. if (*arg) {
^
2974. *type = *arg;
2975. switch (*arg) {
avconv.c:2996:1: return from a call to parse_meta_type
2994. } else
2995. *type = 'g';
2996. }
^
2997.
2998. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
avconv.c:3008:5:
3006.
3007. parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
3008. parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
^
3009.
3010. if (type_in == 'g' || type_out == 'g')
avconv.c:2971:1: start of procedure parse_meta_type()
2969. * @param stream_spec for type s, the stream specifier is written here
2970. */
2971. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
^
2972. {
2973. if (*arg) {
avconv.c:2973:9: Taking true branch
2971. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
2972. {
2973. if (*arg) {
^
2974. *type = *arg;
2975. switch (*arg) {
avconv.c:2974:9:
2972. {
2973. if (*arg) {
2974. *type = *arg;
^
2975. switch (*arg) {
2976. case 'g':
avconv.c:2975:9:
2973. if (*arg) {
2974. *type = *arg;
2975. switch (*arg) {
^
2976. case 'g':
2977. break;
avconv.c:2976:9: Switch condition is false. Skipping switch case
2974. *type = *arg;
2975. switch (*arg) {
2976. case 'g':
^
2977. break;
2978. case 's':
avconv.c:2978:9: Switch condition is false. Skipping switch case
2976. case 'g':
2977. break;
2978. case 's':
^
2979. if (*(++arg) && *arg != ':') {
2980. av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", arg);
avconv.c:2985:9: Switch condition is false. Skipping switch case
2983. *stream_spec = *arg == ':' ? arg + 1 : "";
2984. break;
2985. case 'c':
^
2986. case 'p':
2987. if (*(++arg) == ':')
avconv.c:2986:9: Switch condition is false. Skipping switch case
2984. break;
2985. case 'c':
2986. case 'p':
^
2987. if (*(++arg) == ':')
2988. *index = strtol(++arg, NULL, 0);
avconv.c:2991:13: Skipping av_log(): empty list of specs
2989. break;
2990. default:
2991. av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
^
2992. exit_program(1);
2993. }
avconv.c:2992:13: Skipping exit_program(): empty list of specs
2990. default:
2991. av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
2992. exit_program(1);
^
2993. }
2994. } else
avconv.c:2973:5:
2971. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
2972. {
2973. if (*arg) {
^
2974. *type = *arg;
2975. switch (*arg) {
avconv.c:2996:1: return from a call to parse_meta_type
2994. } else
2995. *type = 'g';
2996. }
^
2997.
2998. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
avconv.c:3010:9: Taking false branch
3008. parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
3009.
3010. if (type_in == 'g' || type_out == 'g')
^
3011. o->metadata_global_manual = 1;
3012. if (type_in == 's' || type_out == 's')
avconv.c:3010:27: Taking false branch
3008. parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
3009.
3010. if (type_in == 'g' || type_out == 'g')
^
3011. o->metadata_global_manual = 1;
3012. if (type_in == 's' || type_out == 's')
avconv.c:3012:9: Taking false branch
3010. if (type_in == 'g' || type_out == 'g')
3011. o->metadata_global_manual = 1;
3012. if (type_in == 's' || type_out == 's')
^
3013. o->metadata_streams_manual = 1;
3014. if (type_in == 'c' || type_out == 'c')
avconv.c:3012:27: Taking false branch
3010. if (type_in == 'g' || type_out == 'g')
3011. o->metadata_global_manual = 1;
3012. if (type_in == 's' || type_out == 's')
^
3013. o->metadata_streams_manual = 1;
3014. if (type_in == 'c' || type_out == 'c')
avconv.c:3014:9: Taking false branch
3012. if (type_in == 's' || type_out == 's')
3013. o->metadata_streams_manual = 1;
3014. if (type_in == 'c' || type_out == 'c')
^
3015. o->metadata_chapters_manual = 1;
3016.
avconv.c:3014:27: Taking false branch
3012. if (type_in == 's' || type_out == 's')
3013. o->metadata_streams_manual = 1;
3014. if (type_in == 'c' || type_out == 'c')
^
3015. o->metadata_chapters_manual = 1;
3016.
avconv.c:3039:5: Switch condition is false. Skipping switch case
3037. }\
3038.
3039. SET_DICT(type_in, meta_in, ic, idx_in);
^
3040. SET_DICT(type_out, meta_out, oc, idx_out);
3041.
avconv.c:3039:5: Switch condition is false. Skipping switch case
3037. }\
3038.
3039. SET_DICT(type_in, meta_in, ic, idx_in);
^
3040. SET_DICT(type_out, meta_out, oc, idx_out);
3041.
avconv.c:3039:5: Switch condition is false. Skipping switch case
3037. }\
3038.
3039. SET_DICT(type_in, meta_in, ic, idx_in);
^
3040. SET_DICT(type_out, meta_out, oc, idx_out);
3041.
avconv.c:3040:5: Switch condition is false. Skipping switch case
3038.
3039. SET_DICT(type_in, meta_in, ic, idx_in);
3040. SET_DICT(type_out, meta_out, oc, idx_out);
^
3041.
3042. /* for input streams choose first matching stream */
avconv.c:3040:5: Switch condition is false. Skipping switch case
3038.
3039. SET_DICT(type_in, meta_in, ic, idx_in);
3040. SET_DICT(type_out, meta_out, oc, idx_out);
^
3041.
3042. /* for input streams choose first matching stream */
avconv.c:3040:5: Switch condition is false. Skipping switch case
3038.
3039. SET_DICT(type_in, meta_in, ic, idx_in);
3040. SET_DICT(type_out, meta_out, oc, idx_out);
^
3041.
3042. /* for input streams choose first matching stream */
avconv.c:3043:9: Taking false branch
3041.
3042. /* for input streams choose first matching stream */
3043. if (type_in == 's') {
^
3044. for (i = 0; i < ic->nb_streams; i++) {
3045. if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {
avconv.c:3057:9: Taking false branch
3055. }
3056.
3057. if (type_out == 's') {
^
3058. for (i = 0; i < oc->nb_streams; i++) {
3059. if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {
avconv.c:3066:9:
3064. }
3065. } else
3066. av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
^
3067.
3068. return 0;
| https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avconv.c/#L3066 |
d2a_code_trace_data_42179 | DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)
{
SSL_COMP *comp = NULL;
COMP_METHOD *method = COMP_zlib();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
comp = OPENSSL_malloc(sizeof(*comp));
if (comp != NULL) {
comp->method = method;
comp->id = SSL_COMP_ZLIB_IDX;
comp->name = COMP_get_name(method);
sk_SSL_COMP_push(ssl_comp_methods, comp);
sk_SSL_COMP_sort(ssl_comp_methods);
}
}
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
return 1;
}
ssl/ssl_ciph.c:489: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_malloc()` at line 484, column 16 is not reachable after line 489, column 13.
Showing all 44 steps of the trace
ssl/ssl_ciph.c:475:1: start of procedure do_load_builtin_compressions()
473. }
474.
475. > DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)
476. {
477. SSL_COMP *comp = NULL;
ssl/ssl_ciph.c:477:5:
475. DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions)
476. {
477. > SSL_COMP *comp = NULL;
478. COMP_METHOD *method = COMP_zlib();
479.
ssl/ssl_ciph.c:478:5:
476. {
477. SSL_COMP *comp = NULL;
478. > COMP_METHOD *method = COMP_zlib();
479.
480. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
crypto/comp/c_zlib.c:209:1: start of procedure COMP_zlib()
207. #endif
208.
209. > COMP_METHOD *COMP_zlib(void)
210. {
211. COMP_METHOD *meth = &zlib_method_nozlib;
crypto/comp/c_zlib.c:211:5:
209. COMP_METHOD *COMP_zlib(void)
210. {
211. > COMP_METHOD *meth = &zlib_method_nozlib;
212.
213. #ifdef ZLIB_SHARED
crypto/comp/c_zlib.c:259:5:
257. #endif
258.
259. > return (meth);
260. }
261.
crypto/comp/c_zlib.c:260:1: return from a call to COMP_zlib
258.
259. return (meth);
260. > }
261.
262. void comp_zlib_cleanup_int(void)
ssl/ssl_ciph.c:480:5:
478. COMP_METHOD *method = COMP_zlib();
479.
480. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
481. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
482.
crypto/mem_dbg.c:117:1: start of procedure CRYPTO_mem_ctrl()
115. #endif
116.
117. > int CRYPTO_mem_ctrl(int mode)
118. {
119. #ifdef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem_dbg.c:120:5:
118. {
119. #ifdef OPENSSL_NO_CRYPTO_MDEBUG
120. > return mode - mode;
121. #else
122. int ret = mh_mode;
crypto/mem_dbg.c:188:1: return from a call to CRYPTO_mem_ctrl
186. return (ret);
187. #endif
188. > }
189.
190. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
ssl/ssl_ciph.c:481:5:
479.
480. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
481. > ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
482.
483. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
include/openssl/ssl.h:822:1: start of procedure sk_SSL_COMP_new()
820. */
821. DEFINE_STACK_OF_CONST(SSL_CIPHER)
822. > DEFINE_STACK_OF(SSL_COMP)
823.
824. /* compatibility */
include/openssl/ssl.h:822:1: return from a call to sk_SSL_COMP_new
820. */
821. DEFINE_STACK_OF_CONST(SSL_CIPHER)
822. > DEFINE_STACK_OF(SSL_COMP)
823.
824. /* compatibility */
ssl/ssl_ciph.c:483:9:
481. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
482.
483. > if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
484. comp = OPENSSL_malloc(sizeof(*comp));
485. if (comp != NULL) {
crypto/comp/comp_lib.c:36:1: start of procedure COMP_get_type()
34. }
35.
36. > int COMP_get_type(const COMP_METHOD *meth)
37. {
38. return meth->type;
crypto/comp/comp_lib.c:38:5:
36. int COMP_get_type(const COMP_METHOD *meth)
37. {
38. > return meth->type;
39. }
40.
crypto/comp/comp_lib.c:39:1: return from a call to COMP_get_type
37. {
38. return meth->type;
39. > }
40.
41. const char *COMP_get_name(const COMP_METHOD *meth)
ssl/ssl_ciph.c:483:9: Taking true branch
481. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
482.
483. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
^
484. comp = OPENSSL_malloc(sizeof(*comp));
485. if (comp != NULL) {
ssl/ssl_ciph.c:483:47: Taking true branch
481. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
482.
483. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
^
484. comp = OPENSSL_malloc(sizeof(*comp));
485. if (comp != NULL) {
ssl/ssl_ciph.c:484:9:
482.
483. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
484. > comp = OPENSSL_malloc(sizeof(*comp));
485. if (comp != NULL) {
486. comp->method = method;
crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
69. }
70.
71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. void *ret = NULL;
crypto/mem.c:73:5:
71. void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. > void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:75:9: Taking false branch
73. void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
76. return malloc_impl(num, file, line);
77.
crypto/mem.c:78:9: Taking false branch
76. return malloc_impl(num, file, line);
77.
78. if (num <= 0)
^
79. return NULL;
80.
crypto/mem.c:81:5:
79. return NULL;
80.
81. > allow_customize = 0;
82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
83. if (call_malloc_debug) {
crypto/mem.c:91:5:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:91:24:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:92:5:
90. #else
91. osslargused(file); osslargused(line);
92. > ret = malloc(num);
93. #endif
94.
crypto/mem.c:95:5:
93. #endif
94.
95. > return ret;
96. }
97.
crypto/mem.c:96:1: return from a call to CRYPTO_malloc
94.
95. return ret;
96. > }
97.
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
ssl/ssl_ciph.c:485:13: Taking true branch
483. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
484. comp = OPENSSL_malloc(sizeof(*comp));
485. if (comp != NULL) {
^
486. comp->method = method;
487. comp->id = SSL_COMP_ZLIB_IDX;
ssl/ssl_ciph.c:486:13:
484. comp = OPENSSL_malloc(sizeof(*comp));
485. if (comp != NULL) {
486. > comp->method = method;
487. comp->id = SSL_COMP_ZLIB_IDX;
488. comp->name = COMP_get_name(method);
ssl/ssl_ciph.c:487:13:
485. if (comp != NULL) {
486. comp->method = method;
487. > comp->id = SSL_COMP_ZLIB_IDX;
488. comp->name = COMP_get_name(method);
489. sk_SSL_COMP_push(ssl_comp_methods, comp);
ssl/ssl_ciph.c:488:13:
486. comp->method = method;
487. comp->id = SSL_COMP_ZLIB_IDX;
488. > comp->name = COMP_get_name(method);
489. sk_SSL_COMP_push(ssl_comp_methods, comp);
490. sk_SSL_COMP_sort(ssl_comp_methods);
crypto/comp/comp_lib.c:41:1: start of procedure COMP_get_name()
39. }
40.
41. > const char *COMP_get_name(const COMP_METHOD *meth)
42. {
43. return meth->name;
crypto/comp/comp_lib.c:43:5:
41. const char *COMP_get_name(const COMP_METHOD *meth)
42. {
43. > return meth->name;
44. }
45.
crypto/comp/comp_lib.c:44:1: return from a call to COMP_get_name
42. {
43. return meth->name;
44. > }
45.
46. void COMP_CTX_free(COMP_CTX *ctx)
ssl/ssl_ciph.c:489:13:
487. comp->id = SSL_COMP_ZLIB_IDX;
488. comp->name = COMP_get_name(method);
489. > sk_SSL_COMP_push(ssl_comp_methods, comp);
490. sk_SSL_COMP_sort(ssl_comp_methods);
491. }
include/openssl/ssl.h:822:1: start of procedure sk_SSL_COMP_push()
820. */
821. DEFINE_STACK_OF_CONST(SSL_CIPHER)
822. > DEFINE_STACK_OF(SSL_COMP)
823.
824. /* compatibility */
crypto/stack/stack.c:200:1: start of procedure OPENSSL_sk_push()
198. }
199.
200. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
201. {
202. return (OPENSSL_sk_insert(st, data, st->num));
crypto/stack/stack.c:202:5: Skipping OPENSSL_sk_insert(): empty list of specs
200. int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
201. {
202. return (OPENSSL_sk_insert(st, data, st->num));
^
203. }
204.
crypto/stack/stack.c:203:1: return from a call to OPENSSL_sk_push
201. {
202. return (OPENSSL_sk_insert(st, data, st->num));
203. > }
204.
205. int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data)
include/openssl/ssl.h:822:1: return from a call to sk_SSL_COMP_push
820. */
821. DEFINE_STACK_OF_CONST(SSL_CIPHER)
822. > DEFINE_STACK_OF(SSL_COMP)
823.
824. /* compatibility */
| https://github.com/openssl/openssl/blob/7f9ae88817ddf0aac5c6bd95d9a5af1c54ed5bbf/ssl/ssl_ciph.c/#L489 |
d2a_code_trace_data_42180 | static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d;
int dmin;
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
LOAD_COMMON2
if(c->pre_pass){
penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1];
}else{
penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
}
map_generation= update_map_generation(c);
assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
&& ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
c->skip=1;
return dmin;
}
CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(c->avctx->last_predictor_count){
const int count= c->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1065: error: Uninitialized Value
The value read from ymax was never initialized.
libavcodec/motion_est_template.c:1065:9:
1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
^
1066. }
1067. if(dmin>h*h*4){
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1065 |
d2a_code_trace_data_42181 | static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
bc->bits >>= n;
#else
uint64_t ret = bc->bits >> (64 - n);
bc->bits <<= n;
#endif
bc->bits_left -= n;
return ret;
}
libavcodec/magicyuv.c:129: error: Integer Overflow L2
([1, +oo] - 8):unsigned32 by call to `bitstream_read`.
libavcodec/magicyuv.c:129:17: Call
127. return ret;
128.
129. flags = bitstream_read(&bc, 8);
^
130. pred = bitstream_read(&bc, 8);
131.
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 8):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
| https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139 |
d2a_code_trace_data_42182 | int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
{
int rv;
char *stmp, *vtmp = NULL;
stmp = OPENSSL_strdup(value);
if (!stmp)
return -1;
vtmp = strchr(stmp, ':');
if (vtmp) {
*vtmp = 0;
vtmp++;
}
rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
OPENSSL_free(stmp);
return rv;
}
apps/apps.c:1845: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_strdup()` at line 1836, column 12 is not reachable after line 1845, column 5.
Showing all 39 steps of the trace
apps/apps.c:1832:1: start of procedure pkey_ctrl_string()
1830. }
1831.
1832. > int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
1833. {
1834. int rv;
apps/apps.c:1835:5:
1833. {
1834. int rv;
1835. > char *stmp, *vtmp = NULL;
1836. stmp = OPENSSL_strdup(value);
1837. if (!stmp)
apps/apps.c:1836:5:
1834. int rv;
1835. char *stmp, *vtmp = NULL;
1836. > stmp = OPENSSL_strdup(value);
1837. if (!stmp)
1838. return -1;
crypto/o_str.c:28:1: start of procedure CRYPTO_strdup()
26. }
27.
28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
29. {
30. char *ret;
crypto/o_str.c:33:9: Taking false branch
31. size_t size;
32.
33. if (str == NULL)
^
34. return NULL;
35. size = strlen(str) + 1;
crypto/o_str.c:35:5:
33. if (str == NULL)
34. return NULL;
35. > size = strlen(str) + 1;
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
crypto/o_str.c:36:5:
34. return NULL;
35. size = strlen(str) + 1;
36. > ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
38. memcpy(ret, str, size);
crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
69. }
70.
71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. void *ret = NULL;
crypto/mem.c:73:5:
71. void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. > void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:75:9: Taking false branch
73. void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
76. return malloc_impl(num, file, line);
77.
crypto/mem.c:78:9: Taking false branch
76. return malloc_impl(num, file, line);
77.
78. if (num <= 0)
^
79. return NULL;
80.
crypto/mem.c:81:5:
79. return NULL;
80.
81. > allow_customize = 0;
82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
83. if (call_malloc_debug) {
crypto/mem.c:91:5:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:91:24:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:92:5:
90. #else
91. osslargused(file); osslargused(line);
92. > ret = malloc(num);
93. #endif
94.
crypto/mem.c:95:5:
93. #endif
94.
95. > return ret;
96. }
97.
crypto/mem.c:96:1: return from a call to CRYPTO_malloc
94.
95. return ret;
96. > }
97.
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:37:9: Taking true branch
35. size = strlen(str) + 1;
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
^
38. memcpy(ret, str, size);
39. return ret;
crypto/o_str.c:38:9:
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
38. > memcpy(ret, str, size);
39. return ret;
40. }
crypto/o_str.c:39:5:
37. if (ret != NULL)
38. memcpy(ret, str, size);
39. > return ret;
40. }
41.
crypto/o_str.c:40:1: return from a call to CRYPTO_strdup
38. memcpy(ret, str, size);
39. return ret;
40. > }
41.
42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
apps/apps.c:1837:10: Taking false branch
1835. char *stmp, *vtmp = NULL;
1836. stmp = OPENSSL_strdup(value);
1837. if (!stmp)
^
1838. return -1;
1839. vtmp = strchr(stmp, ':');
apps/apps.c:1839:5:
1837. if (!stmp)
1838. return -1;
1839. > vtmp = strchr(stmp, ':');
1840. if (vtmp) {
1841. *vtmp = 0;
apps/apps.c:1840:9: Taking false branch
1838. return -1;
1839. vtmp = strchr(stmp, ':');
1840. if (vtmp) {
^
1841. *vtmp = 0;
1842. vtmp++;
apps/apps.c:1844:5:
1842. vtmp++;
1843. }
1844. > rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1845. OPENSSL_free(stmp);
1846. return rv;
crypto/evp/pmeth_lib.c:326:1: start of procedure EVP_PKEY_CTX_ctrl_str()
324. }
325.
326. > int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx,
327. const char *name, const char *value)
328. {
crypto/evp/pmeth_lib.c:329:10: Taking false branch
327. const char *name, const char *value)
328. {
329. if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
^
330. EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
331. return -2;
crypto/evp/pmeth_lib.c:329:18: Taking false branch
327. const char *name, const char *value)
328. {
329. if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
^
330. EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
331. return -2;
crypto/evp/pmeth_lib.c:329:33: Taking false branch
327. const char *name, const char *value)
328. {
329. if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) {
^
330. EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED);
331. return -2;
crypto/evp/pmeth_lib.c:333:9: Taking false branch
331. return -2;
332. }
333. if (strcmp(name, "digest") == 0)
^
334. return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD,
335. value);
crypto/evp/pmeth_lib.c:336:5: Skipping __function_pointer__(): unresolved function pointer
334. return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD,
335. value);
336. return ctx->pmeth->ctrl_str(ctx, name, value);
^
337. }
338.
crypto/evp/pmeth_lib.c:337:1: return from a call to EVP_PKEY_CTX_ctrl_str
335. value);
336. return ctx->pmeth->ctrl_str(ctx, name, value);
337. > }
338.
339. /* Utility functions to send a string of hex string to a ctrl */
apps/apps.c:1845:5:
1843. }
1844. rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
1845. > OPENSSL_free(stmp);
1846. return rv;
1847. }
crypto/mem.c:163:1: start of procedure CRYPTO_free()
161. }
162.
163. > void CRYPTO_free(void *str, const char *file, int line)
164. {
165. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:165:9: Taking true branch
163. void CRYPTO_free(void *str, const char *file, int line)
164. {
165. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
166. free_impl(str, file, line);
167. return;
crypto/mem.c:165:30: Taking true branch
163. void CRYPTO_free(void *str, const char *file, int line)
164. {
165. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
166. free_impl(str, file, line);
167. return;
crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer
164. {
165. if (free_impl != NULL && free_impl != &CRYPTO_free) {
166. free_impl(str, file, line);
^
167. return;
168. }
crypto/mem.c:167:9:
165. if (free_impl != NULL && free_impl != &CRYPTO_free) {
166. free_impl(str, file, line);
167. > return;
168. }
169.
crypto/mem.c:181:1: return from a call to CRYPTO_free
179. free(str);
180. #endif
181. > }
182.
183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
| https://github.com/openssl/openssl/blob/d53b1dd4483243a271eea7288915a1fb5293505c/apps/apps.c/#L1845 |
d2a_code_trace_data_42183 | 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: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 18 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: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/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:224:1: Parameter `pkt->written`
222. }
223.
224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
225. {
226. WPACKET_SUB *sub;
ssl/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:320:10: Call
318. size_t lenbytes)
319. {
320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
321. || !WPACKET_memcpy(pkt, src, len)
322. || !WPACKET_close(pkt))
ssl/packet.c:224:1: Parameter `pkt->buf->length`
222. }
223.
224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
225. {
226. WPACKET_SUB *sub;
ssl/packet.c:321:17: Call
319. {
320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
321. || !WPACKET_memcpy(pkt, src, len)
^
322. || !WPACKET_close(pkt))
323. return 0;
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] - [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__`
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_42184 | static int encode_test_init(struct evp_test *t, const char *encoding)
{
struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
if (strcmp(encoding, "canonical") == 0) {
edata->encoding = BASE64_CANONICAL_ENCODING;
} else if (strcmp(encoding, "valid") == 0) {
edata->encoding = BASE64_VALID_ENCODING;
} else if (strcmp(encoding, "invalid") == 0) {
edata->encoding = BASE64_INVALID_ENCODING;
t->expected_err = OPENSSL_strdup("DECODE_ERROR");
if (t->expected_err == NULL)
return 0;
} else {
fprintf(stderr, "Bad encoding: %s. Should be one of "
"{canonical, valid, invalid}\n", encoding);
return 0;
}
t->data = edata;
return 1;
}
test/evp_test.c:1561: error: MEMORY_LEAK
memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 1551, column 33 is not reachable after line 1561, column 13.
Showing all 39 steps of the trace
test/evp_test.c:1549:1: start of procedure encode_test_init()
1547. };
1548.
1549. > static int encode_test_init(struct evp_test *t, const char *encoding)
1550. {
1551. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
test/evp_test.c:1551:5:
1549. static int encode_test_init(struct evp_test *t, const char *encoding)
1550. {
1551. > struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1552.
1553. if (strcmp(encoding, "canonical") == 0) {
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking 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)
test/evp_test.c:1553:9: Taking false branch
1551. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1552.
1553. if (strcmp(encoding, "canonical") == 0) {
^
1554. edata->encoding = BASE64_CANONICAL_ENCODING;
1555. } else if (strcmp(encoding, "valid") == 0) {
test/evp_test.c:1555:16: Taking false branch
1553. if (strcmp(encoding, "canonical") == 0) {
1554. edata->encoding = BASE64_CANONICAL_ENCODING;
1555. } else if (strcmp(encoding, "valid") == 0) {
^
1556. edata->encoding = BASE64_VALID_ENCODING;
1557. } else if (strcmp(encoding, "invalid") == 0) {
test/evp_test.c:1557:16: Taking true branch
1555. } else if (strcmp(encoding, "valid") == 0) {
1556. edata->encoding = BASE64_VALID_ENCODING;
1557. } else if (strcmp(encoding, "invalid") == 0) {
^
1558. edata->encoding = BASE64_INVALID_ENCODING;
1559. t->expected_err = OPENSSL_strdup("DECODE_ERROR");
test/evp_test.c:1558:9:
1556. edata->encoding = BASE64_VALID_ENCODING;
1557. } else if (strcmp(encoding, "invalid") == 0) {
1558. > edata->encoding = BASE64_INVALID_ENCODING;
1559. t->expected_err = OPENSSL_strdup("DECODE_ERROR");
1560. if (t->expected_err == NULL)
test/evp_test.c:1559:9:
1557. } else if (strcmp(encoding, "invalid") == 0) {
1558. edata->encoding = BASE64_INVALID_ENCODING;
1559. > t->expected_err = OPENSSL_strdup("DECODE_ERROR");
1560. if (t->expected_err == NULL)
1561. return 0;
crypto/o_str.c:121:1: start of procedure CRYPTO_strdup()
119. }
120.
121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
122. {
123. char *ret;
crypto/o_str.c:125:9: Taking false branch
123. char *ret;
124.
125. if (str == NULL)
^
126. return NULL;
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:127:5:
125. if (str == NULL)
126. return NULL;
127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
129. strcpy(ret, str);
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/o_str.c:128:9: Taking false branch
126. return NULL;
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
^
129. strcpy(ret, str);
130. return ret;
crypto/o_str.c:130:5:
128. if (ret != NULL)
129. strcpy(ret, str);
130. > return ret;
131. }
132.
crypto/o_str.c:131:1: return from a call to CRYPTO_strdup
129. strcpy(ret, str);
130. return ret;
131. > }
132.
133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
test/evp_test.c:1560:13: Taking true branch
1558. edata->encoding = BASE64_INVALID_ENCODING;
1559. t->expected_err = OPENSSL_strdup("DECODE_ERROR");
1560. if (t->expected_err == NULL)
^
1561. return 0;
1562. } else {
test/evp_test.c:1561:13:
1559. t->expected_err = OPENSSL_strdup("DECODE_ERROR");
1560. if (t->expected_err == NULL)
1561. > return 0;
1562. } else {
1563. fprintf(stderr, "Bad encoding: %s. Should be one of "
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/evp_test.c/#L1561 |
d2a_code_trace_data_42185 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_prime.c:90: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `probable_prime_dh_safe`.
Showing all 13 steps of the trace
crypto/bn/bn_prime.c:79:5: Call
77. if (ctx == NULL)
78. goto err;
79. BN_CTX_start(ctx);
^
80. t = BN_CTX_get(ctx);
81. if (t == 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_prime.c:90:18: Call
88. } else {
89. if (safe) {
90. if (!probable_prime_dh_safe(ret, bits, add, rem, ctx))
^
91. goto err;
92. } else {
crypto/bn/bn_prime.c:411:5: Call
409.
410. bits--;
411. BN_CTX_start(ctx);
^
412. t1 = BN_CTX_get(ctx);
413. q = 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_prime.c:466:5: Call
464.
465. err:
466. BN_CTX_end(ctx);
^
467. bn_check_top(p);
468. return ret;
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `probable_prime_dh_safe`
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_42186 | BN_ULONG bn_sub_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl)
{
BN_ULONG c, t;
assert(cl >= 0);
c = bn_sub_words(r, a, b, cl);
if (dl == 0)
return c;
r += cl;
a += cl;
b += cl;
if (dl < 0) {
for (;;) {
t = b[0];
r[0] = (0 - t - c) & BN_MASK2;
if (t != 0)
c = 1;
if (++dl >= 0)
break;
t = b[1];
r[1] = (0 - t - c) & BN_MASK2;
if (t != 0)
c = 1;
if (++dl >= 0)
break;
t = b[2];
r[2] = (0 - t - c) & BN_MASK2;
if (t != 0)
c = 1;
if (++dl >= 0)
break;
t = b[3];
r[3] = (0 - t - c) & BN_MASK2;
if (t != 0)
c = 1;
if (++dl >= 0)
break;
b += 4;
r += 4;
}
} else {
int save_dl = dl;
while (c) {
t = a[0];
r[0] = (t - c) & BN_MASK2;
if (t != 0)
c = 0;
if (--dl <= 0)
break;
t = a[1];
r[1] = (t - c) & BN_MASK2;
if (t != 0)
c = 0;
if (--dl <= 0)
break;
t = a[2];
r[2] = (t - c) & BN_MASK2;
if (t != 0)
c = 0;
if (--dl <= 0)
break;
t = a[3];
r[3] = (t - c) & BN_MASK2;
if (t != 0)
c = 0;
if (--dl <= 0)
break;
save_dl = dl;
a += 4;
r += 4;
}
if (dl > 0) {
if (save_dl > dl) {
switch (save_dl - dl) {
case 1:
r[1] = a[1];
if (--dl <= 0)
break;
case 2:
r[2] = a[2];
if (--dl <= 0)
break;
case 3:
r[3] = a[3];
if (--dl <= 0)
break;
}
a += 4;
r += 4;
}
}
if (dl > 0) {
for (;;) {
r[0] = a[0];
if (--dl <= 0)
break;
r[1] = a[1];
if (--dl <= 0)
break;
r[2] = a[2];
if (--dl <= 0)
break;
r[3] = a[3];
if (--dl <= 0)
break;
a += 4;
r += 4;
}
}
}
return c;
}
test/bntest.c:1882: error: INTEGER_OVERFLOW_L2
(0 - [0, 1]):unsigned64 by call to `BN_mod_mul`.
Showing all 15 steps of the trace
test/bntest.c:1882:39: Call
1880. ERR_clear_error();
1881.
1882. if (BN_mod_mul(a, BN_value_one(), BN_value_one(), zero, ctx)) {
^
1883. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n");
1884. goto err;
crypto/bn/bn_lib.c:82:5: Assignment
80. const BIGNUM *BN_value_one(void)
81. {
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 };
test/bntest.c:1882:9: Call
1880. ERR_clear_error();
1881.
1882. if (BN_mod_mul(a, BN_value_one(), BN_value_one(), zero, ctx)) {
^
1883. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n");
1884. goto err;
crypto/bn/bn_mod.c:73:1: Parameter `*b->d`
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:90:14: Call
88. goto err;
89. } else {
90. if (!BN_mul(t, a, b, ctx))
^
91. goto err;
92. }
crypto/bn/bn_mul.c:828:1: Parameter `*b->d`
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;
crypto/bn/bn_mul.c:909:17: Call
907. if (bn_wexpand(rr, k * 4) == NULL)
908. goto err;
909. bn_mul_part_recursive(rr->d, a->d, b->d,
^
910. j, al - j, bl - j, t->d);
911. } else { /* al <= j || bl <= j */
crypto/bn/bn_mul.c:480:1: Parameter `*b`
478. */
479. /* tnX may not be negative but less than n */
480. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
481. int tna, int tnb, BN_ULONG *t)
482. {
crypto/bn/bn_mul.c:494:10: Call
492. /* r=(a[0]-a[1])*(b[1]-b[0]) */
493. c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
494. c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
^
495. neg = 0;
496. switch (c1 * 3 + c2) {
crypto/bn/bn_lib.c:803:1: Parameter `*b`
801. */
802.
803. > int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, int cl, int dl)
804. {
805. int n, i;
crypto/bn/bn_mul.c:499:9: Call
497. case -4:
498. bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
499. bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
^
500. break;
501. case -3:
crypto/bn/bn_mul.c:27:1: <RHS trace>
25. */
26.
27. > BN_ULONG bn_sub_part_words(BN_ULONG *r,
28. const BN_ULONG *a, const BN_ULONG *b,
29. int cl, int dl)
crypto/bn/bn_mul.c:27:1: Parameter `*b`
25. */
26.
27. > BN_ULONG bn_sub_part_words(BN_ULONG *r,
28. const BN_ULONG *a, const BN_ULONG *b,
29. int cl, int dl)
crypto/bn/bn_mul.c:45:13: Assignment
43. if (dl < 0) {
44. for (;;) {
45. t = b[0];
^
46. r[0] = (0 - t - c) & BN_MASK2;
47. if (t != 0)
crypto/bn/bn_mul.c:46:13: Binary operation: (0 - [0, 1]):unsigned64 by call to `BN_mod_mul`
44. for (;;) {
45. t = b[0];
46. r[0] = (0 - t - c) & BN_MASK2;
^
47. if (t != 0)
48. c = 1;
| https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_mul.c/#L46 |
d2a_code_trace_data_42187 | static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d;
int dmin;
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
LOAD_COMMON2
if(c->pre_pass){
penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1];
}else{
penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
}
map_generation= update_map_generation(c);
assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
&& ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
c->skip=1;
return dmin;
}
CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(c->avctx->last_predictor_count){
const int count= c->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1099: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1099:17:
1097.
1098. if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
1099. CHECK_MV(mx,my)
^
1100. }
1101. }
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1099 |
d2a_code_trace_data_42188 | static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
SBRData *ch_data, int e_a[2])
{
int e, i, m;
memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1]));
for (e = 0; e < ch_data->bs_num_env; e++) {
const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]];
uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
int k;
if (sbr->kx[1] != table[0]) {
av_log(ac->avctx, AV_LOG_ERROR, "kx != f_table{high,low}[0]. "
"Derived frequency tables were not regenerated.\n");
sbr_turnoff(sbr);
return AVERROR_BUG;
}
for (i = 0; i < ilim; i++)
for (m = table[i]; m < table[i + 1]; m++)
sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i];
k = (ch_data->bs_num_noise > 1) && (ch_data->t_env[e] >= ch_data->t_q[1]);
for (i = 0; i < sbr->n_q; i++)
for (m = sbr->f_tablenoise[i]; m < sbr->f_tablenoise[i + 1]; m++)
sbr->q_mapped[e][m - sbr->kx[1]] = ch_data->noise_facs[k+1][i];
for (i = 0; i < sbr->n[1]; i++) {
if (ch_data->bs_add_harmonic_flag) {
const unsigned int m_midpoint =
(sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1;
ch_data->s_indexmapped[e + 1][m_midpoint - sbr->kx[1]] = ch_data->bs_add_harmonic[i] *
(e >= e_a[1] || (ch_data->s_indexmapped[0][m_midpoint - sbr->kx[1]] == 1));
}
}
for (i = 0; i < ilim; i++) {
int additional_sinusoid_present = 0;
for (m = table[i]; m < table[i + 1]; m++) {
if (ch_data->s_indexmapped[e + 1][m - sbr->kx[1]]) {
additional_sinusoid_present = 1;
break;
}
}
memset(&sbr->s_mapped[e][table[i] - sbr->kx[1]], additional_sinusoid_present,
(table[i + 1] - table[i]) * sizeof(sbr->s_mapped[e][0]));
}
}
memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0]));
return 0;
}
libavcodec/aacsbr.c:1681: error: Integer Overflow L2
([0, +oo] - [min(32, `sbr->kx[*]`), max(32, `sbr->kx[*]`)]):unsigned32 by call to `sbr_mapping`.
libavcodec/aacsbr.c:1648:1: Parameter `sbr->kx[*]`
1646. }
1647.
1648. void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
^
1649. float* L, float* R)
1650. {
libavcodec/aacsbr.c:1681:19: Call
1679.
1680. // hf_adj
1681. err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
^
1682. if (!err) {
1683. sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
libavcodec/aacsbr.c:1402:1: <LHS trace>
1400. * (14496-3 sp04 p217)
1401. */
1402. static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
^
1403. SBRData *ch_data, int e_a[2])
1404. {
libavcodec/aacsbr.c:1402:1: Parameter `sbr->f_tablehigh[*]`
1400. * (14496-3 sp04 p217)
1401. */
1402. static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
^
1403. SBRData *ch_data, int e_a[2])
1404. {
libavcodec/aacsbr.c:1431:17: Assignment
1429. for (i = 0; i < sbr->n[1]; i++) {
1430. if (ch_data->bs_add_harmonic_flag) {
1431. const unsigned int m_midpoint =
^
1432. (sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1;
1433.
libavcodec/aacsbr.c:1402:1: <RHS trace>
1400. * (14496-3 sp04 p217)
1401. */
1402. static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
^
1403. SBRData *ch_data, int e_a[2])
1404. {
libavcodec/aacsbr.c:1402:1: Parameter `sbr->kx[*]`
1400. * (14496-3 sp04 p217)
1401. */
1402. static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
^
1403. SBRData *ch_data, int e_a[2])
1404. {
libavcodec/aacsbr.c:1434:17: Binary operation: ([0, +oo] - [min(32, sbr->kx[*]), max(32, sbr->kx[*])]):unsigned32 by call to `sbr_mapping`
1432. (sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1;
1433.
1434. ch_data->s_indexmapped[e + 1][m_midpoint - sbr->kx[1]] = ch_data->bs_add_harmonic[i] *
^
1435. (e >= e_a[1] || (ch_data->s_indexmapped[0][m_midpoint - sbr->kx[1]] == 1));
1436. }
| https://github.com/libav/libav/blob/cb7190cd2c691fd93e4d3664f3fce6c19ee001dd/libavcodec/aacsbr.c/#L1434 |
d2a_code_trace_data_42189 | static const char *skip_space(const char *s)
{
while (ossl_isspace(*s))
s++;
return s;
}
test/property_test.c:310: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, 37] by call to `ossl_method_store_add`.
Showing all 25 steps of the trace
test/property_test.c:276:9: Array declaration
274. char *impl;
275. } impls[] = {
276. { 1, "fast=no, colour=green", "a" },
^
277. { 1, "fast, colour=blue", "b" },
278. { 1, "", "-" },
test/property_test.c:310:14: Call
308.
309. for (i = 0; i < OSSL_NELEM(impls); i++)
310. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
^
311. impls[i].impl, NULL))) {
312. TEST_note("iteration %zd", i + 1);
crypto/property/property.c:176:1: Parameter `*properties`
174. }
175.
176. > int ossl_method_store_add(OSSL_METHOD_STORE *store,
177. int nid, const char *properties,
178. void *method, void (*method_destruct)(void *))
crypto/property/property.c:205:28: Call
203. ossl_method_cache_flush(store, nid);
204. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
205. impl->properties = ossl_parse_property(store->ctx, properties);
^
206. if (impl->properties == NULL)
207. goto err;
crypto/property/property_parse.c:322:1: Parameter `*defn`
320. }
321.
322. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn)
323. {
324. PROPERTY_DEFINITION *prop = NULL;
crypto/property/property_parse.c:327:5: Assignment
325. OSSL_PROPERTY_LIST *res = NULL;
326. STACK_OF(PROPERTY_DEFINITION) *sk;
327. const char *s = defn;
^
328. int done;
329.
crypto/property/property_parse.c:333:9: Call
331. return NULL;
332.
333. s = skip_space(s);
^
334. done = *s == '\0';
335. while (!done) {
crypto/property/property_parse.c:52:1: Parameter `*s`
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:56:5: Assignment
54. while (ossl_isspace(*s))
55. s++;
56. return s;
^
57. }
58.
crypto/property/property_parse.c:333:5: Assignment
331. return NULL;
332.
333. s = skip_space(s);
^
334. done = *s == '\0';
335. while (!done) {
crypto/property/property_parse.c:341:14: Call
339. memset(&prop->v, 0, sizeof(prop->v));
340. prop->optional = 0;
341. if (!parse_name(ctx, &s, 1, &prop->name_idx))
^
342. goto err;
343. prop->oper = PROPERTY_OPER_EQ;
crypto/property/property_parse.c:83:1: Parameter `**t`
81. }
82.
83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
84. OSSL_PROPERTY_IDX *idx)
85. {
crypto/property/property_parse.c:348:13: Call
346. goto err;
347. }
348. if (match_ch(&s, '=')) {
^
349. if (!parse_value(ctx, &s, prop, 1)) {
350. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
crypto/property/property_parse.c:59:1: Parameter `**t`
57. }
58.
59. > static int match_ch(const char *t[], char m)
60. {
61. const char *s = *t;
crypto/property/property_parse.c:349:18: Call
347. }
348. if (match_ch(&s, '=')) {
349. if (!parse_value(ctx, &s, prop, 1)) {
^
350. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
351. goto err;
crypto/property/property_parse.c:247:1: Parameter `**t`
245. }
246.
247. > static int parse_value(OPENSSL_CTX *ctx, const char *t[],
248. PROPERTY_DEFINITION *res, int create)
249. {
crypto/property/property_parse.c:250:5: Assignment
248. PROPERTY_DEFINITION *res, int create)
249. {
250. const char *s = *t;
^
251. int r = 0;
252.
crypto/property/property_parse.c:254:9: Assignment
252.
253. if (*s == '"' || *s == '\'') {
254. s++;
^
255. r = parse_string(ctx, &s, s[-1], res, create);
256. } else if (*s == '+') {
crypto/property/property_parse.c:255:13: Call
253. if (*s == '"' || *s == '\'') {
254. s++;
255. r = parse_string(ctx, &s, s[-1], res, create);
^
256. } else if (*s == '+') {
257. s++;
crypto/property/property_parse.c:186:1: Parameter `**t`
184. }
185.
186. > static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
187. PROPERTY_DEFINITION *res, const int create)
188. {
crypto/property/property_parse.c:190:5: Assignment
188. {
189. char v[1000];
190. const char *s = *t;
^
191. size_t i = 0;
192. int err = 0;
crypto/property/property_parse.c:207:10: Call
205. }
206. v[i] = '\0';
207. *t = skip_space(s + 1);
^
208. if (err)
209. PROPerr(PROP_F_PARSE_STRING, PROP_R_STRING_TOO_LONG);
crypto/property/property_parse.c:52:1: <Length trace>
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:52:1: Parameter `*s`
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:54:12: Array access: Offset: [2, +oo] Size: [1, 37] by call to `ossl_method_store_add`
52. static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
^
55. s++;
56. return s;
| https://github.com/openssl/openssl/blob/bddf965d29cb4a9c4d6eeb94aa96dfa47d0cfa5d/crypto/property/property_parse.c/#L54 |
d2a_code_trace_data_42190 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_crpt.c:131: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `rsa_get_public_exp`.
Showing all 26 steps of the trace
crypto/rsa/rsa_crpt.c:110:1: Parameter `in_ctx->stack.depth`
108. }
109.
110. > BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
111. {
112. BIGNUM *e;
crypto/rsa/rsa_crpt.c:123:5: Call
121. }
122.
123. BN_CTX_start(ctx);
^
124. e = BN_CTX_get(ctx);
125. if (e == 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/rsa/rsa_crpt.c:131:13: Call
129.
130. if (rsa->e == NULL) {
131. e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
^
132. if (e == NULL) {
133. RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);
crypto/rsa/rsa_crpt.c:82:1: Parameter `ctx->stack.depth`
80. }
81.
82. > static BIGNUM *rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p,
83. const BIGNUM *q, BN_CTX *ctx)
84. {
crypto/rsa/rsa_crpt.c:90:5: Call
88. return NULL;
89.
90. BN_CTX_start(ctx);
^
91. r0 = BN_CTX_get(ctx);
92. r1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/rsa/rsa_crpt.c:91:10: Call
89.
90. BN_CTX_start(ctx);
91. r0 = BN_CTX_get(ctx);
^
92. r1 = BN_CTX_get(ctx);
93. r2 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_crpt.c:92:10: Call
90. BN_CTX_start(ctx);
91. r0 = BN_CTX_get(ctx);
92. r1 = BN_CTX_get(ctx);
^
93. r2 = BN_CTX_get(ctx);
94. if (r2 == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_crpt.c:93:10: Call
91. r0 = BN_CTX_get(ctx);
92. r1 = BN_CTX_get(ctx);
93. r2 = BN_CTX_get(ctx);
^
94. if (r2 == NULL)
95. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_crpt.c:101:10: Call
99. if (!BN_sub(r2, q, BN_value_one()))
100. goto err;
101. if (!BN_mul(r0, r1, r2, ctx))
^
102. goto err;
103.
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 `rsa_get_public_exp`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268 |
d2a_code_trace_data_42191 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/srp/srp_lib.c:72: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`.
Showing all 31 steps of the trace
crypto/srp/srp_lib.c:72:10: Call
70. /* S = (A*v**u) ** b */
71.
72. if (!BN_mod_exp(tmp, v, u, N, bn_ctx))
^
73. goto err;
74. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx))
crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth`
87. }
88.
89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
90. BN_CTX *ctx)
91. {
crypto/bn/bn_exp.c: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:191:5: Call
189. }
190.
191. BN_CTX_start(ctx);
^
192. aa = BN_CTX_get(ctx);
193. val[0] = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:192:10: Call
190.
191. BN_CTX_start(ctx);
192. aa = BN_CTX_get(ctx);
^
193. val[0] = BN_CTX_get(ctx);
194. if (val[0] == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:193:14: Call
191. BN_CTX_start(ctx);
192. aa = BN_CTX_get(ctx);
193. val[0] = BN_CTX_get(ctx);
^
194. if (val[0] == NULL)
195. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:210:10: Call
208. }
209.
210. if (!BN_nnmod(val[0], a, m, ctx))
^
211. goto err; /* 1 */
212. if (BN_is_zero(val[0])) {
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_exp.c:220:14: Call
218. window = BN_window_bits_for_exponent_size(bits);
219. if (window > 1) {
220. if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx))
^
221. goto err; /* 2 */
222. j = 1 << (window - 1);
crypto/bn/bn_recp.c:55:1: Parameter `ctx->stack.depth`
53. }
54.
55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
56. BN_RECP_CTX *recp, BN_CTX *ctx)
57. {
crypto/bn/bn_recp.c:62:5: Call
60. const BIGNUM *ca;
61.
62. BN_CTX_start(ctx);
^
63. if ((a = BN_CTX_get(ctx)) == NULL)
64. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_recp.c:63:14: Call
61.
62. BN_CTX_start(ctx);
63. if ((a = BN_CTX_get(ctx)) == NULL)
^
64. goto err;
65. if (y != NULL) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_recp.c:77:11: Call
75. ca = x; /* Just do the mod */
76.
77. ret = BN_div_recp(NULL, r, ca, recp, ctx);
^
78. err:
79. BN_CTX_end(ctx);
crypto/bn/bn_recp.c:90:5: Call
88. BIGNUM *a, *b, *d, *r;
89.
90. BN_CTX_start(ctx);
^
91. d = (dv != NULL) ? dv : BN_CTX_get(ctx);
92. r = (rem != NULL) ? rem : 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_recp.c:101:13: Call
99. BN_zero(d);
100. if (!BN_copy(r, m)) {
101. BN_CTX_end(ctx);
^
102. return 0;
103. }
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_exp`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268 |
d2a_code_trace_data_42192 | void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
MPA_INT *window, int *dither_state,
OUT_INT *samples, int incr,
int32_t sb_samples[SBLIMIT])
{
int32_t tmp[32];
register MPA_INT *synth_buf;
register const MPA_INT *w, *w2, *p;
int j, offset, v;
OUT_INT *samples2;
#if FRAC_BITS <= 15
int sum, sum2;
#else
int64_t sum, sum2;
#endif
dct32(tmp, sb_samples);
offset = *synth_buf_offset;
synth_buf = synth_buf_ptr + offset;
for(j=0;j<32;j++) {
v = tmp[j];
#if FRAC_BITS <= 15
v = av_clip_int16(v);
#endif
synth_buf[j] = v;
}
memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT));
samples2 = samples + 31 * incr;
w = window;
w2 = window + 31;
sum = *dither_state;
p = synth_buf + 16;
SUM8(sum, +=, w, p);
p = synth_buf + 48;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
samples += incr;
w++;
for(j=1;j<16;j++) {
sum2 = 0;
p = synth_buf + 16 + j;
SUM8P2(sum, +=, sum2, -=, w, w2, p);
p = synth_buf + 48 - j;
SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
*samples = round_sample(&sum);
samples += incr;
sum += sum2;
*samples2 = round_sample(&sum);
samples2 -= incr;
w++;
w2--;
}
p = synth_buf + 32;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
*dither_state= sum;
offset = (offset - 32) & 511;
*synth_buf_offset = offset;
}
libavcodec/mpc.c:60: error: Buffer Overrun L2
Offset: [273+min(0, `c->synth_buf_offset[*]`), 288+max(511, `c->synth_buf_offset[*]`)] (⇐ [17+min(0, `c->synth_buf_offset[*]`), 32+max(511, `c->synth_buf_offset[*]`)] + 256) Size: 2 by call to `ff_mpa_synth_filter`.
libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]`
49. * Process decoded Musepack data and produce PCM
50. */
51. static void mpc_synth(MPCContext *c, int16_t *out)
^
52. {
53. int dither_state = 0;
libavcodec/mpc.c:60:13: Call
58. samples_ptr = samples + ch;
59. for(i = 0; i < SAMPLES_PER_BAND; i++) {
60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
^
61. mpa_window, &dither_state,
62. samples_ptr, 2,
libavcodec/mpegaudiodec.c:906:9: <Length trace>
904. /* we calculate two samples at the same time to avoid one memory
905. access per two sample */
906. for(j=1;j<16;j++) {
^
907. sum2 = 0;
908. p = synth_buf + 16 + j;
libavcodec/mpegaudiodec.c:906:9: Assignment
904. /* we calculate two samples at the same time to avoid one memory
905. access per two sample */
906. for(j=1;j<16;j++) {
^
907. sum2 = 0;
908. p = synth_buf + 16 + j;
libavcodec/mpegaudiodec.c:908:9: Assignment
906. for(j=1;j<16;j++) {
907. sum2 = 0;
908. p = synth_buf + 16 + j;
^
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
910. p = synth_buf + 48 - j;
libavcodec/mpegaudiodec.c:909:9: Array access: Offset: [273+min(0, c->synth_buf_offset[*]), 288+max(511, c->synth_buf_offset[*])] (⇐ [17+min(0, c->synth_buf_offset[*]), 32+max(511, c->synth_buf_offset[*])] + 256) Size: 2 by call to `ff_mpa_synth_filter`
907. sum2 = 0;
908. p = synth_buf + 16 + j;
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
^
910. p = synth_buf + 48 - j;
911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L909 |
d2a_code_trace_data_42193 | static int tls_process_cke_rsa(SSL *s, PACKET *pkt)
{
#ifndef OPENSSL_NO_RSA
unsigned char rand_premaster_secret[SSL_MAX_MASTER_KEY_LENGTH];
int decrypt_len;
unsigned char decrypt_good, version_good;
size_t j, padding_len;
PACKET enc_premaster;
RSA *rsa = NULL;
unsigned char *rsa_decrypt = NULL;
int ret = 0;
rsa = EVP_PKEY_get0_RSA(s->cert->pkeys[SSL_PKEY_RSA].privatekey);
if (rsa == NULL) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
SSL_R_MISSING_RSA_CERTIFICATE);
return 0;
}
if (s->version == SSL3_VERSION || s->version == DTLS1_BAD_VER) {
enc_premaster = *pkt;
} else {
if (!PACKET_get_length_prefixed_2(pkt, &enc_premaster)
|| PACKET_remaining(pkt) != 0) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
SSL_R_LENGTH_MISMATCH);
return 0;
}
}
if (RSA_size(rsa) < SSL_MAX_MASTER_KEY_LENGTH) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
RSA_R_KEY_SIZE_TOO_SMALL);
return 0;
}
rsa_decrypt = OPENSSL_malloc(RSA_size(rsa));
if (rsa_decrypt == NULL) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
ERR_R_MALLOC_FAILURE);
return 0;
}
if (ssl_randbytes(s, rand_premaster_secret,
sizeof(rand_premaster_secret)) <= 0) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
ERR_R_INTERNAL_ERROR);
goto err;
}
decrypt_len = (int)RSA_private_decrypt((int)PACKET_remaining(&enc_premaster),
PACKET_data(&enc_premaster),
rsa_decrypt, rsa, RSA_NO_PADDING);
if (decrypt_len < 0) {
SSLfatal(s, SSL_AD_DECRYPT_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
ERR_R_INTERNAL_ERROR);
goto err;
}
if (decrypt_len < 11 + SSL_MAX_MASTER_KEY_LENGTH) {
SSLfatal(s, SSL_AD_DECRYPT_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
SSL_R_DECRYPTION_FAILED);
goto err;
}
padding_len = decrypt_len - SSL_MAX_MASTER_KEY_LENGTH;
decrypt_good = constant_time_eq_int_8(rsa_decrypt[0], 0) &
constant_time_eq_int_8(rsa_decrypt[1], 2);
for (j = 2; j < padding_len - 1; j++) {
decrypt_good &= ~constant_time_is_zero_8(rsa_decrypt[j]);
}
decrypt_good &= constant_time_is_zero_8(rsa_decrypt[padding_len - 1]);
version_good =
constant_time_eq_8(rsa_decrypt[padding_len],
(unsigned)(s->client_version >> 8));
version_good &=
constant_time_eq_8(rsa_decrypt[padding_len + 1],
(unsigned)(s->client_version & 0xff));
if (s->options & SSL_OP_TLS_ROLLBACK_BUG) {
unsigned char workaround_good;
workaround_good = constant_time_eq_8(rsa_decrypt[padding_len],
(unsigned)(s->version >> 8));
workaround_good &=
constant_time_eq_8(rsa_decrypt[padding_len + 1],
(unsigned)(s->version & 0xff));
version_good |= workaround_good;
}
decrypt_good &= version_good;
for (j = 0; j < sizeof(rand_premaster_secret); j++) {
rsa_decrypt[padding_len + j] =
constant_time_select_8(decrypt_good,
rsa_decrypt[padding_len + j],
rand_premaster_secret[j]);
}
if (!ssl_generate_master_secret(s, rsa_decrypt + padding_len,
sizeof(rand_premaster_secret), 0)) {
goto err;
}
ret = 1;
err:
OPENSSL_free(rsa_decrypt);
return ret;
#else
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
ERR_R_INTERNAL_ERROR);
return 0;
#endif
}
ssl/statem/statem_srvr.c:2858: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, +oo].
Showing all 11 steps of the trace
ssl/statem/statem_srvr.c:2857:10: <Offset trace>
2855. decrypt_good = constant_time_eq_int_8(rsa_decrypt[0], 0) &
2856. constant_time_eq_int_8(rsa_decrypt[1], 2);
2857. for (j = 2; j < padding_len - 1; j++) {
^
2858. decrypt_good &= ~constant_time_is_zero_8(rsa_decrypt[j]);
2859. }
ssl/statem/statem_srvr.c:2857:10: Assignment
2855. decrypt_good = constant_time_eq_int_8(rsa_decrypt[0], 0) &
2856. constant_time_eq_int_8(rsa_decrypt[1], 2);
2857. for (j = 2; j < padding_len - 1; j++) {
^
2858. decrypt_good &= ~constant_time_is_zero_8(rsa_decrypt[j]);
2859. }
ssl/statem/statem_srvr.c:2805:19: <Length trace>
2803. }
2804.
2805. rsa_decrypt = OPENSSL_malloc(RSA_size(rsa));
^
2806. if (rsa_decrypt == NULL) {
2807. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
ssl/statem/statem_srvr.c:2805:19: Call
2803. }
2804.
2805. rsa_decrypt = OPENSSL_malloc(RSA_size(rsa));
^
2806. if (rsa_decrypt == NULL) {
2807. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
crypto/rsa/rsa_crpt.c:24:12: Call
22. int RSA_size(const RSA *r)
23. {
24. return BN_num_bytes(r->n);
^
25. }
26.
crypto/bn/bn_lib.c:167:9: Assignment
165.
166. if (BN_is_zero(a))
167. return 0;
^
168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
169. }
crypto/rsa/rsa_crpt.c:24:5: Assignment
22. int RSA_size(const RSA *r)
23. {
24. return BN_num_bytes(r->n);
^
25. }
26.
ssl/statem/statem_srvr.c:2805:19: Call
2803. }
2804.
2805. rsa_decrypt = OPENSSL_malloc(RSA_size(rsa));
^
2806. if (rsa_decrypt == NULL) {
2807. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
crypto/mem.c:198:9: Assignment
196.
197. if (num == 0)
198. return NULL;
^
199.
200. FAILTEST();
ssl/statem/statem_srvr.c:2805:5: Assignment
2803. }
2804.
2805. rsa_decrypt = OPENSSL_malloc(RSA_size(rsa));
^
2806. if (rsa_decrypt == NULL) {
2807. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA,
ssl/statem/statem_srvr.c:2858:50: Array access: Offset: [2, +oo] Size: [1, +oo]
2856. constant_time_eq_int_8(rsa_decrypt[1], 2);
2857. for (j = 2; j < padding_len - 1; j++) {
2858. decrypt_good &= ~constant_time_is_zero_8(rsa_decrypt[j]);
^
2859. }
2860. decrypt_good &= constant_time_is_zero_8(rsa_decrypt[padding_len - 1]);
| https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/ssl/statem/statem_srvr.c/#L2858 |
d2a_code_trace_data_42194 | ssize_t
ngx_parse_size(ngx_str_t *line)
{
u_char unit;
size_t len;
ssize_t size;
ngx_int_t scale;
len = line->len;
unit = line->data[len - 1];
switch (unit) {
case 'K':
case 'k':
len--;
scale = 1024;
break;
case 'M':
case 'm':
len--;
scale = 1024 * 1024;
break;
default:
scale = 1;
}
size = ngx_atosz(line->data, len);
if (size == NGX_ERROR) {
return NGX_ERROR;
}
size *= scale;
return size;
}
src/http/modules/ngx_http_log_module.c:935: error: Buffer Overrun L3
Offset: [6, +oo] (⇐ 7 + [-1, +oo]) Size: [0, +oo] by call to `ngx_parse_size`.
src/http/modules/ngx_http_log_module.c:857:9: Call
855. ngx_memzero(log, sizeof(ngx_http_log_t));
856.
857. n = ngx_http_script_variables_count(&value[1]);
^
858.
859. if (n == 0) {
src/http/ngx_http_script.c:214:1: Parameter `value->len`
212.
213.
214. ngx_uint_t
^
215. ngx_http_script_variables_count(ngx_str_t *value)
216. {
src/http/modules/ngx_http_log_module.c:932:9: Assignment
930. }
931.
932. name.len = value[3].len - 7;
^
933. name.data = value[3].data + 7;
934.
src/http/modules/ngx_http_log_module.c:935:15: Call
933. name.data = value[3].data + 7;
934.
935. buf = ngx_parse_size(&name);
^
936.
937. if (buf == NGX_ERROR) {
src/core/ngx_parse.c:11:1: <Offset trace>
9.
10.
11. ssize_t
^
12. ngx_parse_size(ngx_str_t *line)
13. {
src/core/ngx_parse.c:11:1: Parameter `line->len`
9.
10.
11. ssize_t
^
12. ngx_parse_size(ngx_str_t *line)
13. {
src/core/ngx_parse.c:19:5: Assignment
17. ngx_int_t scale;
18.
19. len = line->len;
^
20. unit = line->data[len - 1];
21.
src/core/ngx_parse.c:11:1: <Length trace>
9.
10.
11. ssize_t
^
12. ngx_parse_size(ngx_str_t *line)
13. {
src/core/ngx_parse.c:11:1: Parameter `*line->data`
9.
10.
11. ssize_t
^
12. ngx_parse_size(ngx_str_t *line)
13. {
src/core/ngx_parse.c:20:12: Array access: Offset: [6, +oo] (⇐ 7 + [-1, +oo]) Size: [0, +oo] by call to `ngx_parse_size`
18.
19. len = line->len;
20. unit = line->data[len - 1];
^
21.
22. switch (unit) {
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_parse.c/#L20 |
d2a_code_trace_data_42195 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:387: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 21 steps of the trace
crypto/ec/ecdsa_ossl.c:337:5: Call
335. return -1;
336. }
337. BN_CTX_start(ctx);
^
338. u1 = BN_CTX_get(ctx);
339. u2 = 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/ec/ecdsa_ossl.c:387:10: Call
385. }
386. /* u2 = r * w mod q */
387. if (!BN_mod_mul(u2, sig->r, u2, order, ctx)) {
^
388. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
389. goto err;
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:210:14: Call
208. goto err;
209. } else {
210. if (!BN_mul(t, a, b, ctx))
^
211. goto err;
212. }
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
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_42196 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
int i, nw, lb, rb;
BN_ULONG *t, *f;
BN_ULONG l;
bn_check_top(r);
bn_check_top(a);
if (n < 0) {
BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
return 0;
}
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return 0;
r->neg = a->neg;
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return 1;
}
crypto/sm2/sm2_crypt.c:176: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_mul`.
Showing all 31 steps of the trace
crypto/sm2/sm2_crypt.c:171:10: Call
169. memset(ciphertext_buf, 0, *ciphertext_len);
170.
171. if (!BN_priv_rand_range(k, order)) {
^
172. SM2err(SM2_F_SM2_ENCRYPT, ERR_R_INTERNAL_ERROR);
173. goto done;
crypto/bn/bn_rand.c:182:1: Parameter `range->top`
180. }
181.
182. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
crypto/bn/bn_rand.c:184:12: Call
182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
^
185. }
186.
crypto/bn/bn_rand.c:113:1: Parameter `range->top`
111.
112. /* random number r: 0 <= r < range */
113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
114. {
115. int n;
crypto/sm2/sm2_crypt.c:176:10: Call
174. }
175.
176. if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx)
^
177. || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, y1, ctx)
178. || !EC_POINT_mul(group, kP, NULL, P, k, ctx)
crypto/ec/ec_lib.c:929:1: Parameter `group->order->top`
927. }
928.
929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx)
931. {
crypto/ec/ec_lib.c:940:12: Call
938. scalars[0] = p_scalar;
939.
940. return EC_POINTs_mul(group, r, g_scalar,
^
941. (point != NULL
942. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:918:1: Parameter `group->order->top`
916. */
917.
918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
919. size_t num, const EC_POINT *points[],
920. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:924:16: Call
922. if (group->meth->mul == 0)
923. /* use default */
924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
925.
926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
crypto/ec/ec_mult.c:342:1: Parameter `group->order->top`
340. * in the addition if scalar != NULL
341. */
342. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
343. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
344. BN_CTX *ctx)
crypto/ec/ec_mult.c:393:16: Call
391. * constant time version.
392. */
393. return ec_mul_consttime(group, r, scalar, NULL, ctx);
^
394. }
395. if ((scalar == NULL) && (num == 1)) {
crypto/ec/ec_mult.c:131:1: Parameter `group->order->top`
129. * Returns 1 on success, 0 otherwise.
130. */
131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r,
132. const BIGNUM *scalar, const EC_POINT *point,
133. BN_CTX *ctx)
crypto/ec/ec_mult.c:147:18: Call
145. BN_CTX_start(ctx);
146.
147. order_bits = BN_num_bits(group->order);
^
148.
149. s = EC_POINT_new(group);
crypto/bn/bn_lib.c:139:9: Call
137. bn_check_top(a);
138.
139. if (BN_is_zero(a))
^
140. return 0;
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/ec/ec_mult.c:189:14: Call
187. * constant-timeness
188. */
189. if (!BN_nnmod(k, k, group->order, ctx))
^
190. goto err;
191. }
crypto/bn/bn_mod.c:13:1: Parameter `d->top`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:199:31: Call
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_lib.c:140:9: Assignment
138.
139. if (BN_is_zero(a))
140. return 0;
^
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
142. }
crypto/bn/bn_div.c:199:5: Assignment
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_div.c:200:11: Call
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
201. goto err;
202. sdiv->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return 0;
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return 0;
100. r->neg = a->neg;
crypto/bn/bn_lib.c:941:1: Parameter `*a->d`
939. }
940.
941. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:104:5: Assignment
102. rb = BN_BITS2 - lb;
103. f = a->d;
104. t = r->d;
^
105. t[a->top + nw] = 0;
106. if (lb == 0)
crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_mul`
110. for (i = a->top - 1; i >= 0; i--) {
111. l = f[i];
112. t[nw + i + 1] |= (l >> rb) & BN_MASK2;
^
113. t[nw + i] = (l << lb) & BN_MASK2;
114. }
| https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_shift.c/#L112 |
d2a_code_trace_data_42197 | int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
BN_CTX *ctx)
{
BIGNUM *t;
int ret = 0;
bn_check_top(a);
bn_check_top(b);
bn_check_top(m);
BN_CTX_start(ctx);
if ((t = BN_CTX_get(ctx)) == NULL)
goto err;
if (a == b) {
if (!BN_sqr(t, a, ctx))
goto err;
} else {
if (!BN_mul(t, a, b, ctx))
goto err;
}
if (!BN_nnmod(r, t, m, ctx))
goto err;
bn_check_top(r);
ret = 1;
err:
BN_CTX_end(ctx);
return (ret);
}
crypto/bn/bn_mod.c:196: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_CTX_start()` at line 189, column 5 is not reachable after line 196, column 14.
Showing all 57 steps of the trace
crypto/bn/bn_mod.c:179:1: start of procedure BN_mod_mul()
177.
178. /* slow but works */
179. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
180. BN_CTX *ctx)
181. {
crypto/bn/bn_mod.c:183:5:
181. {
182. BIGNUM *t;
183. > int ret = 0;
184.
185. bn_check_top(a);
crypto/bn/bn_mod.c:189:5:
187. bn_check_top(m);
188.
189. > BN_CTX_start(ctx);
190. if ((t = BN_CTX_get(ctx)) == NULL)
191. goto err;
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 true
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 true 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:317:13:
315. return 0;
316. if (st->depth)
317. > memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
318. OPENSSL_free(st->indexes);
319. st->indexes = newitems;
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/bn/bn_mod.c:190:9:
188.
189. BN_CTX_start(ctx);
190. > if ((t = BN_CTX_get(ctx)) == NULL)
191. goto err;
192. if (a == b) {
crypto/bn/bn_ctx.c:267:1: start of procedure BN_CTX_get()
265. }
266.
267. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
268. {
269. BIGNUM *ret;
crypto/bn/bn_ctx.c:272:9: Taking false branch
270.
271. CTXDBG_ENTRY("BN_CTX_get", ctx);
272. if (ctx->err_stack || ctx->too_many)
^
273. return NULL;
274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
crypto/bn/bn_ctx.c:272:27: Taking false branch
270.
271. CTXDBG_ENTRY("BN_CTX_get", ctx);
272. if (ctx->err_stack || ctx->too_many)
^
273. return NULL;
274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
crypto/bn/bn_ctx.c:274:9: Taking false branch
272. if (ctx->err_stack || ctx->too_many)
273. return NULL;
274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
^
275. /*
276. * Setting too_many prevents repeated "get" attempts from cluttering
crypto/bn/bn_ctx.c:284:5:
282. }
283. /* OK, make sure the returned bignum is "zero" */
284. > BN_zero(ret);
285. ctx->used++;
286. CTXDBG_RET(ctx, ret);
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)
crypto/bn/bn_ctx.c:285:5:
283. /* OK, make sure the returned bignum is "zero" */
284. BN_zero(ret);
285. > ctx->used++;
286. CTXDBG_RET(ctx, ret);
287. return ret;
crypto/bn/bn_ctx.c:287:5:
285. ctx->used++;
286. CTXDBG_RET(ctx, ret);
287. > return ret;
288. }
289.
crypto/bn/bn_ctx.c:288:1: return from a call to BN_CTX_get
286. CTXDBG_RET(ctx, ret);
287. return ret;
288. > }
289.
290. /************/
crypto/bn/bn_mod.c:190:9: Taking false branch
188.
189. BN_CTX_start(ctx);
190. if ((t = BN_CTX_get(ctx)) == NULL)
^
191. goto err;
192. if (a == b) {
crypto/bn/bn_mod.c:192:9: Taking false branch
190. if ((t = BN_CTX_get(ctx)) == NULL)
191. goto err;
192. if (a == b) {
^
193. if (!BN_sqr(t, a, ctx))
194. goto err;
crypto/bn/bn_mod.c:196:14: Skipping BN_mul(): empty list of specs
194. goto err;
195. } else {
196. if (!BN_mul(t, a, b, ctx))
^
197. goto err;
198. }
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/bn/bn_mod.c/#L196 |
d2a_code_trace_data_42198 | static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
bc->bits >>= n;
#else
uint64_t ret = bc->bits >> (64 - n);
bc->bits <<= n;
#endif
bc->bits_left -= n;
return ret;
}
libavcodec/mpc8.c:136: error: Integer Overflow L2
([1, +oo] - 3):unsigned32 by call to `bitstream_read`.
libavcodec/mpc8.c:136:23: Call
134. }
135. c->MSS = bitstream_read_bit(&bc);
136. c->frames = 1 << (bitstream_read(&bc, 3) * 2);
^
137.
138. avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 3):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
| https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139 |
d2a_code_trace_data_42199 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ecdsa/ecs_ossl.c:434: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`.
Showing all 26 steps of the trace
crypto/ecdsa/ecs_ossl.c:404:7: Call
402. }
403. /* calculate tmp1 = inv(S) mod order */
404. if (!BN_mod_inverse(u2, sig->s, order, ctx))
^
405. {
406. ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_BN_LIB);
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:224:2: Call
222. bn_check_top(n);
223.
224. BN_CTX_start(ctx);
^
225. A = BN_CTX_get(ctx);
226. 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:498:2: Call
496. err:
497. if ((ret == NULL) && (in == NULL)) BN_free(R);
498. BN_CTX_end(ctx);
^
499. bn_check_top(ret);
500. return(ret);
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/ecdsa/ecs_ossl.c:428:7: Call
426. }
427. /* u1 = m * tmp mod order */
428. if (!BN_mod_mul(u1, m, u2, order, ctx))
^
429. {
430. ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_BN_LIB);
crypto/bn/bn_mod.c:178:1: Parameter `ctx->stack.depth`
176.
177. /* slow but works */
178. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
179. BN_CTX *ctx)
180. {
crypto/bn/bn_mod.c:188:2: Call
186. bn_check_top(m);
187.
188. BN_CTX_start(ctx);
^
189. if ((t = BN_CTX_get(ctx)) == NULL) goto err;
190. if (a == b)
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_mod.c:198:2: Call
196. ret=1;
197. err:
198. BN_CTX_end(ctx);
^
199. return(ret);
200. }
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/ecdsa/ecs_ossl.c:434:7: Call
432. }
433. /* u2 = r * w mod q */
434. if (!BN_mod_mul(u2, sig->r, u2, order, ctx))
^
435. {
436. ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_BN_LIB);
crypto/bn/bn_mod.c:178:1: Parameter `ctx->stack.depth`
176.
177. /* slow but works */
178. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
179. BN_CTX *ctx)
180. {
crypto/bn/bn_mod.c:188:2: Call
186. bn_check_top(m);
187.
188. BN_CTX_start(ctx);
^
189. if ((t = BN_CTX_get(ctx)) == NULL) goto err;
190. if (a == b)
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_mod.c:193:10: Call
191. { if (!BN_sqr(t,a,ctx)) goto err; }
192. else
193. { if (!BN_mul(t,a,b,ctx)) goto err; }
^
194. if (!BN_nnmod(r,t,m,ctx)) goto err;
195. bn_check_top(r);
crypto/bn/bn_mul.c:943:1: Parameter `ctx->stack.depth`
941. #endif /* BN_RECURSION */
942.
943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
944. {
945. int ret=0;
crypto/bn/bn_mul.c:974:2: Call
972. top=al+bl;
973.
974. BN_CTX_start(ctx);
^
975. if ((r == a) || (r == b))
976. {
crypto/bn/bn_ctx.c: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_mul.c:1100:2: Call
1098. err:
1099. bn_check_top(r);
1100. BN_CTX_end(ctx);
^
1101. return(ret);
1102. }
crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth`
268. }
269.
270. > void BN_CTX_end(BN_CTX *ctx)
271. {
272. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:277:21: Call
275. else
276. {
277. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
278. /* Does this stack frame have anything to release? */
279. if(fp < ctx->used)
crypto/bn/bn_ctx.c:351:1: <LHS trace>
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:351:1: Parameter `st->depth`
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`
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_42200 | static int internal_verify(X509_STORE_CTX *ctx)
{
int ok=0,n;
X509 *xs,*xi;
EVP_PKEY *pkey=NULL;
int (*cb)(int xok,X509_STORE_CTX *xctx);
cb=ctx->verify_cb;
n=sk_X509_num(ctx->chain);
ctx->error_depth=n-1;
n--;
xi=sk_X509_value(ctx->chain,n);
if (ctx->check_issued(ctx, xi, xi))
xs=xi;
else
{
if (n <= 0)
{
ctx->error=X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
ctx->current_cert=xi;
ok=cb(0,ctx);
goto end;
}
else
{
n--;
ctx->error_depth=n;
xs=sk_X509_value(ctx->chain,n);
}
}
while (n >= 0)
{
ctx->error_depth=n;
if (!xs->valid && (xs != xi || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE)))
{
if ((pkey=X509_get_pubkey(xi)) == NULL)
{
ctx->error=X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY;
ctx->current_cert=xi;
ok=(*cb)(0,ctx);
if (!ok) goto end;
}
else if (X509_verify(xs,pkey) <= 0)
{
ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE;
ctx->current_cert=xs;
ok=(*cb)(0,ctx);
if (!ok)
{
EVP_PKEY_free(pkey);
goto end;
}
}
EVP_PKEY_free(pkey);
pkey=NULL;
}
xs->valid = 1;
ok = check_cert_time(ctx, xs);
if (!ok)
goto end;
ctx->current_issuer=xi;
ctx->current_cert=xs;
ok=(*cb)(1,ctx);
if (!ok) goto end;
n--;
if (n >= 0)
{
xi=xs;
xs=sk_X509_value(ctx->chain,n);
}
}
ok=1;
end:
return ok;
}
crypto/x509/x509_vfy.c:1665: error: NULL_DEREFERENCE
pointer `xs` last assigned on line 1652 could be null and is dereferenced at line 1665, column 8.
Showing all 35 steps of the trace
crypto/x509/x509_vfy.c:1623:1: start of procedure internal_verify()
1621. }
1622.
1623. > static int internal_verify(X509_STORE_CTX *ctx)
1624. {
1625. int ok=0,n;
crypto/x509/x509_vfy.c:1625:2:
1623. static int internal_verify(X509_STORE_CTX *ctx)
1624. {
1625. > int ok=0,n;
1626. X509 *xs,*xi;
1627. EVP_PKEY *pkey=NULL;
crypto/x509/x509_vfy.c:1627:2:
1625. int ok=0,n;
1626. X509 *xs,*xi;
1627. > EVP_PKEY *pkey=NULL;
1628. int (*cb)(int xok,X509_STORE_CTX *xctx);
1629.
crypto/x509/x509_vfy.c:1630:2:
1628. int (*cb)(int xok,X509_STORE_CTX *xctx);
1629.
1630. > cb=ctx->verify_cb;
1631.
1632. n=sk_X509_num(ctx->chain);
crypto/x509/x509_vfy.c:1632:4: Condition is true
1630. cb=ctx->verify_cb;
1631.
1632. n=sk_X509_num(ctx->chain);
^
1633. ctx->error_depth=n-1;
1634. n--;
crypto/x509/x509_vfy.c:1632:2:
1630. cb=ctx->verify_cb;
1631.
1632. > n=sk_X509_num(ctx->chain);
1633. ctx->error_depth=n-1;
1634. n--;
crypto/stack/stack.c:294:1: start of procedure sk_num()
292. }
293.
294. > int sk_num(const _STACK *st)
295. {
296. if(st == NULL) return -1;
crypto/stack/stack.c:296:5: Taking false branch
294. int sk_num(const _STACK *st)
295. {
296. if(st == NULL) return -1;
^
297. return st->num;
298. }
crypto/stack/stack.c:297:2:
295. {
296. if(st == NULL) return -1;
297. > return st->num;
298. }
299.
crypto/stack/stack.c:298:1: return from a call to sk_num
296. if(st == NULL) return -1;
297. return st->num;
298. > }
299.
300. void *sk_value(const _STACK *st, int i)
crypto/x509/x509_vfy.c:1633:2:
1631.
1632. n=sk_X509_num(ctx->chain);
1633. > ctx->error_depth=n-1;
1634. n--;
1635. xi=sk_X509_value(ctx->chain,n);
crypto/x509/x509_vfy.c:1634:2:
1632. n=sk_X509_num(ctx->chain);
1633. ctx->error_depth=n-1;
1634. > n--;
1635. xi=sk_X509_value(ctx->chain,n);
1636.
crypto/x509/x509_vfy.c:1635:5: Condition is true
1633. ctx->error_depth=n-1;
1634. n--;
1635. xi=sk_X509_value(ctx->chain,n);
^
1636.
1637. if (ctx->check_issued(ctx, xi, xi))
crypto/x509/x509_vfy.c:1635:2:
1633. ctx->error_depth=n-1;
1634. n--;
1635. > xi=sk_X509_value(ctx->chain,n);
1636.
1637. if (ctx->check_issued(ctx, xi, xi))
crypto/stack/stack.c:300:1: start of procedure sk_value()
298. }
299.
300. > void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
crypto/stack/stack.c:302:6: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:13: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:24: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:303:2:
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. > return st->data[i];
304. }
305.
crypto/stack/stack.c:304:1: return from a call to sk_value
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. > }
305.
306. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:1637:6: Taking false branch
1635. xi=sk_X509_value(ctx->chain,n);
1636.
1637. if (ctx->check_issued(ctx, xi, xi))
^
1638. xs=xi;
1639. else
crypto/x509/x509_vfy.c:1641:7: Taking false branch
1639. else
1640. {
1641. if (n <= 0)
^
1642. {
1643. ctx->error=X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
crypto/x509/x509_vfy.c:1650:4:
1648. else
1649. {
1650. > n--;
1651. ctx->error_depth=n;
1652. xs=sk_X509_value(ctx->chain,n);
crypto/x509/x509_vfy.c:1651:4:
1649. {
1650. n--;
1651. > ctx->error_depth=n;
1652. xs=sk_X509_value(ctx->chain,n);
1653. }
crypto/x509/x509_vfy.c:1652:7: Condition is true
1650. n--;
1651. ctx->error_depth=n;
1652. xs=sk_X509_value(ctx->chain,n);
^
1653. }
1654. }
crypto/x509/x509_vfy.c:1652:4:
1650. n--;
1651. ctx->error_depth=n;
1652. > xs=sk_X509_value(ctx->chain,n);
1653. }
1654. }
crypto/stack/stack.c:300:1: start of procedure sk_value()
298. }
299.
300. > void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
crypto/stack/stack.c:302:6: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:13: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:24: Taking true branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:39:
300. void *sk_value(const _STACK *st, int i)
301. {
302. > if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. }
crypto/stack/stack.c:304:1: return from a call to sk_value
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. > }
305.
306. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:1657:9: Loop condition is true. Entering loop body
1655.
1656. /* ctx->error=0; not needed */
1657. while (n >= 0)
^
1658. {
1659. ctx->error_depth=n;
crypto/x509/x509_vfy.c:1659:3:
1657. while (n >= 0)
1658. {
1659. > ctx->error_depth=n;
1660.
1661. /* Skip signature check for self signed certificates unless
crypto/x509/x509_vfy.c:1665:8: Taking false branch
1663. * just wastes time.
1664. */
1665. if (!xs->valid && (xs != xi || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE)))
^
1666. {
1667. if ((pkey=X509_get_pubkey(xi)) == NULL)
| https://github.com/openssl/openssl/blob/bbb19418e672007590c65a12aa24e1b59927b2cc/crypto/x509/x509_vfy.c/#L1665 |
d2a_code_trace_data_42201 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_x931p.c:240: 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_x931p.c:222:5: Call
220. int ret = 0;
221.
222. BN_CTX_start(ctx);
^
223. if (Xp1 == NULL)
224. Xp1 = 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_x931p.c:240:5: Call
238.
239. error:
240. BN_CTX_end(ctx);
^
241.
242. return ret;
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268 |
d2a_code_trace_data_42202 | int RAND_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->bytes != NULL)
return meth->bytes(buf, num);
RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
return -1;
}
crypto/rand/rand_lib.c:146: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 144 could be null and is dereferenced at line 146, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:142:1: start of procedure RAND_bytes()
140. }
141.
142. > int RAND_bytes(unsigned char *buf, int num)
143. {
144. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:144:5:
142. int RAND_bytes(unsigned char *buf, int num)
143. {
144. > const RAND_METHOD *meth = RAND_get_rand_method();
145.
146. if (meth->bytes != NULL)
crypto/rand/rand_lib.c:70:1: start of procedure RAND_get_rand_method()
68. }
69.
70. > const RAND_METHOD *RAND_get_rand_method(void)
71. {
72. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:72:5:
70. const RAND_METHOD *RAND_get_rand_method(void)
71. {
72. > const RAND_METHOD *tmp_meth = NULL;
73.
74. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:74:10:
72. const RAND_METHOD *tmp_meth = NULL;
73.
74. > if (!RUN_ONCE(&rand_init, do_rand_init))
75. return NULL;
76.
crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
103. }
104.
105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:107:9: Taking true branch
105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
^
108. return 0;
109.
crypto/threads_pthread.c:108:9:
106. {
107. if (pthread_once(once, init) != 0)
108. > return 0;
109.
110. return 1;
crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
109.
110. return 1;
111. > }
112.
113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:74:10: Condition is false
72. const RAND_METHOD *tmp_meth = NULL;
73.
74. if (!RUN_ONCE(&rand_init, do_rand_init))
^
75. return NULL;
76.
crypto/rand/rand_lib.c:74:10: Taking true branch
72. const RAND_METHOD *tmp_meth = NULL;
73.
74. if (!RUN_ONCE(&rand_init, do_rand_init))
^
75. return NULL;
76.
crypto/rand/rand_lib.c:75:9:
73.
74. if (!RUN_ONCE(&rand_init, do_rand_init))
75. > return NULL;
76.
77. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:98:1: return from a call to RAND_get_rand_method
96. CRYPTO_THREAD_unlock(rand_meth_lock);
97. return tmp_meth;
98. > }
99.
100. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:146:9:
144. const RAND_METHOD *meth = RAND_get_rand_method();
145.
146. > if (meth->bytes != NULL)
147. return meth->bytes(buf, num);
148. RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
| https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/rand_lib.c/#L146 |
d2a_code_trace_data_42203 | static const u_char *
ngx_sha1_body(ngx_sha1_t *ctx, const u_char *data, size_t size)
{
uint32_t a, b, c, d, e, temp;
uint32_t saved_a, saved_b, saved_c, saved_d, saved_e;
uint32_t words[80];
ngx_uint_t i;
const u_char *p;
p = data;
a = ctx->a;
b = ctx->b;
c = ctx->c;
d = ctx->d;
e = ctx->e;
do {
saved_a = a;
saved_b = b;
saved_c = c;
saved_d = d;
saved_e = e;
for (i = 0; i < 16; i++) {
words[i] = GET(i);
}
for (i = 16; i < 80; i++) {
words[i] = ROTATE(1, words[i - 3] ^ words[i - 8] ^ words[i - 14]
^ words[i - 16]);
}
STEP(F1, a, b, c, d, e, words[0], 0x5a827999);
STEP(F1, a, b, c, d, e, words[1], 0x5a827999);
STEP(F1, a, b, c, d, e, words[2], 0x5a827999);
STEP(F1, a, b, c, d, e, words[3], 0x5a827999);
STEP(F1, a, b, c, d, e, words[4], 0x5a827999);
STEP(F1, a, b, c, d, e, words[5], 0x5a827999);
STEP(F1, a, b, c, d, e, words[6], 0x5a827999);
STEP(F1, a, b, c, d, e, words[7], 0x5a827999);
STEP(F1, a, b, c, d, e, words[8], 0x5a827999);
STEP(F1, a, b, c, d, e, words[9], 0x5a827999);
STEP(F1, a, b, c, d, e, words[10], 0x5a827999);
STEP(F1, a, b, c, d, e, words[11], 0x5a827999);
STEP(F1, a, b, c, d, e, words[12], 0x5a827999);
STEP(F1, a, b, c, d, e, words[13], 0x5a827999);
STEP(F1, a, b, c, d, e, words[14], 0x5a827999);
STEP(F1, a, b, c, d, e, words[15], 0x5a827999);
STEP(F1, a, b, c, d, e, words[16], 0x5a827999);
STEP(F1, a, b, c, d, e, words[17], 0x5a827999);
STEP(F1, a, b, c, d, e, words[18], 0x5a827999);
STEP(F1, a, b, c, d, e, words[19], 0x5a827999);
STEP(F2, a, b, c, d, e, words[20], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[21], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[22], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[23], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[24], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[25], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[26], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[27], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[28], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[29], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[30], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[31], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[32], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[33], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[34], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[35], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[36], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[37], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[38], 0x6ed9eba1);
STEP(F2, a, b, c, d, e, words[39], 0x6ed9eba1);
STEP(F3, a, b, c, d, e, words[40], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[41], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[42], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[43], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[44], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[45], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[46], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[47], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[48], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[49], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[50], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[51], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[52], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[53], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[54], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[55], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[56], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[57], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[58], 0x8f1bbcdc);
STEP(F3, a, b, c, d, e, words[59], 0x8f1bbcdc);
STEP(F2, a, b, c, d, e, words[60], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[61], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[62], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[63], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[64], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[65], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[66], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[67], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[68], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[69], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[70], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[71], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[72], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[73], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[74], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[75], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[76], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[77], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[78], 0xca62c1d6);
STEP(F2, a, b, c, d, e, words[79], 0xca62c1d6);
a += saved_a;
b += saved_b;
c += saved_c;
d += saved_d;
e += saved_e;
p += 64;
} while (size -= 64);
ctx->a = a;
ctx->b = b;
ctx->c = c;
ctx->d = d;
ctx->e = e;
return p;
}
src/core/ngx_sha1.c:275: error: Uninitialized Value
The value read from words[_] was never initialized.
src/core/ngx_sha1.c:275:9:
273. STEP(F2, a, b, c, d, e, words[77], 0xca62c1d6);
274. STEP(F2, a, b, c, d, e, words[78], 0xca62c1d6);
275. STEP(F2, a, b, c, d, e, words[79], 0xca62c1d6);
^
276.
277. a += saved_a;
| https://github.com/nginx/nginx/blob/70f7141074896fb1ff3e5fc08407ea0f64f2076b/src/core/ngx_sha1.c/#L275 |
d2a_code_trace_data_42204 | static void vp6_parse_coeff(vp56_context_t *s)
{
vp56_range_coder_t *c = s->ccp;
vp56_model_t *model = s->modelp;
uint8_t *permute = s->scantable.permutated;
uint8_t *model1, *model2, *model3;
int coeff, sign, coeff_idx;
int b, i, cg, idx, ctx;
int pt = 0;
for (b=0; b<6; b++) {
int ct = 1;
int run = 1;
if (b > 3) pt = 1;
ctx = s->left_block[vp56_b6to4[b]].not_null_dc
+ s->above_blocks[s->above_block_idx[b]].not_null_dc;
model1 = model->coeff_dccv[pt];
model2 = model->coeff_dcct[pt][ctx];
for (coeff_idx=0; coeff_idx<64; ) {
if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
if (vp56_rac_get_prob(c, model2[2])) {
if (vp56_rac_get_prob(c, model2[3])) {
idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);
coeff = vp56_coeff_bias[idx+5];
for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
} else {
if (vp56_rac_get_prob(c, model2[4]))
coeff = 3 + vp56_rac_get_prob(c, model1[5]);
else
coeff = 2;
}
ct = 2;
} else {
ct = 1;
coeff = 1;
}
sign = vp56_rac_get(c);
coeff = (coeff ^ -sign) + sign;
if (coeff_idx)
coeff *= s->dequant_ac;
idx = model->coeff_index_to_pos[coeff_idx];
s->block_coeff[b][permute[idx]] = coeff;
run = 1;
} else {
ct = 0;
if (coeff_idx > 0) {
if (!vp56_rac_get_prob(c, model2[1]))
break;
model3 = model->coeff_runv[coeff_idx >= 6];
run = vp56_rac_get_tree(c, vp6_pcr_tree, model3);
if (!run)
for (run=9, i=0; i<6; i++)
run += vp56_rac_get_prob(c, model3[i+8]) << i;
}
}
cg = vp6_coeff_groups[coeff_idx+=run];
model1 = model2 = model->coeff_ract[pt][ct][cg];
}
s->left_block[vp56_b6to4[b]].not_null_dc =
s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];
}
}
libavcodec/vp6.c:437: error: Buffer Overrun L1
Offset: [5, +oo] (⇐ [0, +oo] + 5) Size: 2.
libavcodec/vp6.c:405:1: <Length trace>
403. }
404.
405. static void vp6_parse_coeff(vp56_context_t *s)
^
406. {
407. vp56_range_coder_t *c = s->ccp;
libavcodec/vp6.c:405:1: Parameter `s->modelp->coeff_dccv[*]`
403. }
404.
405. static void vp6_parse_coeff(vp56_context_t *s)
^
406. {
407. vp56_range_coder_t *c = s->ccp;
libavcodec/vp6.c:423:9: Assignment
421. ctx = s->left_block[vp56_b6to4[b]].not_null_dc
422. + s->above_blocks[s->above_block_idx[b]].not_null_dc;
423. model1 = model->coeff_dccv[pt];
^
424. model2 = model->coeff_dcct[pt][ctx];
425.
libavcodec/vp6.c:437:62: Array access: Offset: [5, +oo] (⇐ [0, +oo] + 5) Size: 2
435. } else {
436. if (vp56_rac_get_prob(c, model2[4]))
437. coeff = 3 + vp56_rac_get_prob(c, model1[5]);
^
438. else
439. coeff = 2;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp6.c/#L437 |
d2a_code_trace_data_42205 | void bn_correct_top(BIGNUM *a)
{
BN_ULONG *ftl;
int tmp_top = a->top;
if (tmp_top > 0) {
for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
ftl--;
if (*ftl != 0)
break;
}
a->top = tmp_top;
}
bn_pollute(a);
}
crypto/rsa/rsa_chk.c:66: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`.
Showing all 16 steps of the trace
crypto/rsa/rsa_chk.c:60:9: Call
58.
59. /* q prime? */
60. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) {
^
61. ret = 0;
62. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME);
crypto/bn/bn_prime.c:197:12: Call
195. BN_GENCB *cb)
196. {
197. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
198. }
199.
crypto/bn/bn_prime.c:285:13: Call
283. /* now 1 <= check < A */
284.
285. j = witness(check, A, A1, A1_odd, k, ctx, mont);
^
286. if (j == -1)
287. goto err;
crypto/bn/bn_prime.c:388:10: Call
386. BN_MONT_CTX *mont)
387. {
388. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
389. return -1;
390. if (BN_is_one(w))
crypto/bn/bn_exp.c:356:14: Call
354.
355. if (a->neg || BN_ucmp(a, m) >= 0) {
356. if (!BN_nnmod(val[0], a, m, ctx))
^
357. goto err;
358. aa = val[0];
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:140:1: Parameter `*dv->d`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/rsa/rsa_chk.c:66:10: Call
64.
65. /* n = p*q? */
66. if (!BN_mul(i, key->p, key->q, ctx)) {
^
67. ret = -1;
68. goto err;
crypto/bn/bn_mul.c:880:13: Assignment
878. if (bn_wexpand(rr, 16) == NULL)
879. goto err;
880. rr->top = 16;
^
881. bn_mul_comba8(rr->d, a->d, b->d);
882. goto end;
crypto/bn/bn_mul.c:973:5: Call
971. end:
972. #endif
973. bn_correct_top(rr);
^
974. if (r != rr)
975. BN_copy(r, rr);
crypto/bn/bn_lib.c:1021:1: <Offset trace>
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1021:1: Parameter `a->top`
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1024:5: Assignment
1022. {
1023. BN_ULONG *ftl;
1024. int tmp_top = a->top;
^
1025.
1026. if (tmp_top > 0) {
crypto/bn/bn_lib.c:1021:1: <Length trace>
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1021:1: Parameter `*a->d`
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`
1025.
1026. if (tmp_top > 0) {
1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
^
1028. ftl--;
1029. if (*ftl != 0)
| https://github.com/openssl/openssl/blob/2f3930bc0edbfdc7718f709b856fa53f0ec57cde/crypto/bn/bn_lib.c/#L1027 |
d2a_code_trace_data_42206 | void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
if (!ref)
return;
if (!(--ref->buf->refcount))
ref->buf->free(ref->buf);
av_free(ref->video);
av_free(ref->audio);
av_free(ref);
}
avconv.c:1988: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`.
avconv.c:1983:13: Call
1981. ost->st->codec->sample_aspect_ratio = picref->video->pixel_aspect;
1982.
1983. do_video_out(output_files[ost->file_index].ctx, ost, filtered_frame, &frame_size,
^
1984. same_quant ? quality : ost->st->codec->global_quality);
1985. if (vstats_filename && frame_size)
avconv.c:1387:13: Call
1385. pkt.flags |= AV_PKT_FLAG_KEY;
1386.
1387. write_frame(s, &pkt, ost);
^
1388. } else {
1389. int got_packet;
avconv.c:1988:13: Call
1986. do_video_stats(output_files[ost->file_index].ctx, ost, frame_size);
1987. frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
1988. avfilter_unref_buffer(picref);
^
1989. }
1990. }
libavfilter/avfilter.c:73:1: <LHS trace>
71. }
72.
73. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
74. {
75. if (!ref)
libavfilter/avfilter.c:73:1: Parameter `ref->buf->refcount`
71. }
72.
73. void avfilter_unref_buffer(AVFilterBufferRef *ref)
^
74. {
75. if (!ref)
libavfilter/avfilter.c:77:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`
75. if (!ref)
76. return;
77. if (!(--ref->buf->refcount))
^
78. ref->buf->free(ref->buf);
79. av_free(ref->video);
| https://github.com/libav/libav/blob/90f65dc6cf65d1c849a9fa372ac2dda427a258e2/libavfilter/avfilter.c/#L77 |
d2a_code_trace_data_42207 | static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
{
tls_curve_info *cinfo;
if (curve[0])
return 1;
if ((curve[1] < 1) || ((size_t)curve[1] >
sizeof(nid_list)/sizeof(nid_list[0])))
return 0;
cinfo = &nid_list[curve[1]-1];
return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);
}
ssl/d1_clnt.c:434: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: 28 by call to `ssl3_get_key_exchange`.
Showing all 11 steps of the trace
ssl/d1_clnt.c:165:1: Parameter `*s->init_msg`
163. DTLSv1_2_enc_data)
164.
165. > int dtls1_connect(SSL *s)
166. {
167. BUF_MEM *buf=NULL;
ssl/d1_clnt.c:434:8: Call
432. case SSL3_ST_CR_KEY_EXCH_A:
433. case SSL3_ST_CR_KEY_EXCH_B:
434. ret=ssl3_get_key_exchange(s);
^
435. if (ret <= 0) goto end;
436. s->state=SSL3_ST_CR_CERT_REQ_A;
ssl/s3_clnt.c:1402:1: Parameter `*s->init_msg`
1400. }
1401.
1402. > int ssl3_get_key_exchange(SSL *s)
1403. {
1404. #ifndef OPENSSL_NO_RSA
ssl/s3_clnt.c:1781:8: Call
1779. * sent an invalid curve.
1780. */
1781. if (!tls1_check_curve(s, p, param_len))
^
1782. {
1783. al=SSL_AD_DECODE_ERROR;
ssl/t1_lib.c:275:1: Array declaration
273. };
274.
275. > static const unsigned char eccurves_default[] =
276. {
277. 0,14, /* sect571r1 (14) */
ssl/t1_lib.c:472:11: Call
470. {
471. if (p[1] == curves[0] && p[2] == curves[1])
472. return tls_curve_allowed(s, p + 1, SSL_SECOP_CURVE_CHECK);
^
473. }
474. return 0;
ssl/t1_lib.c:429:1: <Offset trace>
427.
428. /* See if curve is allowed by security callback */
429. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
430. {
431. tls_curve_info *cinfo;
ssl/t1_lib.c:429:1: Parameter `*curve`
427.
428. /* See if curve is allowed by security callback */
429. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
430. {
431. tls_curve_info *cinfo;
ssl/t1_lib.c:235:1: <Length trace>
233. #define TLS_CURVE_PRIME 0x0
234.
235. > static tls_curve_info nid_list[] =
236. {
237. {NID_sect163k1, 80, TLS_CURVE_CHAR2},/* sect163k1 (1) */
ssl/t1_lib.c:235:1: Array declaration
233. #define TLS_CURVE_PRIME 0x0
234.
235. > static tls_curve_info nid_list[] =
236. {
237. {NID_sect163k1, 80, TLS_CURVE_CHAR2},/* sect163k1 (1) */
ssl/t1_lib.c:437:2: Array access: Offset: [-1, +oo] Size: 28 by call to `ssl3_get_key_exchange`
435. sizeof(nid_list)/sizeof(nid_list[0])))
436. return 0;
437. cinfo = &nid_list[curve[1]-1];
^
438. return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);
439. }
| https://github.com/openssl/openssl/blob/dbb7654dc189992966ecd95ca66f7a3bb011ab9b/ssl/t1_lib.c/#L437 |
d2a_code_trace_data_42208 | static int do_buf(unsigned char *buf, int buflen,
int type, unsigned char flags, char *quotes, char_io *io_ch, void *arg)
{
int i, outlen, len;
unsigned char orflags, *p, *q;
unsigned long c;
p = buf;
q = buf + buflen;
outlen = 0;
while(p != q) {
if(p == buf) orflags = CHARTYPE_FIRST_ESC_2253;
else orflags = 0;
switch(type & BUF_TYPE_WIDTH_MASK) {
case 4:
c = ((unsigned long)*p++) << 24;
c |= ((unsigned long)*p++) << 16;
c |= ((unsigned long)*p++) << 8;
c |= *p++;
break;
case 2:
c = ((unsigned long)*p++) << 8;
c |= *p++;
break;
case 1:
c = *p++;
break;
case 0:
i = UTF8_getc(p, buflen, &c);
if(i < 0) return -1;
p += i;
break;
}
if (p == q) orflags = CHARTYPE_LAST_ESC_2253;
if(type & BUF_TYPE_CONVUTF8) {
unsigned char utfbuf[6];
int utflen;
utflen = UTF8_putc(utfbuf, 6, c);
for(i = 0; i < utflen; i++) {
len = do_esc_char(utfbuf[i], flags | orflags, quotes, io_ch, arg);
if(len < 0) return -1;
outlen += len;
}
} else {
len = do_esc_char(c, flags | orflags, quotes, io_ch, arg);
if(len < 0) return -1;
outlen += len;
}
}
return outlen;
}
crypto/asn1/a_strex.c:196: error: UNINITIALIZED_VALUE
The value read from c was never initialized.
Showing all 1 steps of the trace
crypto/asn1/a_strex.c:196:13:
194. unsigned char utfbuf[6];
195. int utflen;
196. > utflen = UTF8_putc(utfbuf, 6, c);
197. for(i = 0; i < utflen; i++) {
198. /* We don't need to worry about setting orflags correctly
| https://github.com/openssl/openssl/blob/a657546f9c376f4b7ba4dce14649598fb1a38de5/crypto/asn1/a_strex.c/#L196 |
d2a_code_trace_data_42209 | static int vp3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
static int counter = 0;
int i;
init_get_bits(&gb, buf, buf_size * 8);
if (s->theora && get_bits1(&gb))
{
av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
return -1;
}
s->keyframe = !get_bits1(&gb);
if (!s->theora)
skip_bits(&gb, 1);
for (i = 0; i < 3; i++)
s->last_qps[i] = s->qps[i];
s->nqps=0;
do{
s->qps[s->nqps++]= get_bits(&gb, 6);
} while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb));
for (i = s->nqps; i < 3; i++)
s->qps[i] = -1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
s->keyframe?"key":"", counter, s->qps[0]);
counter++;
if (s->qps[0] != s->last_qps[0])
init_loop_filter(s);
for (i = 0; i < s->nqps; i++)
if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
init_dequantizer(s, i);
if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
return buf_size;
s->current_frame.reference = 3;
s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
if (avctx->get_buffer(avctx, &s->current_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
if (s->keyframe) {
if (!s->theora)
{
skip_bits(&gb, 4);
skip_bits(&gb, 4);
if (s->version)
{
s->version = get_bits(&gb, 5);
if (counter == 1)
av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
}
}
if (s->version || s->theora)
{
if (get_bits1(&gb))
av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2);
}
} else {
if (!s->golden_frame.data[0]) {
av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n");
s->golden_frame.reference = 3;
s->golden_frame.pict_type = FF_I_TYPE;
if (avctx->get_buffer(avctx, &s->golden_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
s->last_frame = s->golden_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
}
s->current_frame.qscale_table= s->qscale_table;
s->current_frame.qstride= 0;
memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
if (unpack_superblocks(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
goto error;
}
if (unpack_modes(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
goto error;
}
if (unpack_vectors(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
goto error;
}
if (unpack_block_qpis(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
goto error;
}
if (unpack_dct_coeffs(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
goto error;
}
for (i = 0; i < 3; i++) {
int height = s->height >> (i && s->chroma_y_shift);
if (s->flipped_image)
s->data_offset[i] = 0;
else
s->data_offset[i] = (height-1) * s->current_frame.linesize[i];
}
s->last_slice_end = 0;
for (i = 0; i < s->c_superblock_height; i++)
render_slice(s, i);
for (i = 0; i < 3; i++) {
int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1;
apply_loop_filter(s, i, row, row+1);
}
vp3_draw_horiz_band(s, s->height);
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->current_frame;
if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY)
avctx->release_buffer(avctx, &s->last_frame);
s->last_frame= s->current_frame;
if (s->keyframe) {
if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
s->golden_frame = s->current_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
s->current_frame.data[0]= NULL;
return buf_size;
error:
if (s->current_frame.data[0])
avctx->release_buffer(avctx, &s->current_frame);
return -1;
}
libavcodec/vp3.c:1716: error: Null Dereference
pointer `&gb->buffer` last assigned on line 1714 could be null and is dereferenced by call to `get_bits1()` at line 1716, column 22.
libavcodec/vp3.c:1703:1: start of procedure vp3_decode_frame()
1701. * This is the ffmpeg/libavcodec API frame decode function.
1702. */
1703. static int vp3_decode_frame(AVCodecContext *avctx,
^
1704. void *data, int *data_size,
1705. AVPacket *avpkt)
libavcodec/vp3.c:1707:5:
1705. AVPacket *avpkt)
1706. {
1707. const uint8_t *buf = avpkt->data;
^
1708. int buf_size = avpkt->size;
1709. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1708:5:
1706. {
1707. const uint8_t *buf = avpkt->data;
1708. int buf_size = avpkt->size;
^
1709. Vp3DecodeContext *s = avctx->priv_data;
1710. GetBitContext gb;
libavcodec/vp3.c:1709:5:
1707. const uint8_t *buf = avpkt->data;
1708. int buf_size = avpkt->size;
1709. Vp3DecodeContext *s = avctx->priv_data;
^
1710. GetBitContext gb;
1711. static int counter = 0;
libavcodec/vp3.c:1711:5:
1709. Vp3DecodeContext *s = avctx->priv_data;
1710. GetBitContext gb;
1711. static int counter = 0;
^
1712. int i;
1713.
libavcodec/vp3.c:1714:5:
1712. int i;
1713.
1714. init_get_bits(&gb, buf, buf_size * 8);
^
1715.
1716. if (s->theora && get_bits1(&gb))
libavcodec/get_bits.h:473:1: start of procedure init_get_bits()
471. * responsible for checking for the buffer end yourself (take advantage of the padding)!
472. */
473. static inline void init_get_bits(GetBitContext *s,
^
474. const uint8_t *buffer, int bit_size)
475. {
libavcodec/get_bits.h:476:5:
474. const uint8_t *buffer, int bit_size)
475. {
476. int buffer_size= (bit_size+7)>>3;
^
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
libavcodec/get_bits.h:477:8: Taking true branch
475. {
476. int buffer_size= (bit_size+7)>>3;
477. if(buffer_size < 0 || bit_size < 0) {
^
478. buffer_size = bit_size = 0;
479. buffer = NULL;
libavcodec/get_bits.h:478:9:
476. int buffer_size= (bit_size+7)>>3;
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
^
479. buffer = NULL;
480. }
libavcodec/get_bits.h:479:9:
477. if(buffer_size < 0 || bit_size < 0) {
478. buffer_size = bit_size = 0;
479. buffer = NULL;
^
480. }
481.
libavcodec/get_bits.h:482:5:
480. }
481.
482. s->buffer= buffer;
^
483. s->size_in_bits= bit_size;
484. s->buffer_end= buffer + buffer_size;
libavcodec/get_bits.h:483:5:
481.
482. s->buffer= buffer;
483. s->size_in_bits= bit_size;
^
484. s->buffer_end= buffer + buffer_size;
485. #ifdef ALT_BITSTREAM_READER
libavcodec/get_bits.h:484:5:
482. s->buffer= buffer;
483. s->size_in_bits= bit_size;
484. s->buffer_end= buffer + buffer_size;
^
485. #ifdef ALT_BITSTREAM_READER
486. s->index=0;
libavcodec/get_bits.h:486:5:
484. s->buffer_end= buffer + buffer_size;
485. #ifdef ALT_BITSTREAM_READER
486. s->index=0;
^
487. #elif defined LIBMPEG2_BITSTREAM_READER
488. s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
libavcodec/get_bits.h:496:1: return from a call to init_get_bits
494. skip_bits_long(s, 0);
495. #endif
496. }
^
497.
498. static inline void align_get_bits(GetBitContext *s)
libavcodec/vp3.c:1716:9: Taking true branch
1714. init_get_bits(&gb, buf, buf_size * 8);
1715.
1716. if (s->theora && get_bits1(&gb))
^
1717. {
1718. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/vp3.c:1716:22:
1714. init_get_bits(&gb, buf, buf_size * 8);
1715.
1716. if (s->theora && get_bits1(&gb))
^
1717. {
1718. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/get_bits.h:393:1: start of procedure get_bits1()
391. }
392.
393. static inline unsigned int get_bits1(GetBitContext *s){
^
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
libavcodec/get_bits.h:395:5:
393. static inline unsigned int get_bits1(GetBitContext *s){
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
^
396. uint8_t result= s->buffer[ index>>3 ];
397. #ifdef ALT_BITSTREAM_READER_LE
libavcodec/get_bits.h:396:5:
394. #ifdef ALT_BITSTREAM_READER
395. unsigned int index= s->index;
396. uint8_t result= s->buffer[ index>>3 ];
^
397. #ifdef ALT_BITSTREAM_READER_LE
398. result>>= (index&0x07);
| https://github.com/libav/libav/blob/5ae092ee34bd8a174306abdd5cd8bf6eea4a2f8e/libavcodec/vp3.c/#L1716 |
d2a_code_trace_data_42210 | static int
setupMap(TIFFRGBAImage* img)
{
int32 x, range;
range = (int32)((1L<<img->bitspersample)-1);
if( img->bitspersample == 16 )
range = (int32) 255;
img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
if (img->Map == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
"No space for photometric conversion table");
return (0);
}
if (img->photometric == PHOTOMETRIC_MINISWHITE) {
for (x = 0; x <= range; x++)
img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
} else {
for (x = 0; x <= range; x++)
img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
}
if (img->bitspersample <= 16 &&
(img->photometric == PHOTOMETRIC_MINISBLACK ||
img->photometric == PHOTOMETRIC_MINISWHITE)) {
if (!makebwmap(img))
return (0);
_TIFFfree(img->Map), img->Map = NULL;
}
return (1);
}
libtiff/tif_getimage.c:2249: error: Memory Leak
memory dynamically allocated by call to `_TIFFmalloc()` at line 2229, column 32 is not reachable after line 2249, column 7.
libtiff/tif_getimage.c:2218:1: start of procedure setupMap()
2216. * process also handles inverting B&W images when needed.
2217. */
2218. static int
^
2219. setupMap(TIFFRGBAImage* img)
2220. {
libtiff/tif_getimage.c:2223:5:
2221. int32 x, range;
2222.
2223. range = (int32)((1L<<img->bitspersample)-1);
^
2224.
2225. /* treat 16 bit the same as eight bit */
libtiff/tif_getimage.c:2226:9: Taking false branch
2224.
2225. /* treat 16 bit the same as eight bit */
2226. if( img->bitspersample == 16 )
^
2227. range = (int32) 255;
2228.
libtiff/tif_getimage.c:2229:5:
2227. range = (int32) 255;
2228.
2229. img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
^
2230. if (img->Map == NULL) {
2231. TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
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
libtiff/tif_getimage.c:2230:9: Taking false branch
2228.
2229. img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
2230. if (img->Map == NULL) {
^
2231. TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
2232. "No space for photometric conversion table");
libtiff/tif_getimage.c:2235:9: Taking true branch
2233. return (0);
2234. }
2235. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
^
2236. for (x = 0; x <= range; x++)
2237. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
libtiff/tif_getimage.c:2236:7:
2234. }
2235. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2236. for (x = 0; x <= range; x++)
^
2237. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2238. } else {
libtiff/tif_getimage.c:2236:14: Loop condition is true. Entering loop body
2234. }
2235. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2236. for (x = 0; x <= range; x++)
^
2237. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2238. } else {
libtiff/tif_getimage.c:2237:6:
2235. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2236. for (x = 0; x <= range; x++)
2237. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
^
2238. } else {
2239. for (x = 0; x <= range; x++)
libtiff/tif_getimage.c:2236:26:
2234. }
2235. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2236. for (x = 0; x <= range; x++)
^
2237. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2238. } else {
libtiff/tif_getimage.c:2236:14: Loop condition is false. Leaving loop
2234. }
2235. if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2236. for (x = 0; x <= range; x++)
^
2237. img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2238. } else {
libtiff/tif_getimage.c:2242:9: Taking true branch
2240. img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
2241. }
2242. if (img->bitspersample <= 16 &&
^
2243. (img->photometric == PHOTOMETRIC_MINISBLACK ||
2244. img->photometric == PHOTOMETRIC_MINISWHITE)) {
libtiff/tif_getimage.c:2243:3: Taking false branch
2241. }
2242. if (img->bitspersample <= 16 &&
2243. (img->photometric == PHOTOMETRIC_MINISBLACK ||
^
2244. img->photometric == PHOTOMETRIC_MINISWHITE)) {
2245. /*
libtiff/tif_getimage.c:2244:3: Taking true branch
2242. if (img->bitspersample <= 16 &&
2243. (img->photometric == PHOTOMETRIC_MINISBLACK ||
2244. img->photometric == PHOTOMETRIC_MINISWHITE)) {
^
2245. /*
2246. * Use photometric mapping table to construct
libtiff/tif_getimage.c:2249:7: Skipping makebwmap(): empty list of specs
2247. * unpacking tables for samples <= 8 bits.
2248. */
2249. if (!makebwmap(img))
^
2250. return (0);
2251. /* no longer need Map, free it */
| https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/libtiff/tif_getimage.c/#L2249 |
d2a_code_trace_data_42211 | 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/srptest.c:69: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_create_verifier_BN`.
Showing all 16 steps of the trace
test/srptest.c:69:10: Call
67.
68. /* Set up server's password entry */
69. if (!TEST_true(SRP_create_verifier_BN(username, server_pass,
^
70. &s, &v, GN->N, GN->g)))
71. goto end;
crypto/srp/srp_vfy.c:633:1: Parameter `N->top`
631. * BIGNUMS.
632. */
633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
634. BIGNUM **verifier, const BIGNUM *N,
635. const BIGNUM *g)
crypto/srp/srp_vfy.c:664:10: Call
662. goto err;
663.
664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
^
665. BN_clear_free(*verifier);
666. goto err;
crypto/bn/bn_exp.c:91:1: Parameter `m->top`
89. }
90.
91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
92. BN_CTX *ctx)
93. {
crypto/bn/bn_exp.c:136:9: Call
134.
135. #ifdef MONT_MUL_MOD
136. if (BN_is_odd(m)) {
^
137. # ifdef MONT_EXP_WORD
138. if (a->top == 1 && !a->neg
crypto/bn/bn_lib.c:867:1: Parameter `a->top`
865. }
866.
867. > int BN_is_odd(const BIGNUM *a)
868. {
869. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_exp.c: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 `m->top`
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:198:14: Call
196. if (m->neg) {
197. /* ignore sign of 'm' */
198. if (!BN_copy(aa, m))
^
199. goto err;
200. 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 `SRP_create_verifier_BN`
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/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_lib.c/#L333 |
d2a_code_trace_data_42212 | int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
{
unsigned char *serverinfo = NULL;
unsigned char *tmp;
size_t serverinfo_length = 0;
unsigned char *extension = 0;
long extension_length = 0;
char *name = NULL;
char *header = NULL;
char namePrefix1[] = "SERVERINFO FOR ";
char namePrefix2[] = "SERVERINFOV2 FOR ";
int ret = 0;
BIO *bin = NULL;
size_t num_extensions = 0, contextoff = 0;
unsigned int version;
if (ctx == NULL || file == NULL) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_PASSED_NULL_PARAMETER);
goto end;
}
bin = BIO_new(BIO_s_file());
if (bin == NULL) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_BUF_LIB);
goto end;
}
if (BIO_read_filename(bin, file) <= 0) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_SYS_LIB);
goto end;
}
for (num_extensions = 0;; num_extensions++) {
if (PEM_read_bio(bin, &name, &header, &extension, &extension_length)
== 0) {
if (num_extensions == 0) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE,
SSL_R_NO_PEM_EXTENSIONS);
goto end;
} else
break;
}
if (strlen(name) < strlen(namePrefix1)) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, SSL_R_PEM_NAME_TOO_SHORT);
goto end;
}
if (strncmp(name, namePrefix1, strlen(namePrefix1)) == 0) {
version = SERVERINFOV1;
} else {
if (strlen(name) < strlen(namePrefix2)) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE,
SSL_R_PEM_NAME_TOO_SHORT);
goto end;
}
if (strncmp(name, namePrefix2, strlen(namePrefix2)) != 0) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE,
SSL_R_PEM_NAME_BAD_PREFIX);
goto end;
}
version = SERVERINFOV2;
}
if (version == SERVERINFOV1) {
if (extension_length < 4
|| (extension[2] << 8) + extension[3]
!= extension_length - 4) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, SSL_R_BAD_DATA);
goto end;
}
contextoff = 4;
} else {
if (extension_length < 8
|| (extension[6] << 8) + extension[7]
!= extension_length - 8) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, SSL_R_BAD_DATA);
goto end;
}
}
tmp = OPENSSL_realloc(serverinfo, serverinfo_length + extension_length
+ contextoff);
if (tmp == NULL) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_MALLOC_FAILURE);
goto end;
}
serverinfo = tmp;
if (contextoff > 0) {
unsigned int synthcontext = SSL_EXT_CLIENT_HELLO
| SSL_EXT_TLS1_2_SERVER_HELLO;
unsigned char *sinfo = serverinfo + serverinfo_length;
sinfo[0] = 0;
sinfo[1] = 0;
sinfo[2] = (synthcontext >> 8) & 0xff;
sinfo[3] = synthcontext & 0xff;
}
memcpy(serverinfo + serverinfo_length + contextoff,
extension, extension_length);
serverinfo_length += extension_length + contextoff;
OPENSSL_free(name);
name = NULL;
OPENSSL_free(header);
header = NULL;
OPENSSL_free(extension);
extension = NULL;
}
ret = SSL_CTX_use_serverinfo_ex(ctx, version, serverinfo,
serverinfo_length);
end:
OPENSSL_free(name);
OPENSSL_free(header);
OPENSSL_free(extension);
OPENSSL_free(serverinfo);
BIO_free(bin);
return ret;
}
ssl/ssl_rsa.c:1008: error: UNINITIALIZED_VALUE
The value read from version was never initialized.
Showing all 1 steps of the trace
ssl/ssl_rsa.c:1008:11:
1006. }
1007.
1008. > ret = SSL_CTX_use_serverinfo_ex(ctx, version, serverinfo,
1009. serverinfo_length);
1010. end:
| https://github.com/openssl/openssl/blob/84c34ba8762463057d372e22ad98a045dbd9a51f/ssl/ssl_rsa.c/#L1008 |
d2a_code_trace_data_42213 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
int i, nw, lb, rb;
BN_ULONG *t, *f;
BN_ULONG l;
bn_check_top(r);
bn_check_top(a);
if (n < 0) {
BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
return 0;
}
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return 0;
r->neg = a->neg;
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return 1;
}
crypto/bn/bn_prime.c:117: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 50 steps of the trace
crypto/bn/bn_prime.c:90:18: Call
88. } else {
89. if (safe) {
90. if (!probable_prime_dh_safe(ret, bits, add, rem, ctx))
^
91. goto err;
92. } else {
crypto/bn/bn_prime.c:404:1: Parameter `p->top`
402. }
403.
404. > static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
405. const BIGNUM *rem, BN_CTX *ctx)
406. {
crypto/bn/bn_prime.c:113:14: Call
111. * prime is odd, We just need to divide by 2
112. */
113. if (!BN_rshift1(t, ret))
^
114. goto err;
115.
crypto/bn/bn_shift.c:54:9: Call
52. bn_check_top(a);
53.
54. if (BN_is_zero(a)) {
^
55. BN_zero(r);
56. return 1;
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/bn/bn_prime.c:117:17: Call
115.
116. for (i = 0; i < checks; i++) {
117. j = BN_is_prime_fasttest_ex(ret, 1, ctx, 0, cb);
^
118. if (j == -1)
119. goto err;
crypto/bn/bn_prime.c:151:1: Parameter `a->top`
149. }
150.
151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
152. int do_trial_division, BN_GENCB *cb)
153. {
crypto/bn/bn_prime.c:161:9: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:161:29: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:165:10: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:860:1: Parameter `a->top`
858. }
859.
860. > int BN_is_odd(const BIGNUM *a)
861. {
862. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_prime.c:165:26: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:542:1: Parameter `a->top`
540. }
541.
542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
543. {
544. int i;
crypto/bn/bn_prime.c:198:10: Call
196.
197. /* compute A1 := a - 1 */
198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1))
^
199. goto err;
200. /* compute A3 := a - 3 */
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:201:10: Call
199. goto err;
200. /* compute A3 := a - 3 */
201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3))
^
202. goto err;
203.
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:215:10: Call
213. if (mont == NULL)
214. goto err;
215. if (!BN_MONT_CTX_set(mont, a, ctx))
^
216. goto err;
217.
crypto/bn/bn_mont.c:238:9: Call
236. BIGNUM *Ri, *R;
237.
238. if (BN_is_zero(mod))
^
239. return 0;
240.
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/bn/bn_prime.c:223:13: Call
221. goto err;
222.
223. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
224. if (j == -1)
225. goto err;
crypto/bn/bn_prime.c:245:1: Parameter `a->top`
243. }
244.
245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
246. const BIGNUM *a1_odd, int k, BN_CTX *ctx,
247. BN_MONT_CTX *mont)
crypto/bn/bn_prime.c:249:10: Call
247. BN_MONT_CTX *mont)
248. {
249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
250. return -1;
251. if (BN_is_one(w))
crypto/bn/bn_exp.c:296:1: Parameter `m->top`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c:310:16: Call
308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
311. }
312.
crypto/bn/bn_exp.c:596:1: Parameter `m->top`
594. * http://www.daemonology.net/hyperthreading-considered-harmful/)
595. */
596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
597. const BIGNUM *m, BN_CTX *ctx,
598. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:617:10: Call
615. bn_check_top(m);
616.
617. if (!BN_is_odd(m)) {
^
618. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
619. return 0;
crypto/bn/bn_lib.c:860:1: Parameter `a->top`
858. }
859.
860. > int BN_is_odd(const BIGNUM *a)
861. {
862. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_exp.c:755:14: Call
753. /* prepare a^1 in Montgomery domain */
754. if (a->neg || BN_ucmp(a, m) >= 0) {
755. if (!BN_nnmod(&am, a, m, ctx))
^
756. goto err;
757. if (!BN_to_montgomery(&am, &am, mont, ctx))
crypto/bn/bn_mod.c:13:1: Parameter `d->top`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:199:31: Call
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_lib.c:140:9: Assignment
138.
139. if (BN_is_zero(a))
140. return 0;
^
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
142. }
crypto/bn/bn_div.c:199:5: Assignment
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_div.c:200:11: Call
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
201. goto err;
202. sdiv->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return 0;
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return 0;
100. r->neg = a->neg;
crypto/bn/bn_lib.c:941:1: Parameter `*a->d`
939. }
940.
941. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:104:5: Assignment
102. rb = BN_BITS2 - lb;
103. f = a->d;
104. t = r->d;
^
105. t[a->top + nw] = 0;
106. if (lb == 0)
crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`
110. for (i = a->top - 1; i >= 0; i--) {
111. l = f[i];
112. t[nw + i + 1] |= (l >> rb) & BN_MASK2;
^
113. t[nw + i] = (l << lb) & BN_MASK2;
114. }
| https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_shift.c/#L112 |
d2a_code_trace_data_42214 | void RAND_seed(const void *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->seed != NULL)
meth->seed(buf, num);
}
crypto/rand/rand_lib.c:735: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 733 could be null and is dereferenced at line 735, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:731:1: start of procedure RAND_seed()
729. #endif
730.
731. > void RAND_seed(const void *buf, int num)
732. {
733. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:733:5:
731. void RAND_seed(const void *buf, int num)
732. {
733. > const RAND_METHOD *meth = RAND_get_rand_method();
734.
735. if (meth->seed != NULL)
crypto/rand/rand_lib.c:671:1: start of procedure RAND_get_rand_method()
669. #endif
670.
671. > const RAND_METHOD *RAND_get_rand_method(void)
672. {
673. #ifdef FIPS_MODE
crypto/rand/rand_lib.c:676:5:
674. return NULL;
675. #else
676. > const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:678:10:
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. > if (!RUN_ONCE(&rand_init, do_rand_init))
679. return NULL;
680.
crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
109. }
110.
111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:113:9: Taking true branch
111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
^
114. return 0;
115.
crypto/threads_pthread.c:114:9:
112. {
113. if (pthread_once(once, init) != 0)
114. > return 0;
115.
116. return 1;
crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
115.
116. return 1;
117. > }
118.
119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:678:10: Condition is false
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
^
679. return NULL;
680.
crypto/rand/rand_lib.c:678:10: Taking true branch
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
^
679. return NULL;
680.
crypto/rand/rand_lib.c:679:9:
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
679. > return NULL;
680.
681. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:703:1: return from a call to RAND_get_rand_method
701. return tmp_meth;
702. #endif
703. > }
704.
705. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
crypto/rand/rand_lib.c:735:9:
733. const RAND_METHOD *meth = RAND_get_rand_method();
734.
735. > if (meth->seed != NULL)
736. meth->seed(buf, num);
737. }
| https://github.com/openssl/openssl/blob/37ca204b96b036f949b8bc8389c1f8e806e1cbec/crypto/rand/rand_lib.c/#L735 |
d2a_code_trace_data_42215 | 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->neg = b->neg;
a->top = b->top;
a->flags |= b->flags & BN_FLG_FIXED_TOP;
bn_check_top(a);
return a;
}
crypto/bn/bn_rand.c:299: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_div`.
Showing all 18 steps of the trace
crypto/bn/bn_rand.c:231:1: Parameter `range->top`
229. * used.
230. */
231. > int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
232. const BIGNUM *priv, const unsigned char *message,
233. size_t message_len, BN_CTX *ctx)
crypto/bn/bn_rand.c:244:34: Call
242. unsigned done, todo;
243. /* We generate |range|+8 bytes of random output. */
244. const unsigned num_k_bytes = BN_num_bytes(range) + 8;
^
245. unsigned char private_bytes[96];
246. unsigned char *k_bytes = NULL;
crypto/bn/bn_lib.c:140:9: Call
138. bn_check_top(a);
139.
140. if (BN_is_zero(a))
^
141. return 0;
142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:866:1: Parameter `a->top`
864. }
865.
866. > int BN_is_zero(const BIGNUM *a)
867. {
868. return a->top == 0;
crypto/bn/bn_rand.c:299:9: Call
297. if (!BN_bin2bn(k_bytes, num_k_bytes, out))
298. goto err;
299. if (BN_mod(out, out, range, ctx) != 1)
^
300. goto err;
301. ret = 1;
crypto/bn/bn_div.c:209:1: Parameter `divisor->top`
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:214:9: Call
212. int ret;
213.
214. if (BN_is_zero(divisor)) {
^
215. BNerr(BN_F_BN_DIV, BN_R_DIV_BY_ZERO);
216. return 0;
crypto/bn/bn_lib.c:866:1: Parameter `a->top`
864. }
865.
866. > int BN_is_zero(const BIGNUM *a)
867. {
868. return a->top == 0;
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:264:1: Parameter `divisor->top`
262. * divisor's length is considered public;
263. */
264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
265. const BIGNUM *divisor, BN_CTX *ctx)
266. {
crypto/bn/bn_div.c:289:10: Call
287.
288. /* First we normalise the numbers */
289. if (!BN_copy(sdiv, divisor))
^
290. goto err;
291. norm_shift = bn_left_align(sdiv);
crypto/bn/bn_lib.c:281:1: <Offset trace>
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:281:1: Parameter `b->top`
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:281:1: <Length trace>
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:281:1: Parameter `*a->d`
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:287:9: Call
285. if (a == b)
286. return a;
287. if (bn_wexpand(a, b->top) == NULL)
^
288. return NULL;
289.
crypto/bn/bn_lib.c:962:1: Parameter `*a->d`
960. }
961.
962. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
963. {
964. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_div`
289.
290. if (b->top > 0)
291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
^
292.
293. a->neg = b->neg;
| https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L291 |
d2a_code_trace_data_42216 | 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:448: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `SSL_dup`.
Showing all 16 steps of the trace
ssl/bio_ssl.c:447:4: Call
445. dbio=(BIO *)ptr;
446. if (((BIO_SSL *)dbio->ptr)->ssl != NULL)
447. SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
^
448. ((BIO_SSL *)dbio->ptr)->ssl=SSL_dup(ssl);
449. ((BIO_SSL *)dbio->ptr)->renegotiate_count=
ssl/ssl_lib.c:505:1: Parameter `s->initial_ctx->sessions->num_nodes`
503. }
504.
505. > void SSL_free(SSL *s)
506. {
507. int i;
ssl/bio_ssl.c:448:31: Call
446. if (((BIO_SSL *)dbio->ptr)->ssl != NULL)
447. SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
448. ((BIO_SSL *)dbio->ptr)->ssl=SSL_dup(ssl);
^
449. ((BIO_SSL *)dbio->ptr)->renegotiate_count=
450. ((BIO_SSL *)b->ptr)->renegotiate_count;
ssl/ssl_lib.c:2633:1: Parameter `s->ctx->sessions->num_nodes`
2631. }
2632.
2633. > SSL *SSL_dup(SSL *s)
2634. {
2635. STACK_OF(X509_NAME) *sk;
ssl/ssl_lib.c:2640:11: Call
2638. int i;
2639.
2640. if ((ret=SSL_new(SSL_get_SSL_CTX(s))) == NULL)
^
2641. return(NULL);
2642.
ssl/ssl_lib.c:275:1: Parameter `ctx->sessions->num_nodes`
273. }
274.
275. > SSL *SSL_new(SSL_CTX *ctx)
276. {
277. SSL *s;
ssl/ssl_lib.c:390:4: Call
388. ssl_cert_free(s->cert);
389. if (s->ctx != NULL)
390. SSL_CTX_free(s->ctx); /* decrement reference count */
^
391. OPENSSL_free(s);
392. }
ssl/ssl_lib.c:1899:1: Parameter `a->sessions->num_nodes`
1897. #endif
1898.
1899. > void SSL_CTX_free(SSL_CTX *a)
1900. {
1901. int i;
ssl/ssl_lib.c:1931:3: Call
1929. */
1930. if (a->sessions != NULL)
1931. SSL_CTX_flush_sessions(a,0);
^
1932.
1933. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes`
983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM)
984.
985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
986. {
987. unsigned long i;
ssl/ssl_sess.c:997:2: Call
995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;
996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0;
997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout),
^
998. TIMEOUT_PARAM, &tp);
999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i;
crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes`
303. }
304.
305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
306. {
307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
crypto/lhash/lhash.c:307:2: Call
305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
306. {
307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
^
308. }
309.
crypto/lhash/lhash.c:270:1: <LHS trace>
268. }
269.
270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
272. {
crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes`
268. }
269.
270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
272. {
crypto/lhash/lhash.c:281:7: Binary operation: ([0, +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/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281 |
d2a_code_trace_data_42217 | int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
int line_size;
int sample_size = av_get_bytes_per_sample(sample_fmt);
int planar = av_sample_fmt_is_planar(sample_fmt);
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
return AVERROR(EINVAL);
line_size = planar ? FFALIGN(nb_samples * sample_size, align) :
FFALIGN(nb_samples * sample_size * nb_channels, align);
if (linesize)
*linesize = line_size;
return planar ? line_size * nb_channels : line_size;
}
libavcodec/flacdec.c:460: error: Integer Overflow L2
([1, 2147483616] + 32):signed32 by call to `allocate_buffers`.
libavcodec/flacdec.c:401:1: Parameter `s->max_blocksize`
399. }
400.
401. static int decode_frame(FLACContext *s)
^
402. {
403. int i, ret;
libavcodec/flacdec.c:460:15: Call
458.
459. if (!s->got_streaminfo) {
460. ret = allocate_buffers(s);
^
461. if (ret < 0)
462. return ret;
libavcodec/flacdec.c:126:1: Parameter `s->max_blocksize`
124. }
125.
126. static int allocate_buffers(FLACContext *s)
^
127. {
128. int buf_size;
libavcodec/flacdec.c:130:16: Call
128. int buf_size;
129.
130. buf_size = av_samples_get_buffer_size(NULL, s->channels, s->max_blocksize,
^
131. AV_SAMPLE_FMT_S32P, 0);
132. if (buf_size < 0)
libavutil/samplefmt.c:108:1: <LHS trace>
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:108:1: Parameter `nb_samples`
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `allocate_buffers`
122. return AVERROR(EINVAL);
123. align = 1;
124. nb_samples = FFALIGN(nb_samples, 32);
^
125. }
126.
| https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124 |
d2a_code_trace_data_42218 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_kron.c:126: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_nnmod`.
Showing all 22 steps of the trace
crypto/bn/bn_kron.c:17:1: Parameter `ctx->stack.depth`
15.
16. /* Returns -2 for errors because both -1 and 0 are valid results. */
17. > int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
18. {
19. int i;
crypto/bn/bn_kron.c:35:5: Call
33. bn_check_top(b);
34.
35. BN_CTX_start(ctx);
^
36. A = BN_CTX_get(ctx);
37. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_kron.c:36:9: Call
34.
35. BN_CTX_start(ctx);
36. A = BN_CTX_get(ctx);
^
37. B = BN_CTX_get(ctx);
38. if (B == 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_kron.c:37:9: Call
35. BN_CTX_start(ctx);
36. A = BN_CTX_get(ctx);
37. B = BN_CTX_get(ctx);
^
38. if (B == NULL)
39. goto end;
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_kron.c:126:16: Call
124.
125. /* (A, B) := (B mod |A|, |A|) */
126. err = !BN_nnmod(B, B, A, ctx);
^
127. if (err)
128. goto end;
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_nnmod`
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_42219 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/sm2/sm2_sign.c:214: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`.
Showing all 26 steps of the trace
crypto/sm2/sm2_sign.c:208:9: Call
206. goto done;
207.
208. if (EC_POINT_mul(group, pt, s, EC_KEY_get0_public_key(key), t, ctx) == 0)
^
209. goto done;
210.
crypto/ec/ec_lib.c:932:12: Call
930. scalars[0] = p_scalar;
931.
932. return EC_POINTs_mul(group, r, g_scalar,
^
933. (point != NULL
934. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:910:1: Parameter `(*scalars)->top`
908. */
909.
910. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
911. size_t num, const EC_POINT *points[],
912. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/sm2/sm2_sign.c:214:9: Call
212. goto done;
213.
214. if (BN_mod_add(t, e, x1, order, ctx) == 0)
^
215. goto done;
216.
crypto/bn/bn_mod.c:28:1: Parameter `r->top`
26. }
27.
28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
29. BN_CTX *ctx)
30. {
crypto/bn/bn_mod.c:31:10: Call
29. BN_CTX *ctx)
30. {
31. if (!BN_add(r, a, b))
^
32. return 0;
33. return BN_nnmod(r, r, m, ctx);
crypto/bn/bn_add.c:14:1: Parameter `r->top`
12.
13. /* r can == a or b */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int a_neg = a->neg, ret;
crypto/bn/bn_add.c:51:11: Call
49. }
50.
51. ret = BN_uadd(r, a, b);
^
52. r->neg = a_neg;
53. bn_check_top(r);
crypto/bn/bn_add.c:58:1: Parameter `r->top`
56.
57. /* unsigned add of b to a */
58. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
59. {
60. int max, min, dif;
crypto/bn/bn_add.c:78:9: Call
76. dif = max - min;
77.
78. if (bn_wexpand(r, max + 1) == NULL)
^
79. return 0;
80.
crypto/bn/bn_lib.c:910:1: Parameter `a->top`
908. }
909.
910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:912:37: Call
910. BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
913. }
914.
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. */
245.
246. > BIGNUM *bn_expand2(BIGNUM *b, int words)
247. {
248. bn_check_top(b);
crypto/bn/bn_lib.c:251:23: Call
249.
250. if (words > b->dmax) {
251. BN_ULONG *a = bn_expand_internal(b, words);
^
252. if (!a)
253. return NULL;
crypto/bn/bn_lib.c:208:1: <Offset trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `b->top`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: <Length trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `words`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:225:13: Call
223. a = OPENSSL_secure_zalloc(words * sizeof(*a));
224. else
225. a = OPENSSL_zalloc(words * sizeof(*a));
^
226. if (a == NULL) {
227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:225:9: Assignment
223. a = OPENSSL_secure_zalloc(words * sizeof(*a));
224. else
225. a = OPENSSL_zalloc(words * sizeof(*a));
^
226. if (a == NULL) {
227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`
231. assert(b->top <= words);
232. if (b->top > 0)
233. memcpy(a, b->d, sizeof(*a) * b->top);
^
234.
235. return a;
| https://github.com/openssl/openssl/blob/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_lib.c/#L233 |
d2a_code_trace_data_42220 | void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
ssl/statem/statem_clnt.c:1175: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`.
Showing all 13 steps of the trace
ssl/statem/statem_clnt.c:911:1: Parameter `s->initial_ctx->sessions->num_items`
909. }
910.
911. > MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
912. {
913. STACK_OF(SSL_CIPHER) *sk;
ssl/statem/statem_clnt.c:1175:5: Call
1173. return MSG_PROCESS_CONTINUE_READING;
1174. f_err:
1175. ssl3_send_alert(s, SSL3_AL_FATAL, al);
^
1176. err:
1177. ossl_statem_set_error(s);
ssl/s3_msg.c:64:1: Parameter `s->initial_ctx->sessions->num_items`
62. }
63.
64. > int ssl3_send_alert(SSL *s, int level, int desc)
65. {
66. /* Map tls/ssl alert value to correct one */
ssl/s3_msg.c:75:9: Call
73. /* If a fatal one, remove from cache */
74. if ((level == SSL3_AL_FATAL) && (s->session != NULL))
75. SSL_CTX_remove_session(s->session_ctx, s->session);
^
76.
77. s->s3->alert_dispatch = 1;
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_42221 | static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
int src_index, int ref_index, int const penalty_factor,
int size, int h, int flags)
{
MotionEstContext * const c= &s->me;
me_cmp_func cmpf, chroma_cmpf;
int dia_size;
LOAD_COMMON
LOAD_COMMON2
int map_generation= c->map_generation;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
for(dia_size=1; dia_size<=c->dia_size; dia_size++){
int dir, start, end;
const int x= best[0];
const int y= best[1];
start= FFMAX(0, y + dia_size - ymax);
end = FFMIN(dia_size, xmax - x + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x + dir , y + dia_size - dir);
}
start= FFMAX(0, x + dia_size - xmax);
end = FFMIN(dia_size, y - ymin + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x + dia_size - dir, y - dir );
}
start= FFMAX(0, -y + dia_size + ymin );
end = FFMIN(dia_size, x - xmin + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x - dir , y - dia_size + dir);
}
start= FFMAX(0, -x + dia_size + xmin );
end = FFMIN(dia_size, ymax - y + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x - dia_size + dir, y + dir );
}
if(x!=best[0] || y!=best[1])
dia_size=0;
#if 0
{
int dx, dy, i;
static int stats[8*8];
dx= FFABS(x-best[0]);
dy= FFABS(y-best[1]);
stats[dy*8 + dx] ++;
if(256*256*256*64 % (stats[0]+1)==0){
for(i=0; i<64; i++){
if((i&7)==0) printf("\n");
printf("%6d ", stats[i]);
}
printf("\n");
}
}
#endif
}
return dmin;
}
libavcodec/motion_est_template.c:915: error: Uninitialized Value
The value read from ymax was never initialized.
libavcodec/motion_est_template.c:915:16:
913. const int y= best[1];
914.
915. start= FFMAX(0, y + dia_size - ymax);
^
916. end = FFMIN(dia_size, xmax - x + 1);
917. for(dir= start; dir<end; dir++){
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L915 |
d2a_code_trace_data_42222 | static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
EightBpsContext * const c = avctx->priv_data;
const unsigned char *encoded = buf;
unsigned char *pixptr, *pixptr_end;
unsigned int height = avctx->height;
unsigned int dlen, p, row;
const unsigned char *lp, *dp, *ep;
unsigned char count;
unsigned int px_inc;
unsigned int planes = c->planes;
unsigned char *planemap = c->planemap;
int ret;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
ep = encoded + buf_size;
dp = encoded + planes * (height << 1);
if (planes == 4)
planes--;
px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_RGB32);
for (p = 0; p < planes; p++) {
lp = encoded + p * (height << 1);
for (row = 0; row < height; row++) {
pixptr = frame->data[0] + row * frame->linesize[0] + planemap[p];
pixptr_end = pixptr + frame->linesize[0];
if (ep - lp < row * 2 + 2)
return AVERROR_INVALIDDATA;
dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2));
while (dlen > 0) {
if (ep - dp <= 1)
return AVERROR_INVALIDDATA;
if ((count = *dp++) <= 127) {
count++;
dlen -= count + 1;
if (pixptr_end - pixptr < count * px_inc)
break;
if (ep - dp < count)
return AVERROR_INVALIDDATA;
while (count--) {
*pixptr = *dp++;
pixptr += px_inc;
}
} else {
count = 257 - count;
if (pixptr_end - pixptr < count * px_inc)
break;
while (count--) {
*pixptr = *dp;
pixptr += px_inc;
}
dp++;
dlen -= 2;
}
}
}
}
if (avctx->bits_per_coded_sample <= 8) {
const uint8_t *pal = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE,
NULL);
if (pal) {
frame->palette_has_changed = 1;
memcpy(c->pal, pal, AVPALETTE_SIZE);
}
memcpy (frame->data[1], c->pal, AVPALETTE_SIZE);
}
*got_frame = 1;
return buf_size;
}
libavcodec/8bps.c:125: error: Integer Overflow L2
([1, +oo] - 2):unsigned32.
libavcodec/8bps.c:56:1: <LHS trace>
54. } EightBpsContext;
55.
56. static int decode_frame(AVCodecContext *avctx, void *data,
^
57. int *got_frame, AVPacket *avpkt)
58. {
libavcodec/8bps.c:56:1: Parameter `*avpkt->data`
54. } EightBpsContext;
55.
56. static int decode_frame(AVCodecContext *avctx, void *data,
^
57. int *got_frame, AVPacket *avpkt)
58. {
libavcodec/8bps.c:105:22: Assignment
103. if (ep - dp <= 1)
104. return AVERROR_INVALIDDATA;
105. if ((count = *dp++) <= 127) {
^
106. count++;
107. dlen -= count + 1;
libavcodec/8bps.c:106:21: Assignment
104. return AVERROR_INVALIDDATA;
105. if ((count = *dp++) <= 127) {
106. count++;
^
107. dlen -= count + 1;
108. if (pixptr_end - pixptr < count * px_inc)
libavcodec/8bps.c:107:21: Assignment
105. if ((count = *dp++) <= 127) {
106. count++;
107. dlen -= count + 1;
^
108. if (pixptr_end - pixptr < count * px_inc)
109. break;
libavcodec/8bps.c:125:21: Binary operation: ([1, +oo] - 2):unsigned32
123. }
124. dp++;
125. dlen -= 2;
^
126. }
127. }
| https://github.com/libav/libav/blob/582963a8156522582e55466be4a59974a8d909a5/libavcodec/8bps.c/#L125 |
d2a_code_trace_data_42223 | static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
bc->bits >>= n;
#else
uint64_t ret = bc->bits >> (64 - n);
bc->bits <<= n;
#endif
bc->bits_left -= n;
return ret;
}
libavformat/mpc8.c:116: error: Integer Overflow L2
([1, +oo] - 7):unsigned32 by call to `bitstream_read`.
libavformat/mpc8.c:116:14: Call
114. while (bitstream_read_bit(bc) && bits < 64 - 7) {
115. v <<= 7;
116. v |= bitstream_read(bc, 7);
^
117. bits += 7;
118. }
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 7):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
| https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139 |
d2a_code_trace_data_42224 | static int
createCroppedImage(struct image_data *image, struct crop_mask *crop,
unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr)
{
tsize_t cropsize;
unsigned char *read_buff = NULL;
unsigned char *crop_buff = NULL;
unsigned char *new_buff = NULL;
static tsize_t prev_cropsize = 0;
read_buff = *read_buff_ptr;
crop_buff = read_buff;
*crop_buff_ptr = read_buff;
crop->combined_width = image->width;
crop->combined_length = image->length;
cropsize = crop->bufftotal;
crop_buff = *crop_buff_ptr;
if (!crop_buff)
{
crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
*crop_buff_ptr = crop_buff;
_TIFFmemset(crop_buff, 0, cropsize);
prev_cropsize = cropsize;
}
else
{
if (prev_cropsize < cropsize)
{
new_buff = _TIFFrealloc(crop_buff, cropsize);
if (!new_buff)
{
free (crop_buff);
crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
}
else
crop_buff = new_buff;
_TIFFmemset(crop_buff, 0, cropsize);
}
}
if (!crop_buff)
{
TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
return (-1);
}
*crop_buff_ptr = crop_buff;
if (crop->crop_mode & CROP_INVERT)
{
switch (crop->photometric)
{
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
image->photometric = crop->photometric;
break;
case INVERT_DATA_ONLY:
case INVERT_DATA_AND_TAG:
if (invertImage(image->photometric, image->spp, image->bps,
crop->combined_width, crop->combined_length, crop_buff))
{
TIFFError("createCroppedImage",
"Failed to invert colorspace for image or cropped selection");
return (-1);
}
if (crop->photometric == INVERT_DATA_AND_TAG)
{
switch (image->photometric)
{
case PHOTOMETRIC_MINISWHITE:
image->photometric = PHOTOMETRIC_MINISBLACK;
break;
case PHOTOMETRIC_MINISBLACK:
image->photometric = PHOTOMETRIC_MINISWHITE;
break;
default:
break;
}
}
break;
default: break;
}
}
if (crop->crop_mode & CROP_MIRROR)
{
if (mirrorImage(image->spp, image->bps, crop->mirror,
crop->combined_width, crop->combined_length, crop_buff))
{
TIFFError("createCroppedImage", "Failed to mirror image or cropped selection %s",
(crop->rotation == MIRROR_HORIZ) ? "horizontally" : "vertically");
return (-1);
}
}
if (crop->crop_mode & CROP_ROTATE)
{
if (rotateImage(crop->rotation, image, &crop->combined_width,
&crop->combined_length, crop_buff_ptr))
{
TIFFError("createCroppedImage",
"Failed to rotate image or cropped selection by %d degrees", crop->rotation);
return (-1);
}
}
if (crop_buff == read_buff)
*read_buff_ptr = NULL;
return (0);
}
tools/tiffcrop.c:7481: error: Null Dereference
pointer `crop_buff` last assigned on line 7477 could be null and is dereferenced by call to `_TIFFmemset()` at line 7481, column 7.
tools/tiffcrop.c:7442:1: start of procedure createCroppedImage()
7440. * the most optimized path when no Zones or Regions are required.
7441. */
7442. static int
^
7443. createCroppedImage(struct image_data *image, struct crop_mask *crop,
7444. unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr)
tools/tiffcrop.c:7447:3:
7445. {
7446. tsize_t cropsize;
7447. unsigned char *read_buff = NULL;
^
7448. unsigned char *crop_buff = NULL;
7449. unsigned char *new_buff = NULL;
tools/tiffcrop.c:7448:3:
7446. tsize_t cropsize;
7447. unsigned char *read_buff = NULL;
7448. unsigned char *crop_buff = NULL;
^
7449. unsigned char *new_buff = NULL;
7450. static tsize_t prev_cropsize = 0;
tools/tiffcrop.c:7449:3:
7447. unsigned char *read_buff = NULL;
7448. unsigned char *crop_buff = NULL;
7449. unsigned char *new_buff = NULL;
^
7450. static tsize_t prev_cropsize = 0;
7451.
tools/tiffcrop.c:7450:3:
7448. unsigned char *crop_buff = NULL;
7449. unsigned char *new_buff = NULL;
7450. static tsize_t prev_cropsize = 0;
^
7451.
7452. read_buff = *read_buff_ptr;
tools/tiffcrop.c:7452:3:
7450. static tsize_t prev_cropsize = 0;
7451.
7452. read_buff = *read_buff_ptr;
^
7453.
7454. /* process full image, no crop buffer needed */
tools/tiffcrop.c:7455:3:
7453.
7454. /* process full image, no crop buffer needed */
7455. crop_buff = read_buff;
^
7456. *crop_buff_ptr = read_buff;
7457. crop->combined_width = image->width;
tools/tiffcrop.c:7456:3:
7454. /* process full image, no crop buffer needed */
7455. crop_buff = read_buff;
7456. *crop_buff_ptr = read_buff;
^
7457. crop->combined_width = image->width;
7458. crop->combined_length = image->length;
tools/tiffcrop.c:7457:3:
7455. crop_buff = read_buff;
7456. *crop_buff_ptr = read_buff;
7457. crop->combined_width = image->width;
^
7458. crop->combined_length = image->length;
7459.
tools/tiffcrop.c:7458:3:
7456. *crop_buff_ptr = read_buff;
7457. crop->combined_width = image->width;
7458. crop->combined_length = image->length;
^
7459.
7460. cropsize = crop->bufftotal;
tools/tiffcrop.c:7460:3:
7458. crop->combined_length = image->length;
7459.
7460. cropsize = crop->bufftotal;
^
7461. crop_buff = *crop_buff_ptr;
7462. if (!crop_buff)
tools/tiffcrop.c:7461:3:
7459.
7460. cropsize = crop->bufftotal;
7461. crop_buff = *crop_buff_ptr;
^
7462. if (!crop_buff)
7463. {
tools/tiffcrop.c:7462:8: Taking false branch
7460. cropsize = crop->bufftotal;
7461. crop_buff = *crop_buff_ptr;
7462. if (!crop_buff)
^
7463. {
7464. crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
tools/tiffcrop.c:7471:9: Taking true branch
7469. else
7470. {
7471. if (prev_cropsize < cropsize)
^
7472. {
7473. new_buff = _TIFFrealloc(crop_buff, cropsize);
tools/tiffcrop.c:7473:7:
7471. if (prev_cropsize < cropsize)
7472. {
7473. new_buff = _TIFFrealloc(crop_buff, cropsize);
^
7474. if (!new_buff)
7475. {
libtiff/tif_unix.c:265:1: start of procedure _TIFFrealloc()
263. }
264.
265. void*
^
266. _TIFFrealloc(void* p, tmsize_t s)
267. {
libtiff/tif_unix.c:268:2:
266. _TIFFrealloc(void* p, tmsize_t s)
267. {
268. return (realloc(p, (size_t) s));
^
269. }
270.
libtiff/tif_unix.c:269:1: return from a call to _TIFFrealloc
267. {
268. return (realloc(p, (size_t) s));
269. }
^
270.
271. void
tools/tiffcrop.c:7474:12: Taking true branch
7472. {
7473. new_buff = _TIFFrealloc(crop_buff, cropsize);
7474. if (!new_buff)
^
7475. {
7476. free (crop_buff);
tools/tiffcrop.c:7476:2:
7474. if (!new_buff)
7475. {
7476. free (crop_buff);
^
7477. crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
7478. }
tools/tiffcrop.c:7477:9:
7475. {
7476. free (crop_buff);
7477. crop_buff = (unsigned char *)_TIFFmalloc(cropsize);
^
7478. }
7479. else
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/tiffcrop.c:7481:7:
7479. else
7480. crop_buff = new_buff;
7481. _TIFFmemset(crop_buff, 0, cropsize);
^
7482. }
7483. }
libtiff/tif_unix.c:271:1: start of procedure _TIFFmemset()
269. }
270.
271. void
^
272. _TIFFmemset(void* p, int v, tmsize_t c)
273. {
libtiff/tif_unix.c:274:2:
272. _TIFFmemset(void* p, int v, tmsize_t c)
273. {
274. memset(p, v, (size_t) c);
^
275. }
276.
libtiff/tif_unix.c:275:1: return from a call to _TIFFmemset
273. {
274. memset(p, v, (size_t) c);
275. }
^
276.
277. void
| https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiffcrop.c/#L7481 |
d2a_code_trace_data_42225 | static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
bc->bits >>= n;
#else
bc->bits <<= n;
#endif
bc->bits_left -= n;
}
libavcodec/mpc7.c:242: error: Integer Overflow L2
([0, 64] - [0, 64]):unsigned32 by call to `bitstream_skip`.
libavcodec/mpc7.c:241:5: Call
239. c->bdsp.bswap_buf((uint32_t *) c->bits, (const uint32_t *) buf,
240. buf_size >> 2);
241. bitstream_init(&bc, c->bits, buf_size * 8);
^
242. bitstream_skip(&bc, skip);
243.
libavcodec/bitstream.h:85:9: Assignment
83. bc->buffer =
84. bc->ptr = NULL;
85. bc->bits_left = 0;
^
86. return AVERROR_INVALIDDATA;
87. }
libavcodec/mpc7.c:242:5: Call
240. buf_size >> 2);
241. bitstream_init(&bc, c->bits, buf_size * 8);
242. bitstream_skip(&bc, skip);
^
243.
244. /* read subband indexes */
libavcodec/bitstream.h:241:1: Parameter `n`
239.
240. /* Skip n bits in the buffer. */
241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
^
242. {
243. if (n <= bc->bits_left)
libavcodec/bitstream.h:247:9: Call
245. else {
246. n -= bc->bits_left;
247. skip_remaining(bc, bc->bits_left);
^
248. if (n >= 64) {
249. unsigned skip = n / 8;
libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: Parameter `n`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:237:5: Binary operation: ([0, 64] - [0, 64]):unsigned32 by call to `bitstream_skip`
235. bc->bits <<= n;
236. #endif
237. bc->bits_left -= n;
^
238. }
239.
| https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L237 |
d2a_code_trace_data_42226 | static int adpcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
ADPCMContext *c = avctx->priv_data;
ADPCMChannelStatus *cs;
int n, m, channel, i;
int block_predictor[2];
short *samples;
short *samples_end;
const uint8_t *src;
int st;
unsigned char last_byte = 0;
unsigned char nibble;
int decode_top_nibble_next = 0;
int diff_channel;
uint32_t samples_in_chunk;
int32_t previous_left_sample, previous_right_sample;
int32_t current_left_sample, current_right_sample;
int32_t next_left_sample, next_right_sample;
int32_t coeff1l, coeff2l, coeff1r, coeff2r;
uint8_t shift_left, shift_right;
int count1, count2;
if (!buf_size)
return 0;
if(*data_size/4 < buf_size + 8)
return -1;
samples = data;
samples_end= samples + *data_size/2;
*data_size= 0;
src = buf;
st = avctx->channels == 2 ? 1 : 0;
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_QT:
n = (buf_size - 2);
channel = c->channel;
cs = &(c->status[channel]);
cs->predictor = (*src++) << 8;
cs->predictor |= (*src & 0x80);
cs->predictor &= 0xFF80;
if(cs->predictor & 0x8000)
cs->predictor -= 0x10000;
cs->predictor = av_clip_int16(cs->predictor);
cs->step_index = (*src++) & 0x7F;
if (cs->step_index > 88){
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
cs->step_index = 88;
}
cs->step = step_table[cs->step_index];
if (st && channel)
samples++;
for(m=32; n>0 && m>0; n--, m--) {
*samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);
samples += avctx->channels;
*samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3);
samples += avctx->channels;
src ++;
}
if(st) {
c->channel = (channel + 1) % 2;
if(channel == 1) {
return src - buf;
}
}
break;
case CODEC_ID_ADPCM_IMA_WAV:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
for(i=0; i<avctx->channels; i++){
cs = &(c->status[i]);
cs->predictor = *samples++ = (int16_t)(src[0] + (src[1]<<8));
src+=2;
cs->step_index = *src++;
if (cs->step_index > 88){
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
cs->step_index = 88;
}
if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]);
}
while(src < buf + buf_size){
for(m=0; m<4; m++){
for(i=0; i<=st; i++)
*samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3);
for(i=0; i<=st; i++)
*samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4 , 3);
src++;
}
src += 4*st;
}
break;
case CODEC_ID_ADPCM_4XM:
cs = &(c->status[0]);
c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;
if(st){
c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;
}
c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2;
if(st){
c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2;
}
if (cs->step_index < 0) cs->step_index = 0;
if (cs->step_index > 88) cs->step_index = 88;
m= (buf_size - (src - buf))>>st;
for(i=0; i<m; i++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4);
if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4);
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4);
if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4);
}
src += m<<st;
break;
case CODEC_ID_ADPCM_MS:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
n = buf_size - 7 * avctx->channels;
if (n < 0)
return -1;
block_predictor[0] = av_clip(*src++, 0, 7);
block_predictor[1] = 0;
if (st)
block_predictor[1] = av_clip(*src++, 0, 7);
c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
if (st){
c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
}
c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]];
c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]];
c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]];
c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]];
c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
if (st) src+=2;
c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
if (st) src+=2;
*samples++ = c->status[0].sample1;
if (st) *samples++ = c->status[1].sample1;
*samples++ = c->status[0].sample2;
if (st) *samples++ = c->status[1].sample2;
for(;n>0;n--) {
*samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F);
*samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
src ++;
}
break;
case CODEC_ID_ADPCM_IMA_DK4:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8));
c->status[0].step_index = src[2];
src += 4;
*samples++ = c->status[0].predictor;
if (st) {
c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8));
c->status[1].step_index = src[2];
src += 4;
*samples++ = c->status[1].predictor;
}
while (src < buf + buf_size) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 3);
if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1],
src[0] & 0x0F, 3);
else
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
src[0] & 0x0F, 3);
src++;
}
break;
case CODEC_ID_ADPCM_IMA_DK3:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
if(buf_size + 16 > (samples_end - samples)*3/8)
return -1;
c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8));
c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8));
c->status[0].step_index = src[14];
c->status[1].step_index = src[15];
src += 16;
diff_channel = c->status[1].predictor;
while (1) {
DK3_GET_NEXT_NIBBLE();
adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
DK3_GET_NEXT_NIBBLE();
adpcm_ima_expand_nibble(&c->status[1], nibble, 3);
diff_channel = (diff_channel + c->status[1].predictor) / 2;
*samples++ = c->status[0].predictor + c->status[1].predictor;
*samples++ = c->status[0].predictor - c->status[1].predictor;
DK3_GET_NEXT_NIBBLE();
adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
diff_channel = (diff_channel + c->status[1].predictor) / 2;
*samples++ = c->status[0].predictor + c->status[1].predictor;
*samples++ = c->status[0].predictor - c->status[1].predictor;
}
break;
case CODEC_ID_ADPCM_IMA_WS:
while (src < buf + buf_size) {
if (st) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[1],
src[0] & 0x0F, 3);
} else {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
src[0] & 0x0F, 3);
}
src++;
}
break;
case CODEC_ID_ADPCM_XA:
while (buf_size >= 128) {
xa_decode(samples, src, &c->status[0], &c->status[1],
avctx->channels);
src += 128;
samples += 28 * 8;
buf_size -= 128;
}
break;
case CODEC_ID_ADPCM_IMA_EA_EACS:
samples_in_chunk = bytestream_get_le32(&src) >> (1-st);
if (samples_in_chunk > buf_size-4-(8<<st)) {
src += buf_size - 4;
break;
}
for (i=0; i<=st; i++)
c->status[i].step_index = bytestream_get_le32(&src);
for (i=0; i<=st; i++)
c->status[i].predictor = bytestream_get_le32(&src);
for (; samples_in_chunk; samples_in_chunk--, src++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3);
}
break;
case CODEC_ID_ADPCM_IMA_EA_SEAD:
for (; src < buf+buf_size; src++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6);
*samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6);
}
break;
case CODEC_ID_ADPCM_EA:
samples_in_chunk = AV_RL32(src);
if (samples_in_chunk >= ((buf_size - 12) * 2)) {
src += buf_size;
break;
}
src += 4;
current_left_sample = (int16_t)AV_RL16(src);
src += 2;
previous_left_sample = (int16_t)AV_RL16(src);
src += 2;
current_right_sample = (int16_t)AV_RL16(src);
src += 2;
previous_right_sample = (int16_t)AV_RL16(src);
src += 2;
for (count1 = 0; count1 < samples_in_chunk/28;count1++) {
coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F];
coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4];
coeff1r = ea_adpcm_table[*src & 0x0F];
coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
src++;
shift_left = ((*src >> 4) & 0x0F) + 8;
shift_right = (*src & 0x0F) + 8;
src++;
for (count2 = 0; count2 < 28; count2++) {
next_left_sample = (((*src & 0xF0) << 24) >> shift_left);
next_right_sample = (((*src & 0x0F) << 28) >> shift_right);
src++;
next_left_sample = (next_left_sample +
(current_left_sample * coeff1l) +
(previous_left_sample * coeff2l) + 0x80) >> 8;
next_right_sample = (next_right_sample +
(current_right_sample * coeff1r) +
(previous_right_sample * coeff2r) + 0x80) >> 8;
previous_left_sample = current_left_sample;
current_left_sample = av_clip_int16(next_left_sample);
previous_right_sample = current_right_sample;
current_right_sample = av_clip_int16(next_right_sample);
*samples++ = (unsigned short)current_left_sample;
*samples++ = (unsigned short)current_right_sample;
}
}
break;
case CODEC_ID_ADPCM_EA_R1:
case CODEC_ID_ADPCM_EA_R2:
case CODEC_ID_ADPCM_EA_R3: {
const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3;
int32_t previous_sample, current_sample, next_sample;
int32_t coeff1, coeff2;
uint8_t shift;
unsigned int channel;
uint16_t *samplesC;
const uint8_t *srcC;
samples_in_chunk = (big_endian ? bytestream_get_be32(&src)
: bytestream_get_le32(&src)) / 28;
if (samples_in_chunk > UINT32_MAX/(28*avctx->channels) ||
28*samples_in_chunk*avctx->channels > samples_end-samples) {
src += buf_size - 4;
break;
}
for (channel=0; channel<avctx->channels; channel++) {
srcC = src + (big_endian ? bytestream_get_be32(&src)
: bytestream_get_le32(&src))
+ (avctx->channels-channel-1) * 4;
samplesC = samples + channel;
if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) {
current_sample = (int16_t)bytestream_get_le16(&srcC);
previous_sample = (int16_t)bytestream_get_le16(&srcC);
} else {
current_sample = c->status[channel].predictor;
previous_sample = c->status[channel].prev_sample;
}
for (count1=0; count1<samples_in_chunk; count1++) {
if (*srcC == 0xEE) {
srcC++;
current_sample = (int16_t)bytestream_get_be16(&srcC);
previous_sample = (int16_t)bytestream_get_be16(&srcC);
for (count2=0; count2<28; count2++) {
*samplesC = (int16_t)bytestream_get_be16(&srcC);
samplesC += avctx->channels;
}
} else {
coeff1 = ea_adpcm_table[ (*srcC>>4) & 0x0F ];
coeff2 = ea_adpcm_table[((*srcC>>4) & 0x0F) + 4];
shift = (*srcC++ & 0x0F) + 8;
for (count2=0; count2<28; count2++) {
if (count2 & 1)
next_sample = ((*srcC++ & 0x0F) << 28) >> shift;
else
next_sample = ((*srcC & 0xF0) << 24) >> shift;
next_sample += (current_sample * coeff1) +
(previous_sample * coeff2);
next_sample = av_clip_int16(next_sample >> 8);
previous_sample = current_sample;
current_sample = next_sample;
*samplesC = current_sample;
samplesC += avctx->channels;
}
}
}
if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) {
c->status[channel].predictor = current_sample;
c->status[channel].prev_sample = previous_sample;
}
}
src = src + buf_size - (4 + 4*avctx->channels);
samples += 28 * samples_in_chunk * avctx->channels;
break;
}
case CODEC_ID_ADPCM_EA_XAS:
if (samples_end-samples < 32*4*avctx->channels
|| buf_size < (4+15)*4*avctx->channels) {
src += buf_size;
break;
}
for (channel=0; channel<avctx->channels; channel++) {
int coeff[2][4], shift[4];
short *s2, *s = &samples[channel];
for (n=0; n<4; n++, s+=32*avctx->channels) {
for (i=0; i<2; i++)
coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i];
shift[n] = (src[2]&0x0F) + 8;
for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels)
s2[0] = (src[0]&0xF0) + (src[1]<<8);
}
for (m=2; m<32; m+=2) {
s = &samples[m*avctx->channels + channel];
for (n=0; n<4; n++, src++, s+=32*avctx->channels) {
for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) {
int level = ((*src & (0xF0>>i)) << (24+i)) >> shift[n];
int pred = s2[-1*avctx->channels] * coeff[0][n]
+ s2[-2*avctx->channels] * coeff[1][n];
s2[0] = av_clip_int16((level + pred + 0x80) >> 8);
}
}
}
}
samples += 32*4*avctx->channels;
break;
case CODEC_ID_ADPCM_IMA_AMV:
case CODEC_ID_ADPCM_IMA_SMJPEG:
c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
c->status[0].step_index = bytestream_get_le16(&src);
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
src+=4;
while (src < buf + buf_size) {
char hi, lo;
lo = *src & 0x0F;
hi = (*src >> 4) & 0x0F;
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
FFSWAP(char, hi, lo);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
lo, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
hi, 3);
src++;
}
break;
case CODEC_ID_ADPCM_CT:
while (src < buf + buf_size) {
if (st) {
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F);
*samples++ = adpcm_ct_expand_nibble(&c->status[1],
src[0] & 0x0F);
} else {
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F);
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
src[0] & 0x0F);
}
src++;
}
break;
case CODEC_ID_ADPCM_SBPRO_4:
case CODEC_ID_ADPCM_SBPRO_3:
case CODEC_ID_ADPCM_SBPRO_2:
if (!c->status[0].step_index) {
*samples++ = 128 * (*src++ - 0x80);
if (st)
*samples++ = 128 * (*src++ - 0x80);
c->status[0].step_index = 1;
}
if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
while (src < buf + buf_size) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 4, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
src[0] & 0x0F, 4, 0);
src++;
}
} else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
while (src < buf + buf_size && samples + 2 < samples_end) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 5) & 0x07, 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 2) & 0x07, 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
src[0] & 0x03, 2, 0);
src++;
}
} else {
while (src < buf + buf_size && samples + 3 < samples_end) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 6) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
(src[0] >> 4) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 2) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
src[0] & 0x03, 2, 2);
src++;
}
}
break;
case CODEC_ID_ADPCM_SWF:
{
GetBitContext gb;
const int *table;
int k0, signmask, nb_bits, count;
int size = buf_size*8;
init_get_bits(&gb, buf, size);
nb_bits = get_bits(&gb, 2)+2;
table = swf_index_tables[nb_bits-2];
k0 = 1 << (nb_bits-2);
signmask = 1 << (nb_bits-1);
while (get_bits_count(&gb) <= size - 22*avctx->channels) {
for (i = 0; i < avctx->channels; i++) {
*samples++ = c->status[i].predictor = get_sbits(&gb, 16);
c->status[i].step_index = get_bits(&gb, 6);
}
for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
int i;
for (i = 0; i < avctx->channels; i++) {
int delta = get_bits(&gb, nb_bits);
int step = step_table[c->status[i].step_index];
long vpdiff = 0;
int k = k0;
do {
if (delta & k)
vpdiff += step;
step >>= 1;
k >>= 1;
} while(k);
vpdiff += step;
if (delta & signmask)
c->status[i].predictor -= vpdiff;
else
c->status[i].predictor += vpdiff;
c->status[i].step_index += table[delta & (~signmask)];
c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
c->status[i].predictor = av_clip_int16(c->status[i].predictor);
*samples++ = c->status[i].predictor;
if (samples >= samples_end) {
av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
return -1;
}
}
}
}
src += buf_size;
break;
}
case CODEC_ID_ADPCM_YAMAHA:
while (src < buf + buf_size) {
if (st) {
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
src[0] & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[1],
(src[0] >> 4) & 0x0F);
} else {
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
src[0] & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F);
}
src++;
}
break;
case CODEC_ID_ADPCM_THP:
{
int table[2][16];
unsigned int samplecnt;
int prev[2][2];
int ch;
if (buf_size < 80) {
av_log(avctx, AV_LOG_ERROR, "frame too small\n");
return -1;
}
src+=4;
samplecnt = bytestream_get_be32(&src);
for (i = 0; i < 32; i++)
table[0][i] = (int16_t)bytestream_get_be16(&src);
for (i = 0; i < 4; i++)
prev[0][i] = (int16_t)bytestream_get_be16(&src);
if (samplecnt >= (samples_end - samples) / (st + 1)) {
av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
return -1;
}
for (ch = 0; ch <= st; ch++) {
samples = (unsigned short *) data + ch;
for (i = 0; i < samplecnt / 14; i++) {
int index = (*src >> 4) & 7;
unsigned int exp = 28 - (*src++ & 15);
int factor1 = table[ch][index * 2];
int factor2 = table[ch][index * 2 + 1];
for (n = 0; n < 14; n++) {
int32_t sampledat;
if(n&1) sampledat= *src++ <<28;
else sampledat= (*src&0xF0)<<24;
sampledat = ((prev[ch][0]*factor1
+ prev[ch][1]*factor2) >> 11) + (sampledat>>exp);
*samples = av_clip_int16(sampledat);
prev[ch][1] = prev[ch][0];
prev[ch][0] = *samples++;
samples += st;
}
}
}
samples -= st;
break;
}
default:
return -1;
}
*data_size = (uint8_t *)samples - (uint8_t *)data;
return src - buf;
}
libavcodec/adpcm.c:945: error: Buffer Overrun L2
Offset: [0, 127] Size: 89.
libavcodec/adpcm.c:942:13: <Offset trace>
940. if (cs->step_index > 88){
941. av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
942. cs->step_index = 88;
^
943. }
944.
libavcodec/adpcm.c:942:13: Assignment
940. if (cs->step_index > 88){
941. av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
942. cs->step_index = 88;
^
943. }
944.
libavcodec/adpcm.c:68:1: <Length trace>
66. * this table, but such deviations are negligible:
67. */
68. static const int step_table[89] = {
^
69. 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
70. 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
libavcodec/adpcm.c:68:1: Array declaration
66. * this table, but such deviations are negligible:
67. */
68. static const int step_table[89] = {
^
69. 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
70. 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
libavcodec/adpcm.c:945:20: Array access: Offset: [0, 127] Size: 89
943. }
944.
945. cs->step = step_table[cs->step_index];
^
946.
947. if (st && channel)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/adpcm.c/#L945 |
d2a_code_trace_data_42227 | static int epzs_motion_search4(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int P[10][2],
int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d, dmin;
int map_generation;
const int penalty_factor= c->penalty_factor;
const int size=1;
const int h=8;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
int flags= c->flags;
LOAD_COMMON2
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
map_generation= update_map_generation(c);
dmin = 1000000;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
}else{
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}
if(dmin>64*4){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1169: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1169:9:
1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
^
1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
1171. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1169 |
d2a_code_trace_data_42228 | int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt = 0;
int i;
int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;
char *f = NULL;
int f_len = 0;
i = tm->length;
v = (char *)tm->data;
if (i < 12)
goto err;
if (v[i - 1] == 'Z')
gmt = 1;
for (i = 0; i < 12; i++)
if ((v[i] > '9') || (v[i] < '0'))
goto err;
y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
+ (v[2] - '0') * 10 + (v[3] - '0');
M = (v[4] - '0') * 10 + (v[5] - '0');
if ((M > 12) || (M < 1))
goto err;
d = (v[6] - '0') * 10 + (v[7] - '0');
h = (v[8] - '0') * 10 + (v[9] - '0');
m = (v[10] - '0') * 10 + (v[11] - '0');
if (tm->length >= 14 &&
(v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9')) {
s = (v[12] - '0') * 10 + (v[13] - '0');
if (tm->length >= 15 && v[14] == '.') {
int l = tm->length;
f = &v[14];
f_len = 1;
while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
++f_len;
}
}
if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
_asn1_mon[M - 1], d, h, m, s, f_len, f, y,
(gmt) ? " GMT" : "") <= 0)
return (0);
else
return (1);
err:
BIO_write(bp, "Bad time value", 14);
return (0);
}
apps/x509.c:786: 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:681:17: Call
679. goto end;
680. BN_free(bnser);
681. i2a_ASN1_INTEGER(out, ser);
^
682. ASN1_INTEGER_free(ser);
683. BIO_puts(out, "\n");
crypto/asn1/f_int.c:64:1: Parameter `*a->data`
62. #include <openssl/asn1.h>
63.
64. > int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
65. {
66. int i, n = 0;
apps/x509.c:786:17: Call
784. OPENSSL_free(m);
785. } else if (text == i) {
786. X509_print_ex(out, x, nmflag, certflag);
^
787. } else if (startdate == i) {
788. BIO_puts(out, "notBefore=");
crypto/x509/t_x509.c:97:1: Parameter `*x->cert_info.validity.notBefore->data`
95. }
96.
97. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
98. unsigned long cflag)
99. {
crypto/x509/t_x509.c:183:14: Call
181. if (BIO_write(bp, " Not Before: ", 24) <= 0)
182. goto err;
183. if (!ASN1_TIME_print(bp, X509_get_notBefore(x)))
^
184. goto err;
185. if (BIO_write(bp, "\n Not After : ", 25) <= 0)
crypto/asn1/a_time.c:202:1: Parameter `*tm->data`
200. }
201.
202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
203. {
204. if (tm->type == V_ASN1_UTCTIME)
crypto/asn1/a_time.c:207:16: Call
205. return ASN1_UTCTIME_print(bp, tm);
206. if (tm->type == V_ASN1_GENERALIZEDTIME)
207. return ASN1_GENERALIZEDTIME_print(bp, tm);
^
208. BIO_write(bp, "Bad time value", 14);
209. return (0);
crypto/asn1/a_gentm.c:266:1: <Offset trace>
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data`
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:287:5: Assignment
285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
286. + (v[2] - '0') * 10 + (v[3] - '0');
287. M = (v[4] - '0') * 10 + (v[5] - '0');
^
288. if ((M > 12) || (M < 1))
289. goto err;
crypto/asn1/a_gentm.c:261:1: <Length trace>
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:261:1: Array declaration
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print_ex`
306.
307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y,
^
309. (gmt) ? " GMT" : "") <= 0)
310. return (0);
| https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308 |
d2a_code_trace_data_42229 | ngx_int_t
ngx_http_set_exten(ngx_http_request_t *r)
{
ngx_int_t i;
r->exten.len = 0;
r->exten.data = NULL;
for (i = r->uri.len - 1; i > 1; i--) {
if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
r->exten.len = r->uri.len - i - 1;
r->exten.data = &r->uri.data[i + 1];
break;
} else if (r->uri.data[i] == '/') {
break;
}
}
return NGX_OK;
}
src/http/ngx_http_upstream.c:715: error: Integer Overflow L2
([0, +oo] - 1):unsigned64 by call to `ngx_http_upstream_connect`.
src/http/ngx_http_upstream.c:715:5: Call
713. ngx_resolve_name_done(ctx);
714.
715. ngx_http_upstream_connect(r, r->upstream);
^
716. }
717.
src/http/ngx_http_upstream.c:892:1: Parameter `r->uri.len`
890.
891.
892. static void
^
893. ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
894. {
src/http/ngx_http_upstream.c:937:9: Call
935. if (rc == NGX_BUSY) {
936. ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no live upstreams");
937. ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE);
^
938. return;
939. }
src/http/ngx_http_upstream.c:2580:1: Parameter `r->uri.len`
2578.
2579.
2580. static void
^
2581. ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
2582. ngx_uint_t ft_type)
src/http/ngx_http_upstream.c:2652:44: Call
2650.
2651. ngx_http_upstream_finalize_request(r, u,
2652. ngx_http_upstream_cache_send(r, u));
^
2653. return;
2654. }
src/http/ngx_http_upstream.c:619:1: Parameter `r->uri.len`
617.
618.
619. static ngx_int_t
^
620. ngx_http_upstream_cache_send(ngx_http_request_t *r, ngx_http_upstream_t *u)
621. {
src/http/ngx_http_upstream.c:645:13: Call
643. if (rc == NGX_OK) {
644.
645. if (ngx_http_upstream_process_headers(r, u) != NGX_OK) {
^
646. return NGX_DONE;
647. }
src/http/ngx_http_upstream.c:1612:1: Parameter `r->uri.len`
1610.
1611.
1612. static ngx_int_t
^
1613. ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u)
1614. {
src/http/ngx_http_upstream.c:1675:9: Call
1673. r->valid_unparsed_uri = 0;
1674.
1675. ngx_http_internal_redirect(r, uri, &args);
^
1676. return NGX_DONE;
1677. }
src/http/ngx_http_core_module.c:2165:1: Parameter `r->uri.len`
2163.
2164.
2165. ngx_int_t
^
2166. ngx_http_internal_redirect(ngx_http_request_t *r,
2167. ngx_str_t *uri, ngx_str_t *args)
src/http/ngx_http_core_module.c:2195:9: Call
2193. "internal redirect: \"%V?%V\"", uri, &r->args);
2194.
2195. if (ngx_http_set_exten(r) != NGX_OK) {
^
2196. ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
2197. return NGX_DONE;
src/http/ngx_http_core_module.c:1614:1: <LHS trace>
1612.
1613.
1614. ngx_int_t
^
1615. ngx_http_set_exten(ngx_http_request_t *r)
1616. {
src/http/ngx_http_core_module.c:1614:1: Parameter `r->uri.len`
1612.
1613.
1614. ngx_int_t
^
1615. ngx_http_set_exten(ngx_http_request_t *r)
1616. {
src/http/ngx_http_core_module.c:1622:10: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_http_upstream_connect`
1620. r->exten.data = NULL;
1621.
1622. for (i = r->uri.len - 1; i > 1; i--) {
^
1623. if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
1624.
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_core_module.c/#L1622 |
d2a_code_trace_data_42230 | void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
test/danetest.c:327: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 20 steps of the trace
test/danetest.c:323:14: Call
321. }
322.
323. if (!TEST_ptr(ssl = SSL_new(ctx)))
^
324. return 0;
325. SSL_set_connect_state(ssl);
ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items`
520. }
521.
522. > SSL *SSL_new(SSL_CTX *ctx)
523. {
524. SSL *s;
test/danetest.c:359:9: Call
357. /* Not needed any more, but lead by example and put the error back. */
358. SSL_set_verify_result(ssl, err);
359. SSL_free(ssl);
^
360.
361. if (!TEST_int_eq(err, want)) {
ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items`
966. }
967.
968. > void SSL_free(SSL *s)
969. {
970. int i;
test/danetest.c:323:14: Call
321. }
322.
323. if (!TEST_ptr(ssl = SSL_new(ctx)))
^
324. return 0;
325. SSL_set_connect_state(ssl);
ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items`
520. }
521.
522. > SSL *SSL_new(SSL_CTX *ctx)
523. {
524. SSL *s;
test/danetest.c:327:13: Call
325. SSL_set_connect_state(ssl);
326. if (SSL_dane_enable(ssl, base_name) <= 0) {
327. SSL_free(ssl);
^
328. return 0;
329. }
ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items`
966. }
967.
968. > void SSL_free(SSL *s)
969. {
970. int i;
ssl/ssl_lib.c:999:9: Call
997. /* Make the next call work :-) */
998. if (s->session != NULL) {
999. ssl_clear_bad_session(s);
^
1000. SSL_SESSION_free(s->session);
1001. }
ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items`
1047. }
1048.
1049. > int ssl_clear_bad_session(SSL *s)
1050. {
1051. if ((s->session != NULL) &&
ssl/ssl_sess.c:1054:9: Call
1052. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1053. !(SSL_in_init(s) || SSL_in_before(s))) {
1054. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1055. return (1);
1056. } else
ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items`
723. }
724.
725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:727:12: Call
725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
^
728. }
729.
ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items`
728. }
729.
730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
731. {
732. SSL_SESSION *r;
ssl/ssl_sess.c:740:17: Call
738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
739. ret = 1;
740. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
741. SSL_SESSION_list_remove(ctx, c);
742. }
ssl/ssl_locl.h:721:1: Parameter `lh->num_items`
719. } TLSEXT_INDEX;
720.
721. > DEFINE_LHASH_OF(SSL_SESSION);
722. /* Needed in ssl_cert.c */
723. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:721:1: Call
719. } TLSEXT_INDEX;
720.
721. > DEFINE_LHASH_OF(SSL_SESSION);
722. /* Needed in ssl_cert.c */
723. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_42231 | int ssl3_get_cert_verify(SSL *s)
{
EVP_PKEY *pkey = NULL;
unsigned char *p;
int al, ok, ret = 0;
long n;
int type = 0, i, j;
X509 *peer;
const EVP_MD *md = NULL;
EVP_MD_CTX mctx;
EVP_MD_CTX_init(&mctx);
n = s->method->ssl_get_message(s,
SSL3_ST_SR_CERT_VRFY_A,
SSL3_ST_SR_CERT_VRFY_B,
-1, SSL3_RT_MAX_PLAIN_LENGTH, &ok);
if (!ok)
return ((int)n);
if (s->session->peer != NULL) {
peer = s->session->peer;
pkey = X509_get_pubkey(peer);
type = X509_certificate_type(peer, pkey);
} else {
peer = NULL;
pkey = NULL;
}
if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) {
s->s3->tmp.reuse_message = 1;
if (peer != NULL) {
al = SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_MISSING_VERIFY_MESSAGE);
goto f_err;
}
ret = 1;
goto end;
}
if (peer == NULL) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_NO_CLIENT_CERT_RECEIVED);
al = SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
if (!(type & EVP_PKT_SIGN)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
al = SSL_AD_ILLEGAL_PARAMETER;
goto f_err;
}
if (s->s3->change_cipher_spec) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_CCS_RECEIVED_EARLY);
al = SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
p = (unsigned char *)s->init_msg;
if (n == 64 && (pkey->type == NID_id_GostR3410_94 ||
pkey->type == NID_id_GostR3410_2001)) {
i = 64;
} else {
if (SSL_USE_SIGALGS(s)) {
int rv = tls12_check_peer_sigalg(&md, s, p, pkey);
if (rv == -1) {
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
} else if (rv == 0) {
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
#endif
p += 2;
n -= 2;
}
n2s(p, i);
n -= 2;
if (i > n) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
}
j = EVP_PKEY_size(pkey);
if ((i > j) || (n > j) || (n <= 0)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE);
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
if (SSL_USE_SIGALGS(s)) {
long hdatalen = 0;
void *hdata;
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
if (hdatalen <= 0) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n",
EVP_MD_name(md));
#endif
if (!EVP_VerifyInit_ex(&mctx, md, NULL)
|| !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
if (EVP_VerifyFinal(&mctx, p, i, pkey) <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_SIGNATURE);
goto f_err;
}
} else
#ifndef OPENSSL_NO_RSA
if (pkey->type == EVP_PKEY_RSA) {
i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md,
MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, p, i,
pkey->pkey.rsa);
if (i < 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT);
goto f_err;
}
if (i == 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE);
goto f_err;
}
} else
#endif
#ifndef OPENSSL_NO_DSA
if (pkey->type == EVP_PKEY_DSA) {
j = DSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH, p, i, pkey->pkey.dsa);
if (j <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE);
goto f_err;
}
} else
#endif
#ifndef OPENSSL_NO_ECDSA
if (pkey->type == EVP_PKEY_EC) {
j = ECDSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH, p, i, pkey->pkey.ec);
if (j <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
} else
#endif
if (pkey->type == NID_id_GostR3410_94
|| pkey->type == NID_id_GostR3410_2001) {
unsigned char signature[64];
int idx;
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL);
EVP_PKEY_verify_init(pctx);
if (i != 64) {
fprintf(stderr, "GOST signature length is %d", i);
}
for (idx = 0; idx < 64; idx++) {
signature[63 - idx] = p[idx];
}
j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md,
32);
EVP_PKEY_CTX_free(pctx);
if (j <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
} else {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al = SSL_AD_UNSUPPORTED_CERTIFICATE;
goto f_err;
}
ret = 1;
if (0) {
f_err:
ssl3_send_alert(s, SSL3_AL_FATAL, al);
}
end:
if (s->s3->handshake_buffer) {
BIO_free(s->s3->handshake_buffer);
s->s3->handshake_buffer = NULL;
s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE;
}
EVP_MD_CTX_cleanup(&mctx);
EVP_PKEY_free(pkey);
return (ret);
}
ssl/s3_srvr.c:2914: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 2870 could be null and is dereferenced at line 2914, column 21.
Showing all 27 steps of the trace
ssl/s3_srvr.c:2848:1: start of procedure ssl3_get_cert_verify()
2846. }
2847.
2848. > int ssl3_get_cert_verify(SSL *s)
2849. {
2850. EVP_PKEY *pkey = NULL;
ssl/s3_srvr.c:2850:5:
2848. int ssl3_get_cert_verify(SSL *s)
2849. {
2850. > EVP_PKEY *pkey = NULL;
2851. unsigned char *p;
2852. int al, ok, ret = 0;
ssl/s3_srvr.c:2852:5:
2850. EVP_PKEY *pkey = NULL;
2851. unsigned char *p;
2852. > int al, ok, ret = 0;
2853. long n;
2854. int type = 0, i, j;
ssl/s3_srvr.c:2854:5:
2852. int al, ok, ret = 0;
2853. long n;
2854. > int type = 0, i, j;
2855. X509 *peer;
2856. const EVP_MD *md = NULL;
ssl/s3_srvr.c:2856:5:
2854. int type = 0, i, j;
2855. X509 *peer;
2856. > const EVP_MD *md = NULL;
2857. EVP_MD_CTX mctx;
2858. EVP_MD_CTX_init(&mctx);
ssl/s3_srvr.c:2858:5:
2856. const EVP_MD *md = NULL;
2857. EVP_MD_CTX mctx;
2858. > EVP_MD_CTX_init(&mctx);
2859.
2860. n = s->method->ssl_get_message(s,
crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init()
118. #endif
119.
120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
121. {
122. memset(ctx, '\0', sizeof *ctx);
crypto/evp/digest.c:122:5:
120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
121. {
122. > memset(ctx, '\0', sizeof *ctx);
123. }
124.
crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init
121. {
122. memset(ctx, '\0', sizeof *ctx);
123. > }
124.
125. EVP_MD_CTX *EVP_MD_CTX_create(void)
ssl/s3_srvr.c:2860:5: Skipping __function_pointer__(): unresolved function pointer
2858. EVP_MD_CTX_init(&mctx);
2859.
2860. n = s->method->ssl_get_message(s,
^
2861. SSL3_ST_SR_CERT_VRFY_A,
2862. SSL3_ST_SR_CERT_VRFY_B,
ssl/s3_srvr.c:2865:10: Taking false branch
2863. -1, SSL3_RT_MAX_PLAIN_LENGTH, &ok);
2864.
2865. if (!ok)
^
2866. return ((int)n);
2867.
ssl/s3_srvr.c:2868:9: Taking true branch
2866. return ((int)n);
2867.
2868. if (s->session->peer != NULL) {
^
2869. peer = s->session->peer;
2870. pkey = X509_get_pubkey(peer);
ssl/s3_srvr.c:2869:9:
2867.
2868. if (s->session->peer != NULL) {
2869. > peer = s->session->peer;
2870. pkey = X509_get_pubkey(peer);
2871. type = X509_certificate_type(peer, pkey);
ssl/s3_srvr.c:2870:9:
2868. if (s->session->peer != NULL) {
2869. peer = s->session->peer;
2870. > pkey = X509_get_pubkey(peer);
2871. type = X509_certificate_type(peer, pkey);
2872. } else {
crypto/x509/x509_cmp.c:306:1: start of procedure X509_get_pubkey()
304. }
305.
306. > EVP_PKEY *X509_get_pubkey(X509 *x)
307. {
308. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:308:10: Taking false branch
306. EVP_PKEY *X509_get_pubkey(X509 *x)
307. {
308. if ((x == NULL) || (x->cert_info == NULL))
^
309. return (NULL);
310. return (X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:308:25: Taking true branch
306. EVP_PKEY *X509_get_pubkey(X509 *x)
307. {
308. if ((x == NULL) || (x->cert_info == NULL))
^
309. return (NULL);
310. return (X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:309:9:
307. {
308. if ((x == NULL) || (x->cert_info == NULL))
309. > return (NULL);
310. return (X509_PUBKEY_get(x->cert_info->key));
311. }
crypto/x509/x509_cmp.c:311:1: return from a call to X509_get_pubkey
309. return (NULL);
310. return (X509_PUBKEY_get(x->cert_info->key));
311. > }
312.
313. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
ssl/s3_srvr.c:2871:9: Skipping X509_certificate_type(): empty list of specs
2869. peer = s->session->peer;
2870. pkey = X509_get_pubkey(peer);
2871. type = X509_certificate_type(peer, pkey);
^
2872. } else {
2873. peer = NULL;
ssl/s3_srvr.c:2877:9: Taking false branch
2875. }
2876.
2877. if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) {
^
2878. s->s3->tmp.reuse_message = 1;
2879. if (peer != NULL) {
ssl/s3_srvr.c:2888:9: Taking false branch
2886. }
2887.
2888. if (peer == NULL) {
^
2889. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_NO_CLIENT_CERT_RECEIVED);
2890. al = SSL_AD_UNEXPECTED_MESSAGE;
ssl/s3_srvr.c:2894:11: Taking false branch
2892. }
2893.
2894. if (!(type & EVP_PKT_SIGN)) {
^
2895. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
2896. SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
ssl/s3_srvr.c:2901:9: Taking false branch
2899. }
2900.
2901. if (s->s3->change_cipher_spec) {
^
2902. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_CCS_RECEIVED_EARLY);
2903. al = SSL_AD_UNEXPECTED_MESSAGE;
ssl/s3_srvr.c:2908:5:
2906.
2907. /* we now have a signature that we need to verify */
2908. > p = (unsigned char *)s->init_msg;
2909. /* Check for broken implementations of GOST ciphersuites */
2910. /*
ssl/s3_srvr.c:2914:9: Taking true branch
2912. * length field
2913. */
2914. if (n == 64 && (pkey->type == NID_id_GostR3410_94 ||
^
2915. pkey->type == NID_id_GostR3410_2001)) {
2916. i = 64;
ssl/s3_srvr.c:2914:21:
2912. * length field
2913. */
2914. > if (n == 64 && (pkey->type == NID_id_GostR3410_94 ||
2915. pkey->type == NID_id_GostR3410_2001)) {
2916. i = 64;
| https://github.com/openssl/openssl/blob/eadf70d2c885e3e4e943091eabfec1e73d4f3883/ssl/s3_srvr.c/#L2914 |
d2a_code_trace_data_42232 | int UI_dup_input_string(UI *ui, const char *prompt, int flags,
char *result_buf, int minsize, int maxsize)
{
char *prompt_copy = NULL;
if (prompt) {
prompt_copy = OPENSSL_strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
return 0;
}
}
return general_allocate_string(ui, prompt_copy, 1,
UIT_PROMPT, flags, result_buf, minsize,
maxsize, NULL);
}
crypto/ui/ui_lib.c:214: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_strdup()` at line 207, column 23 is not reachable after line 214, column 5.
Showing all 30 steps of the trace
crypto/ui/ui_lib.c:201:1: start of procedure UI_dup_input_string()
199.
200. /* Same as UI_add_input_string(), excepts it takes a copy of the prompt */
201. > int UI_dup_input_string(UI *ui, const char *prompt, int flags,
202. char *result_buf, int minsize, int maxsize)
203. {
crypto/ui/ui_lib.c:204:5:
202. char *result_buf, int minsize, int maxsize)
203. {
204. > char *prompt_copy = NULL;
205.
206. if (prompt) {
crypto/ui/ui_lib.c:206:9: Taking true branch
204. char *prompt_copy = NULL;
205.
206. if (prompt) {
^
207. prompt_copy = OPENSSL_strdup(prompt);
208. if (prompt_copy == NULL) {
crypto/ui/ui_lib.c:207:9:
205.
206. if (prompt) {
207. > prompt_copy = OPENSSL_strdup(prompt);
208. if (prompt_copy == NULL) {
209. UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
crypto/o_str.c:28:1: start of procedure CRYPTO_strdup()
26. }
27.
28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
29. {
30. char *ret;
crypto/o_str.c:33:9: Taking false branch
31. size_t size;
32.
33. if (str == NULL)
^
34. return NULL;
35. size = strlen(str) + 1;
crypto/o_str.c:35:5:
33. if (str == NULL)
34. return NULL;
35. > size = strlen(str) + 1;
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
crypto/o_str.c:36:5:
34. return NULL;
35. size = strlen(str) + 1;
36. > ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
38. memcpy(ret, str, size);
crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
69. }
70.
71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. void *ret = NULL;
crypto/mem.c:73:5:
71. void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. > void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:75:9: Taking false branch
73. void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
76. return malloc_impl(num, file, line);
77.
crypto/mem.c:78:9: Taking false branch
76. return malloc_impl(num, file, line);
77.
78. if (num <= 0)
^
79. return NULL;
80.
crypto/mem.c:81:5:
79. return NULL;
80.
81. > allow_customize = 0;
82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
83. if (call_malloc_debug) {
crypto/mem.c:91:5:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:91:24:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:92:5:
90. #else
91. osslargused(file); osslargused(line);
92. > ret = malloc(num);
93. #endif
94.
crypto/mem.c:95:5:
93. #endif
94.
95. > return ret;
96. }
97.
crypto/mem.c:96:1: return from a call to CRYPTO_malloc
94.
95. return ret;
96. > }
97.
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:37:9: Taking true branch
35. size = strlen(str) + 1;
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
^
38. memcpy(ret, str, size);
39. return ret;
crypto/o_str.c:38:9:
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
38. > memcpy(ret, str, size);
39. return ret;
40. }
crypto/o_str.c:39:5:
37. if (ret != NULL)
38. memcpy(ret, str, size);
39. > return ret;
40. }
41.
crypto/o_str.c:40:1: return from a call to CRYPTO_strdup
38. memcpy(ret, str, size);
39. return ret;
40. > }
41.
42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/ui/ui_lib.c:208:13: Taking false branch
206. if (prompt) {
207. prompt_copy = OPENSSL_strdup(prompt);
208. if (prompt_copy == NULL) {
^
209. UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
210. return 0;
crypto/ui/ui_lib.c:214:5:
212. }
213.
214. > return general_allocate_string(ui, prompt_copy, 1,
215. UIT_PROMPT, flags, result_buf, minsize,
216. maxsize, NULL);
crypto/ui/ui_lib.c:113:1: start of procedure general_allocate_string()
111. }
112.
113. > static int general_allocate_string(UI *ui, const char *prompt,
114. int prompt_freeable,
115. enum UI_string_types type, int input_flags,
crypto/ui/ui_lib.c:119:5:
117. const char *test_buf)
118. {
119. > int ret = -1;
120. UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
121. type, input_flags, result_buf);
crypto/ui/ui_lib.c:120:5: Skipping general_allocate_prompt(): empty list of specs
118. {
119. int ret = -1;
120. UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
^
121. type, input_flags, result_buf);
122.
crypto/ui/ui_lib.c:123:9: Taking false branch
121. type, input_flags, result_buf);
122.
123. if (s) {
^
124. if (allocate_string_stack(ui) >= 0) {
125. s->_.string_data.result_minsize = minsize;
crypto/ui/ui_lib.c:137:5:
135. free_string(s);
136. }
137. > return ret;
138. }
139.
crypto/ui/ui_lib.c:138:1: return from a call to general_allocate_string
136. }
137. return ret;
138. > }
139.
140. static int general_allocate_boolean(UI *ui,
| https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/ui/ui_lib.c/#L214 |
d2a_code_trace_data_42233 | 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:60: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `s->s3->previous_client_finished_len` + `pkt->written` + 7]):unsigned64 by call to `WPACKET_memcpy`.
Showing all 10 steps of the trace
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->buf->length`
281. }
282.
283. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
284. {
285. unsigned char *dest;
ssl/t1_reneg.c:60:17: Call
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,
^
61. s->s3->previous_server_finished_len)
62. || !WPACKET_close(pkt)
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, s->s3->previous_client_finished_len + 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_42234 | 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 {
OSSL_UNION_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;
if (!ossl_assert(data_plus_mac_plus_padding_size < 1024 * 1024))
return 0;
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:
if (md_out_size != NULL)
*md_out_size = 0;
return ossl_assert(0);
}
if (!ossl_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES)
|| !ossl_assert(md_block_size <= MAX_HASH_BLOCK_SIZE)
|| !ossl_assert(md_size <= EVP_MAX_MD_SIZE))
return 0;
header_length = 13;
if (is_sslv3) {
header_length = mac_secret_length + sslv3_pad_length + 8 +
1 +
2 ;
}
variance_blocks = is_sslv3 ? 2 : ( ((255 + 1 + md_size + md_block_size - 1) / md_block_size) + 1);
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);
if (!ossl_assert(mac_secret_length <= sizeof(hmac_pad)))
return 0;
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:1272: error: BUFFER_OVERRUN_L3
Offset added: [-63, +oo] Size: 128 by call to `ssl3_cbc_digest_record`.
Showing all 11 steps of the trace
ssl/record/ssl3_record.c:1236:9: Call
1234. }
1235.
1236. t = EVP_MD_CTX_size(hash);
^
1237. if (t < 0)
1238. return 0;
crypto/evp/evp_lib.c:509:9: Assignment
507. if (md == NULL) {
508. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
509. return -1;
^
510. }
511.
ssl/record/ssl3_record.c:1236:5: Assignment
1234. }
1235.
1236. t = EVP_MD_CTX_size(hash);
^
1237. if (t < 0)
1238. return 0;
ssl/record/ssl3_record.c:1239:5: Assignment
1237. if (t < 0)
1238. return 0;
1239. md_size = t;
^
1240. npad = (48 / md_size) * md_size;
1241.
ssl/record/ssl3_record.c:1272:13: Call
1270.
1271. /* Final param == is SSLv3 */
1272. if (ssl3_cbc_digest_record(hash,
^
1273. md, &md_size,
1274. header, rec->input,
ssl/s3_cbc.c:144:5: <Offset trace>
142. void (*md_final_raw) (void *ctx, unsigned char *md_out);
143. void (*md_transform) (void *ctx, const unsigned char *block);
144. size_t md_size, md_block_size = 64;
^
145. size_t sslv3_pad_length = 40, header_length, variance_blocks,
146. len, max_mac_bytes, num_blocks,
ssl/s3_cbc.c:144:5: Assignment
142. void (*md_final_raw) (void *ctx, unsigned char *md_out);
143. void (*md_transform) (void *ctx, const unsigned char *block);
144. size_t md_size, md_block_size = 64;
^
145. size_t sslv3_pad_length = 40, header_length, variance_blocks,
146. len, max_mac_bytes, num_blocks,
ssl/s3_cbc.c:377:13: Assignment
375. return 0;
376. }
377. overhang = header_length - md_block_size;
^
378. md_transform(md_state.c, header);
379. memcpy(first_block, header + md_block_size, overhang);
ssl/s3_cbc.c:128:1: <Length trace>
126. * Returns 1 on success or 0 on error
127. */
128. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
129. unsigned char *md_out,
130. size_t *md_out_size,
ssl/s3_cbc.c:128:1: Array declaration
126. * Returns 1 on success or 0 on error
127. */
128. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
129. unsigned char *md_out,
130. size_t *md_out_size,
ssl/s3_cbc.c:379:13: Array access: Offset added: [-63, +oo] Size: 128 by call to `ssl3_cbc_digest_record`
377. overhang = header_length - md_block_size;
378. md_transform(md_state.c, header);
379. memcpy(first_block, header + md_block_size, overhang);
^
380. memcpy(first_block + overhang, data, md_block_size - overhang);
381. md_transform(md_state.c, first_block);
| https://github.com/openssl/openssl/blob/f1d3df3e69601f6f9f8070705543794f9b6696e2/ssl/s3_cbc.c/#L379 |
d2a_code_trace_data_42235 | int test_sqr(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *c, *d, *e;
int i, ret = 0;
a = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
if (a == NULL || c == NULL || d == NULL || e == NULL) {
goto err;
}
for (i = 0; i < num0; i++) {
BN_bntest_rand(a, 40 + i * 10, 0, 0);
a->neg = rand_neg();
BN_sqr(c, a, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " * ");
BN_print(bp, a);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_div(d, e, c, a, ctx);
BN_sub(d, d, a);
if (!BN_is_zero(d) || !BN_is_zero(e)) {
fprintf(stderr, "Square test failed!\n");
goto err;
}
}
BN_hex2bn(&a,
"80000000000000008000000000000001"
"FFFFFFFFFFFFFFFE0000000000000000");
BN_sqr(c, a, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " * ");
BN_print(bp, a);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_mul(d, a, a, ctx);
if (BN_cmp(c, d)) {
fprintf(stderr, "Square test failed: BN_sqr and BN_mul produce "
"different results!\n");
goto err;
}
BN_hex2bn(&a,
"80000000000000000000000080000001"
"FFFFFFFE000000000000000000000000");
BN_sqr(c, a, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " * ");
BN_print(bp, a);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_mul(d, a, a, ctx);
if (BN_cmp(c, d)) {
fprintf(stderr, "Square test failed: BN_sqr and BN_mul produce "
"different results!\n");
goto err;
}
ret = 1;
err:
BN_free(a);
BN_free(c);
BN_free(d);
BN_free(e);
return ret;
}
test/bntest.c:734: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 703, column 9 is not reachable after line 734, column 5.
Showing all 97 steps of the trace
test/bntest.c:698:1: start of procedure test_sqr()
696. }
697.
698. > int test_sqr(BIO *bp, BN_CTX *ctx)
699. {
700. BIGNUM *a, *c, *d, *e;
test/bntest.c:701:5:
699. {
700. BIGNUM *a, *c, *d, *e;
701. > int i, ret = 0;
702.
703. a = BN_new();
test/bntest.c:703:5:
701. int i, ret = 0;
702.
703. > a = BN_new();
704. c = BN_new();
705. 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:704:5:
702.
703. a = BN_new();
704. > c = BN_new();
705. d = BN_new();
706. 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:705:5:
703. a = BN_new();
704. c = BN_new();
705. > d = BN_new();
706. e = BN_new();
707. if (a == NULL || c == NULL || d == NULL || e == 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:706:5:
704. c = BN_new();
705. d = BN_new();
706. > e = BN_new();
707. if (a == NULL || c == NULL || d == NULL || e == NULL) {
708. 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:707:9: Taking false branch
705. d = BN_new();
706. e = BN_new();
707. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
708. goto err;
709. }
test/bntest.c:707:22: Taking false branch
705. d = BN_new();
706. e = BN_new();
707. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
708. goto err;
709. }
test/bntest.c:707:35: Taking false branch
705. d = BN_new();
706. e = BN_new();
707. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
708. goto err;
709. }
test/bntest.c:707:48: Taking false branch
705. d = BN_new();
706. e = BN_new();
707. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
708. goto err;
709. }
test/bntest.c:711:10:
709. }
710.
711. > for (i = 0; i < num0; i++) {
712. BN_bntest_rand(a, 40 + i * 10, 0, 0);
713. a->neg = rand_neg();
test/bntest.c:711:17: Loop condition is false. Leaving loop
709. }
710.
711. for (i = 0; i < num0; i++) {
^
712. BN_bntest_rand(a, 40 + i * 10, 0, 0);
713. a->neg = rand_neg();
test/bntest.c:734:5: Skipping BN_hex2bn(): empty list of specs
732.
733. /* Regression test for a BN_sqr overflow bug. */
734. BN_hex2bn(&a,
^
735. "80000000000000008000000000000001"
736. "FFFFFFFFFFFFFFFE0000000000000000");
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L734 |
d2a_code_trace_data_42236 | 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:1062: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 15]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 12 steps of the trace
ssl/t1_lib.c:1061:21: Call
1059. || !WPACKET_start_sub_packet_u16(pkt)
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
^
1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
ssl/packet.c: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:1062:21: Call
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
^
1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
1064. strlen(s->tlsext_hostname))
ssl/packet.c: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 + pkt->written + 15]):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_42237 | void
ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
{
ngx_connection_t *c;
ngx_http_request_t *pr;
ngx_http_core_loc_conf_t *clcf;
c = r->connection;
ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http finalize request: %i, \"%V?%V\" a:%d, c:%d",
rc, &r->uri, &r->args, r == c->data, r->main->count);
if (rc == NGX_DONE) {
ngx_http_finalize_connection(r);
return;
}
if (rc == NGX_OK && r->filter_finalize) {
c->error = 1;
}
if (rc == NGX_DECLINED) {
r->content_handler = NULL;
r->write_event_handler = ngx_http_core_run_phases;
ngx_http_core_run_phases(r);
return;
}
if (r != r->main && r->post_subrequest) {
rc = r->post_subrequest->handler(r, r->post_subrequest->data, rc);
}
if (rc == NGX_ERROR
|| rc == NGX_HTTP_REQUEST_TIME_OUT
|| rc == NGX_HTTP_CLIENT_CLOSED_REQUEST
|| c->error)
{
if (ngx_http_post_action(r) == NGX_OK) {
return;
}
if (r->main->blocked) {
r->write_event_handler = ngx_http_request_finalizer;
}
ngx_http_terminate_request(r, rc);
return;
}
if (rc >= NGX_HTTP_SPECIAL_RESPONSE
|| rc == NGX_HTTP_CREATED
|| rc == NGX_HTTP_NO_CONTENT)
{
if (rc == NGX_HTTP_CLOSE) {
ngx_http_terminate_request(r, rc);
return;
}
if (r == r->main) {
if (c->read->timer_set) {
ngx_del_timer(c->read);
}
if (c->write->timer_set) {
ngx_del_timer(c->write);
}
}
c->read->handler = ngx_http_request_handler;
c->write->handler = ngx_http_request_handler;
ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc));
return;
}
if (r != r->main) {
if (r->buffered || r->postponed) {
if (ngx_http_set_write_handler(r) != NGX_OK) {
ngx_http_terminate_request(r, 0);
}
return;
}
pr = r->parent;
if (r == c->data) {
r->main->count--;
if (!r->logged) {
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->log_subrequest) {
ngx_http_log_request(r);
}
r->logged = 1;
} else {
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
"subrequest: \"%V?%V\" logged again",
&r->uri, &r->args);
}
r->done = 1;
if (pr->postponed && pr->postponed->request == r) {
pr->postponed = pr->postponed->next;
}
c->data = pr;
} else {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http finalize non-active request: \"%V?%V\"",
&r->uri, &r->args);
r->write_event_handler = ngx_http_request_finalizer;
if (r->waited) {
r->done = 1;
}
}
if (ngx_http_post_request(pr, NULL) != NGX_OK) {
r->main->count++;
ngx_http_terminate_request(r, 0);
return;
}
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http wake parent request: \"%V?%V\"",
&pr->uri, &pr->args);
return;
}
if (r->buffered || c->buffered || r->postponed || r->blocked) {
if (ngx_http_set_write_handler(r) != NGX_OK) {
ngx_http_terminate_request(r, 0);
}
return;
}
if (r != c->data) {
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
"http finalize non-active request: \"%V?%V\"",
&r->uri, &r->args);
return;
}
r->done = 1;
r->write_event_handler = ngx_http_request_empty_handler;
if (!r->post_action) {
r->request_complete = 1;
}
if (ngx_http_post_action(r) == NGX_OK) {
return;
}
if (c->read->timer_set) {
ngx_del_timer(c->read);
}
if (c->write->timer_set) {
c->write->delayed = 0;
ngx_del_timer(c->write);
}
if (c->read->eof) {
ngx_http_close_request(r, 0);
return;
}
ngx_http_finalize_connection(r);
}
src/http/ngx_http_upstream.c:712: error: Integer Overflow L2
([0, 3+max(64532, `r->main->count`)] - 1):unsigned32 by call to `ngx_http_upstream_connect`.
src/http/ngx_http_upstream.c:535:1: Parameter `r->main->count`
533.
534.
535. static void
^
536. ngx_http_upstream_init_request(ngx_http_request_t *r)
537. {
src/http/ngx_http_upstream.c:712:13: Call
710. }
711.
712. ngx_http_upstream_connect(r, u);
^
713.
714. return;
src/http/ngx_http_upstream.c:1454:1: Parameter `r->main->count`
1452.
1453.
1454. static void
^
1455. ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
1456. {
src/http/ngx_http_upstream.c:1494:9: Call
1492. if (rc == NGX_BUSY) {
1493. ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no live upstreams");
1494. ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE);
^
1495. return;
1496. }
src/http/ngx_http_upstream.c:4105:1: Parameter `r->main->count`
4103.
4104.
4105. static void
^
4106. ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
4107. ngx_uint_t ft_type)
src/http/ngx_http_upstream.c:4168:9: Call
4166.
4167. if (r->connection->error) {
4168. ngx_http_upstream_finalize_request(r, u,
^
4169. NGX_HTTP_CLIENT_CLOSED_REQUEST);
4170. return;
src/http/ngx_http_upstream.c:4249:1: Parameter `r->main->count`
4247.
4248.
4249. static void
^
4250. ngx_http_upstream_finalize_request(ngx_http_request_t *r,
4251. ngx_http_upstream_t *u, ngx_int_t rc)
src/http/ngx_http_upstream.c:4392:9: Call
4390.
4391. if (r->header_only) {
4392. ngx_http_finalize_request(r, rc);
^
4393. return;
4394. }
src/http/ngx_http_request.c:2263:1: <LHS trace>
2261.
2262.
2263. void
^
2264. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
2265. {
src/http/ngx_http_request.c:2263:1: Parameter `r->main->count`
2261.
2262.
2263. void
^
2264. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
2265. {
src/http/ngx_http_request.c:2354:13: Binary operation: ([0, 3+max(64532, r->main->count)] - 1):unsigned32 by call to `ngx_http_upstream_connect`
2352. if (r == c->data) {
2353.
2354. r->main->count--;
^
2355.
2356. if (!r->logged) {
| https://github.com/nginx/nginx/blob/b9a031622b7bf586a9c724dade16abfac188f2f2/src/http/ngx_http_request.c/#L2354 |
d2a_code_trace_data_42238 | static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num)
{
const SHA_LONG64 *W=in;
SHA_LONG64 a,b,c,d,e,f,g,h,s0,s1,T1;
SHA_LONG64 X[16];
int i;
while (num--) {
a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3];
e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7];
#ifdef B_ENDIAN
T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h);
T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g);
T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f);
T1 = X[3] = W[3]; ROUND_00_15(3,f,g,h,a,b,c,d,e);
T1 = X[4] = W[4]; ROUND_00_15(4,e,f,g,h,a,b,c,d);
T1 = X[5] = W[5]; ROUND_00_15(5,d,e,f,g,h,a,b,c);
T1 = X[6] = W[6]; ROUND_00_15(6,c,d,e,f,g,h,a,b);
T1 = X[7] = W[7]; ROUND_00_15(7,b,c,d,e,f,g,h,a);
T1 = X[8] = W[8]; ROUND_00_15(8,a,b,c,d,e,f,g,h);
T1 = X[9] = W[9]; ROUND_00_15(9,h,a,b,c,d,e,f,g);
T1 = X[10] = W[10]; ROUND_00_15(10,g,h,a,b,c,d,e,f);
T1 = X[11] = W[11]; ROUND_00_15(11,f,g,h,a,b,c,d,e);
T1 = X[12] = W[12]; ROUND_00_15(12,e,f,g,h,a,b,c,d);
T1 = X[13] = W[13]; ROUND_00_15(13,d,e,f,g,h,a,b,c);
T1 = X[14] = W[14]; ROUND_00_15(14,c,d,e,f,g,h,a,b);
T1 = X[15] = W[15]; ROUND_00_15(15,b,c,d,e,f,g,h,a);
#else
T1 = X[0] = PULL64(W[0]); ROUND_00_15(0,a,b,c,d,e,f,g,h);
T1 = X[1] = PULL64(W[1]); ROUND_00_15(1,h,a,b,c,d,e,f,g);
T1 = X[2] = PULL64(W[2]); ROUND_00_15(2,g,h,a,b,c,d,e,f);
T1 = X[3] = PULL64(W[3]); ROUND_00_15(3,f,g,h,a,b,c,d,e);
T1 = X[4] = PULL64(W[4]); ROUND_00_15(4,e,f,g,h,a,b,c,d);
T1 = X[5] = PULL64(W[5]); ROUND_00_15(5,d,e,f,g,h,a,b,c);
T1 = X[6] = PULL64(W[6]); ROUND_00_15(6,c,d,e,f,g,h,a,b);
T1 = X[7] = PULL64(W[7]); ROUND_00_15(7,b,c,d,e,f,g,h,a);
T1 = X[8] = PULL64(W[8]); ROUND_00_15(8,a,b,c,d,e,f,g,h);
T1 = X[9] = PULL64(W[9]); ROUND_00_15(9,h,a,b,c,d,e,f,g);
T1 = X[10] = PULL64(W[10]); ROUND_00_15(10,g,h,a,b,c,d,e,f);
T1 = X[11] = PULL64(W[11]); ROUND_00_15(11,f,g,h,a,b,c,d,e);
T1 = X[12] = PULL64(W[12]); ROUND_00_15(12,e,f,g,h,a,b,c,d);
T1 = X[13] = PULL64(W[13]); ROUND_00_15(13,d,e,f,g,h,a,b,c);
T1 = X[14] = PULL64(W[14]); ROUND_00_15(14,c,d,e,f,g,h,a,b);
T1 = X[15] = PULL64(W[15]); ROUND_00_15(15,b,c,d,e,f,g,h,a);
#endif
for (i=16;i<80;i+=16)
{
ROUND_16_80(i, 0,a,b,c,d,e,f,g,h,X);
ROUND_16_80(i, 1,h,a,b,c,d,e,f,g,X);
ROUND_16_80(i, 2,g,h,a,b,c,d,e,f,X);
ROUND_16_80(i, 3,f,g,h,a,b,c,d,e,X);
ROUND_16_80(i, 4,e,f,g,h,a,b,c,d,X);
ROUND_16_80(i, 5,d,e,f,g,h,a,b,c,X);
ROUND_16_80(i, 6,c,d,e,f,g,h,a,b,X);
ROUND_16_80(i, 7,b,c,d,e,f,g,h,a,X);
ROUND_16_80(i, 8,a,b,c,d,e,f,g,h,X);
ROUND_16_80(i, 9,h,a,b,c,d,e,f,g,X);
ROUND_16_80(i,10,g,h,a,b,c,d,e,f,X);
ROUND_16_80(i,11,f,g,h,a,b,c,d,e,X);
ROUND_16_80(i,12,e,f,g,h,a,b,c,d,X);
ROUND_16_80(i,13,d,e,f,g,h,a,b,c,X);
ROUND_16_80(i,14,c,d,e,f,g,h,a,b,X);
ROUND_16_80(i,15,b,c,d,e,f,g,h,a,X);
}
ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d;
ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
W+=SHA_LBLOCK;
}
}
crypto/sha/sha512.c:574: error: BUFFER_OVERRUN_L2
Offset: [31, 94] Size: 80.
Showing all 5 steps of the trace
crypto/sha/sha512.c:557:7: <Offset trace>
555. #endif
556.
557. for (i=16;i<80;i+=16)
^
558. {
559. ROUND_16_80(i, 0,a,b,c,d,e,f,g,h,X);
crypto/sha/sha512.c:557:7: Assignment
555. #endif
556.
557. for (i=16;i<80;i+=16)
^
558. {
559. ROUND_16_80(i, 0,a,b,c,d,e,f,g,h,X);
crypto/sha/sha512.c:262:1: <Length trace>
260.
261. #ifndef SHA512_ASM
262. > static const SHA_LONG64 K512[80] = {
263. U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd),
264. U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc),
crypto/sha/sha512.c:262:1: Array declaration
260.
261. #ifndef SHA512_ASM
262. > static const SHA_LONG64 K512[80] = {
263. U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd),
264. U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc),
crypto/sha/sha512.c:574:3: Array access: Offset: [31, 94] Size: 80
572. ROUND_16_80(i,13,d,e,f,g,h,a,b,c,X);
573. ROUND_16_80(i,14,c,d,e,f,g,h,a,b,X);
574. ROUND_16_80(i,15,b,c,d,e,f,g,h,a,X);
^
575. }
576.
| https://github.com/openssl/openssl/blob/c313e32a8b9514868f3fae09a8af025df76a4a8d/crypto/sha/sha512.c/#L574 |
d2a_code_trace_data_42239 | static int parse_ffconfig(const char *filename)
{
FILE *f;
char line[1024];
char cmd[64];
char arg[1024];
const char *p;
int val, errors, line_num;
FFStream **last_stream, *stream, *redirect;
FFStream **last_feed, *feed;
AVCodecContext audio_enc, video_enc;
int audio_id, video_id;
f = fopen(filename, "r");
if (!f) {
perror(filename);
return -1;
}
errors = 0;
line_num = 0;
first_stream = NULL;
last_stream = &first_stream;
first_feed = NULL;
last_feed = &first_feed;
stream = NULL;
feed = NULL;
redirect = NULL;
audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE;
for(;;) {
if (fgets(line, sizeof(line), f) == NULL)
break;
line_num++;
p = line;
while (isspace(*p))
p++;
if (*p == '\0' || *p == '#')
continue;
get_arg(cmd, sizeof(cmd), &p);
if (!strcasecmp(cmd, "Port")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > 65536) {
fprintf(stderr, "%s:%d: Invalid port: %s\n",
filename, line_num, arg);
errors++;
}
my_http_addr.sin_port = htons(val);
} else if (!strcasecmp(cmd, "BindAddress")) {
get_arg(arg, sizeof(arg), &p);
if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n",
filename, line_num, arg);
errors++;
}
} else if (!strcasecmp(cmd, "NoDaemon")) {
ffserver_daemon = 0;
} else if (!strcasecmp(cmd, "RTSPPort")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > 65536) {
fprintf(stderr, "%s:%d: Invalid port: %s\n",
filename, line_num, arg);
errors++;
}
my_rtsp_addr.sin_port = htons(atoi(arg));
} else if (!strcasecmp(cmd, "RTSPBindAddress")) {
get_arg(arg, sizeof(arg), &p);
if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) {
fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n",
filename, line_num, arg);
errors++;
}
} else if (!strcasecmp(cmd, "MaxClients")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > HTTP_MAX_CONNECTIONS) {
fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n",
filename, line_num, arg);
errors++;
} else {
nb_max_connections = val;
}
} else if (!strcasecmp(cmd, "MaxBandwidth")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 10 || val > 100000) {
fprintf(stderr, "%s:%d: Invalid MaxBandwidth: %s\n",
filename, line_num, arg);
errors++;
} else
max_bandwidth = val;
} else if (!strcasecmp(cmd, "CustomLog")) {
get_arg(logfilename, sizeof(logfilename), &p);
} else if (!strcasecmp(cmd, "<Feed")) {
char *q;
if (stream || feed) {
fprintf(stderr, "%s:%d: Already in a tag\n",
filename, line_num);
} else {
feed = av_mallocz(sizeof(FFStream));
*last_stream = feed;
last_stream = &feed->next;
*last_feed = feed;
last_feed = &feed->next_feed;
get_arg(feed->filename, sizeof(feed->filename), &p);
q = strrchr(feed->filename, '>');
if (*q)
*q = '\0';
feed->fmt = guess_format("ffm", NULL, NULL);
snprintf(feed->feed_filename, sizeof(feed->feed_filename),
"/tmp/%s.ffm", feed->filename);
feed->feed_max_size = 5 * 1024 * 1024;
feed->is_feed = 1;
feed->feed = feed;
}
} else if (!strcasecmp(cmd, "Launch")) {
if (feed) {
int i;
feed->child_argv = av_mallocz(64 * sizeof(char *));
for (i = 0; i < 62; i++) {
get_arg(arg, sizeof(arg), &p);
if (!arg[0])
break;
feed->child_argv[i] = av_strdup(arg);
}
feed->child_argv[i] = av_malloc(30 + strlen(feed->filename));
snprintf(feed->child_argv[i], 30+strlen(feed->filename),
"http://%s:%d/%s",
(my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" :
inet_ntoa(my_http_addr.sin_addr),
ntohs(my_http_addr.sin_port), feed->filename);
if (ffserver_debug)
{
int j;
fprintf(stdout, "Launch commandline: ");
for (j = 0; j <= i; j++)
fprintf(stdout, "%s ", feed->child_argv[j]);
fprintf(stdout, "\n");
}
}
} else if (!strcasecmp(cmd, "ReadOnlyFile")) {
if (feed) {
get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
feed->readonly = 1;
} else if (stream) {
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
}
} else if (!strcasecmp(cmd, "File")) {
if (feed) {
get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
} else if (stream)
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
} else if (!strcasecmp(cmd, "FileMaxSize")) {
if (feed) {
char *p1;
double fsize;
get_arg(arg, sizeof(arg), &p);
p1 = arg;
fsize = strtod(p1, &p1);
switch(toupper(*p1)) {
case 'K':
fsize *= 1024;
break;
case 'M':
fsize *= 1024 * 1024;
break;
case 'G':
fsize *= 1024 * 1024 * 1024;
break;
}
feed->feed_max_size = (int64_t)fsize;
}
} else if (!strcasecmp(cmd, "</Feed>")) {
if (!feed) {
fprintf(stderr, "%s:%d: No corresponding <Feed> for </Feed>\n",
filename, line_num);
errors++;
}
feed = NULL;
} else if (!strcasecmp(cmd, "<Stream")) {
char *q;
if (stream || feed) {
fprintf(stderr, "%s:%d: Already in a tag\n",
filename, line_num);
} else {
stream = av_mallocz(sizeof(FFStream));
*last_stream = stream;
last_stream = &stream->next;
get_arg(stream->filename, sizeof(stream->filename), &p);
q = strrchr(stream->filename, '>');
if (*q)
*q = '\0';
stream->fmt = guess_stream_format(NULL, stream->filename, NULL);
memset(&audio_enc, 0, sizeof(AVCodecContext));
memset(&video_enc, 0, sizeof(AVCodecContext));
audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE;
if (stream->fmt) {
audio_id = stream->fmt->audio_codec;
video_id = stream->fmt->video_codec;
}
}
} else if (!strcasecmp(cmd, "Feed")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
FFStream *sfeed;
sfeed = first_feed;
while (sfeed != NULL) {
if (!strcmp(sfeed->filename, arg))
break;
sfeed = sfeed->next_feed;
}
if (!sfeed)
fprintf(stderr, "%s:%d: feed '%s' not defined\n",
filename, line_num, arg);
else
stream->feed = sfeed;
}
} else if (!strcasecmp(cmd, "Format")) {
get_arg(arg, sizeof(arg), &p);
if (!strcmp(arg, "status")) {
stream->stream_type = STREAM_TYPE_STATUS;
stream->fmt = NULL;
} else {
stream->stream_type = STREAM_TYPE_LIVE;
if (!strcmp(arg, "jpeg"))
strcpy(arg, "mjpeg");
stream->fmt = guess_stream_format(arg, NULL, NULL);
if (!stream->fmt) {
fprintf(stderr, "%s:%d: Unknown Format: %s\n",
filename, line_num, arg);
errors++;
}
}
if (stream->fmt) {
audio_id = stream->fmt->audio_codec;
video_id = stream->fmt->video_codec;
}
} else if (!strcasecmp(cmd, "InputFormat")) {
get_arg(arg, sizeof(arg), &p);
stream->ifmt = av_find_input_format(arg);
if (!stream->ifmt) {
fprintf(stderr, "%s:%d: Unknown input format: %s\n",
filename, line_num, arg);
}
} else if (!strcasecmp(cmd, "FaviconURL")) {
if (stream && stream->stream_type == STREAM_TYPE_STATUS) {
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
} else {
fprintf(stderr, "%s:%d: FaviconURL only permitted for status streams\n",
filename, line_num);
errors++;
}
} else if (!strcasecmp(cmd, "Author")) {
if (stream)
get_arg(stream->author, sizeof(stream->author), &p);
} else if (!strcasecmp(cmd, "Comment")) {
if (stream)
get_arg(stream->comment, sizeof(stream->comment), &p);
} else if (!strcasecmp(cmd, "Copyright")) {
if (stream)
get_arg(stream->copyright, sizeof(stream->copyright), &p);
} else if (!strcasecmp(cmd, "Title")) {
if (stream)
get_arg(stream->title, sizeof(stream->title), &p);
} else if (!strcasecmp(cmd, "Preroll")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->prebuffer = atof(arg) * 1000;
} else if (!strcasecmp(cmd, "StartSendOnKey")) {
if (stream)
stream->send_on_key = 1;
} else if (!strcasecmp(cmd, "AudioCodec")) {
get_arg(arg, sizeof(arg), &p);
audio_id = opt_audio_codec(arg);
if (audio_id == CODEC_ID_NONE) {
fprintf(stderr, "%s:%d: Unknown AudioCodec: %s\n",
filename, line_num, arg);
errors++;
}
} else if (!strcasecmp(cmd, "VideoCodec")) {
get_arg(arg, sizeof(arg), &p);
video_id = opt_video_codec(arg);
if (video_id == CODEC_ID_NONE) {
fprintf(stderr, "%s:%d: Unknown VideoCodec: %s\n",
filename, line_num, arg);
errors++;
}
} else if (!strcasecmp(cmd, "MaxTime")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->max_time = atof(arg) * 1000;
} else if (!strcasecmp(cmd, "AudioBitRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
audio_enc.bit_rate = atoi(arg) * 1000;
} else if (!strcasecmp(cmd, "AudioChannels")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
audio_enc.channels = atoi(arg);
} else if (!strcasecmp(cmd, "AudioSampleRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
audio_enc.sample_rate = atoi(arg);
} else if (!strcasecmp(cmd, "AudioQuality")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
}
} else if (!strcasecmp(cmd, "VideoBitRateRange")) {
if (stream) {
int minrate, maxrate;
get_arg(arg, sizeof(arg), &p);
if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) {
video_enc.rc_min_rate = minrate * 1000;
video_enc.rc_max_rate = maxrate * 1000;
} else {
fprintf(stderr, "%s:%d: Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n",
filename, line_num, arg);
errors++;
}
}
} else if (!strcasecmp(cmd, "Debug")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.debug = strtol(arg,0,0);
}
} else if (!strcasecmp(cmd, "Strict")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.strict_std_compliance = atoi(arg);
}
} else if (!strcasecmp(cmd, "VideoBufferSize")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.rc_buffer_size = atoi(arg) * 8*1024;
}
} else if (!strcasecmp(cmd, "VideoBitRateTolerance")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.bit_rate_tolerance = atoi(arg) * 1000;
}
} else if (!strcasecmp(cmd, "VideoBitRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.bit_rate = atoi(arg) * 1000;
}
} else if (!strcasecmp(cmd, "VideoSize")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg);
if ((video_enc.width % 16) != 0 ||
(video_enc.height % 16) != 0) {
fprintf(stderr, "%s:%d: Image size must be a multiple of 16\n",
filename, line_num);
errors++;
}
}
} else if (!strcasecmp(cmd, "VideoFrameRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.time_base.num= DEFAULT_FRAME_RATE_BASE;
video_enc.time_base.den = (int)(strtod(arg, NULL) * video_enc.time_base.num);
}
} else if (!strcasecmp(cmd, "VideoGopSize")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.gop_size = atoi(arg);
} else if (!strcasecmp(cmd, "VideoIntraOnly")) {
if (stream)
video_enc.gop_size = 1;
} else if (!strcasecmp(cmd, "VideoHighQuality")) {
if (stream)
video_enc.mb_decision = FF_MB_DECISION_BITS;
} else if (!strcasecmp(cmd, "Video4MotionVector")) {
if (stream) {
video_enc.mb_decision = FF_MB_DECISION_BITS;
video_enc.flags |= CODEC_FLAG_4MV;
}
} else if (!strcasecmp(cmd, "VideoTag")) {
get_arg(arg, sizeof(arg), &p);
if ((strlen(arg) == 4) && stream)
video_enc.codec_tag = ff_get_fourcc(arg);
} else if (!strcasecmp(cmd, "BitExact")) {
if (stream)
video_enc.flags |= CODEC_FLAG_BITEXACT;
} else if (!strcasecmp(cmd, "DctFastint")) {
if (stream)
video_enc.dct_algo = FF_DCT_FASTINT;
} else if (!strcasecmp(cmd, "IdctSimple")) {
if (stream)
video_enc.idct_algo = FF_IDCT_SIMPLE;
} else if (!strcasecmp(cmd, "Qscale")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.flags |= CODEC_FLAG_QSCALE;
video_enc.global_quality = FF_QP2LAMBDA * atoi(arg);
}
} else if (!strcasecmp(cmd, "VideoQDiff")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.max_qdiff = atoi(arg);
if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) {
fprintf(stderr, "%s:%d: VideoQDiff out of range\n",
filename, line_num);
errors++;
}
}
} else if (!strcasecmp(cmd, "VideoQMax")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.qmax = atoi(arg);
if (video_enc.qmax < 1 || video_enc.qmax > 31) {
fprintf(stderr, "%s:%d: VideoQMax out of range\n",
filename, line_num);
errors++;
}
}
} else if (!strcasecmp(cmd, "VideoQMin")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.qmin = atoi(arg);
if (video_enc.qmin < 1 || video_enc.qmin > 31) {
fprintf(stderr, "%s:%d: VideoQMin out of range\n",
filename, line_num);
errors++;
}
}
} else if (!strcasecmp(cmd, "LumaElim")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.luma_elim_threshold = atoi(arg);
} else if (!strcasecmp(cmd, "ChromaElim")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.chroma_elim_threshold = atoi(arg);
} else if (!strcasecmp(cmd, "LumiMask")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.lumi_masking = atof(arg);
} else if (!strcasecmp(cmd, "DarkMask")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.dark_masking = atof(arg);
} else if (!strcasecmp(cmd, "NoVideo")) {
video_id = CODEC_ID_NONE;
} else if (!strcasecmp(cmd, "NoAudio")) {
audio_id = CODEC_ID_NONE;
} else if (!strcasecmp(cmd, "ACL")) {
IPAddressACL acl;
get_arg(arg, sizeof(arg), &p);
if (strcasecmp(arg, "allow") == 0)
acl.action = IP_ALLOW;
else if (strcasecmp(arg, "deny") == 0)
acl.action = IP_DENY;
else {
fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n",
filename, line_num, arg);
errors++;
}
get_arg(arg, sizeof(arg), &p);
if (resolve_host(&acl.first, arg) != 0) {
fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
filename, line_num, arg);
errors++;
} else
acl.last = acl.first;
get_arg(arg, sizeof(arg), &p);
if (arg[0]) {
if (resolve_host(&acl.last, arg) != 0) {
fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
filename, line_num, arg);
errors++;
}
}
if (!errors) {
IPAddressACL *nacl = av_mallocz(sizeof(*nacl));
IPAddressACL **naclp = 0;
acl.next = 0;
*nacl = acl;
if (stream)
naclp = &stream->acl;
else if (feed)
naclp = &feed->acl;
else {
fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n",
filename, line_num);
errors++;
}
if (naclp) {
while (*naclp)
naclp = &(*naclp)->next;
*naclp = nacl;
}
}
} else if (!strcasecmp(cmd, "RTSPOption")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
av_freep(&stream->rtsp_option);
stream->rtsp_option = av_strdup(arg);
}
} else if (!strcasecmp(cmd, "MulticastAddress")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
if (resolve_host(&stream->multicast_ip, arg) != 0) {
fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n",
filename, line_num, arg);
errors++;
}
stream->is_multicast = 1;
stream->loop = 1;
}
} else if (!strcasecmp(cmd, "MulticastPort")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->multicast_port = atoi(arg);
} else if (!strcasecmp(cmd, "MulticastTTL")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->multicast_ttl = atoi(arg);
} else if (!strcasecmp(cmd, "NoLoop")) {
if (stream)
stream->loop = 0;
} else if (!strcasecmp(cmd, "</Stream>")) {
if (!stream) {
fprintf(stderr, "%s:%d: No corresponding <Stream> for </Stream>\n",
filename, line_num);
errors++;
}
if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) {
if (audio_id != CODEC_ID_NONE) {
audio_enc.codec_type = CODEC_TYPE_AUDIO;
audio_enc.codec_id = audio_id;
add_codec(stream, &audio_enc);
}
if (video_id != CODEC_ID_NONE) {
video_enc.codec_type = CODEC_TYPE_VIDEO;
video_enc.codec_id = video_id;
add_codec(stream, &video_enc);
}
}
stream = NULL;
} else if (!strcasecmp(cmd, "<Redirect")) {
char *q;
if (stream || feed || redirect) {
fprintf(stderr, "%s:%d: Already in a tag\n",
filename, line_num);
errors++;
} else {
redirect = av_mallocz(sizeof(FFStream));
*last_stream = redirect;
last_stream = &redirect->next;
get_arg(redirect->filename, sizeof(redirect->filename), &p);
q = strrchr(redirect->filename, '>');
if (*q)
*q = '\0';
redirect->stream_type = STREAM_TYPE_REDIRECT;
}
} else if (!strcasecmp(cmd, "URL")) {
if (redirect)
get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p);
} else if (!strcasecmp(cmd, "</Redirect>")) {
if (!redirect) {
fprintf(stderr, "%s:%d: No corresponding <Redirect> for </Redirect>\n",
filename, line_num);
errors++;
}
if (!redirect->feed_filename[0]) {
fprintf(stderr, "%s:%d: No URL found for <Redirect>\n",
filename, line_num);
errors++;
}
redirect = NULL;
} else if (!strcasecmp(cmd, "LoadModule")) {
get_arg(arg, sizeof(arg), &p);
#ifdef HAVE_DLOPEN
load_module(arg);
#else
fprintf(stderr, "%s:%d: Module support not compiled into this version: '%s'\n",
filename, line_num, arg);
errors++;
#endif
} else {
fprintf(stderr, "%s:%d: Incorrect keyword: '%s'\n",
filename, line_num, cmd);
errors++;
}
}
fclose(f);
if (errors)
return -1;
else
return 0;
}
ffserver.c:4083: error: Uninitialized Value
The value read from video_enc.flags was never initialized.
ffserver.c:4083:17:
4081. } else if (!strcasecmp(cmd, "BitExact")) {
4082. if (stream)
4083. video_enc.flags |= CODEC_FLAG_BITEXACT;
^
4084. } else if (!strcasecmp(cmd, "DctFastint")) {
4085. if (stream)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L4083 |
d2a_code_trace_data_42240 | void *lh_delete(LHASH *lh, void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
void *ret;
lh->error=0;
rn=getrn(lh,data,&hash);
if (*rn == NULL)
{
lh->num_no_delete++;
return(NULL);
}
else
{
nn= *rn;
*rn=nn->next;
ret=nn->data;
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/s3_srvr.c:1486: error: INTEGER_OVERFLOW_L2
([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_send_alert`.
Showing all 13 steps of the trace
ssl/s3_srvr.c:1254:1: Parameter `s->ctx->sessions->num_items`
1252. }
1253.
1254. > static int ssl3_get_client_key_exchange(SSL *s)
1255. {
1256. int i,al,ok;
ssl/s3_srvr.c:1272:4: Call
1270. #endif /* NO_KRB5 */
1271.
1272. n=ssl3_get_message(s,
^
1273. SSL3_ST_SR_KEY_EXCH_A,
1274. SSL3_ST_SR_KEY_EXCH_B,
ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->num_items`
335. * the body is read in state 'stn'.
336. */
337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
338. {
339. unsigned char *p;
ssl/s3_srvr.c:1486:2: Call
1484. return(1);
1485. f_err:
1486. ssl3_send_alert(s,SSL3_AL_FATAL,al);
^
1487. #if !defined(NO_DH) || !defined(NO_RSA)
1488. err:
ssl/s3_pkt.c:1149:1: Parameter `s->ctx->sessions->num_items`
1147. }
1148.
1149. > void ssl3_send_alert(SSL *s, int level, int desc)
1150. {
1151. /* Map tls/ssl alert value to correct one */
ssl/s3_pkt.c:1156:3: Call
1154. /* If a fatal one, remove from cache */
1155. if ((level == 2) && (s->session != NULL))
1156. SSL_CTX_remove_session(s->ctx,s->session);
^
1157.
1158. s->s3->alert_dispatch=1;
ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->num_items`
411. }
412.
413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
414. {
415. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:415:9: Call
413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
414. {
415. return remove_session_lock(ctx, c, 1);
^
416. }
417.
ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->num_items`
416. }
417.
418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
419. {
420. SSL_SESSION *r;
ssl/ssl_sess.c:426:20: Call
424. {
425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
^
427. if (r != NULL)
428. {
crypto/lhash/lhash.c:217:1: <LHS trace>
215. }
216.
217. > void *lh_delete(LHASH *lh, void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
215. }
216.
217. > void *lh_delete(LHASH *lh, void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_send_alert`
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/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/crypto/lhash/lhash.c/#L240 |
d2a_code_trace_data_42241 | static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
{
unsigned MD32_REG_T a,b,c,d,e,f,g,h,s0,s1,T1;
SHA_LONG X[16];
int i;
const unsigned char *data=in;
while (num--) {
a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3];
e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7];
if (host)
{
const SHA_LONG *W=(const SHA_LONG *)data;
T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h);
T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g);
T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f);
T1 = X[3] = W[3]; ROUND_00_15(3,f,g,h,a,b,c,d,e);
T1 = X[4] = W[4]; ROUND_00_15(4,e,f,g,h,a,b,c,d);
T1 = X[5] = W[5]; ROUND_00_15(5,d,e,f,g,h,a,b,c);
T1 = X[6] = W[6]; ROUND_00_15(6,c,d,e,f,g,h,a,b);
T1 = X[7] = W[7]; ROUND_00_15(7,b,c,d,e,f,g,h,a);
T1 = X[8] = W[8]; ROUND_00_15(8,a,b,c,d,e,f,g,h);
T1 = X[9] = W[9]; ROUND_00_15(9,h,a,b,c,d,e,f,g);
T1 = X[10] = W[10]; ROUND_00_15(10,g,h,a,b,c,d,e,f);
T1 = X[11] = W[11]; ROUND_00_15(11,f,g,h,a,b,c,d,e);
T1 = X[12] = W[12]; ROUND_00_15(12,e,f,g,h,a,b,c,d);
T1 = X[13] = W[13]; ROUND_00_15(13,d,e,f,g,h,a,b,c);
T1 = X[14] = W[14]; ROUND_00_15(14,c,d,e,f,g,h,a,b);
T1 = X[15] = W[15]; ROUND_00_15(15,b,c,d,e,f,g,h,a);
}
else
{
SHA_LONG l;
HOST_c2l(data,l); T1 = X[0] = l; ROUND_00_15(0,a,b,c,d,e,f,g,h);
HOST_c2l(data,l); T1 = X[1] = l; ROUND_00_15(1,h,a,b,c,d,e,f,g);
HOST_c2l(data,l); T1 = X[2] = l; ROUND_00_15(2,g,h,a,b,c,d,e,f);
HOST_c2l(data,l); T1 = X[3] = l; ROUND_00_15(3,f,g,h,a,b,c,d,e);
HOST_c2l(data,l); T1 = X[4] = l; ROUND_00_15(4,e,f,g,h,a,b,c,d);
HOST_c2l(data,l); T1 = X[5] = l; ROUND_00_15(5,d,e,f,g,h,a,b,c);
HOST_c2l(data,l); T1 = X[6] = l; ROUND_00_15(6,c,d,e,f,g,h,a,b);
HOST_c2l(data,l); T1 = X[7] = l; ROUND_00_15(7,b,c,d,e,f,g,h,a);
HOST_c2l(data,l); T1 = X[8] = l; ROUND_00_15(8,a,b,c,d,e,f,g,h);
HOST_c2l(data,l); T1 = X[9] = l; ROUND_00_15(9,h,a,b,c,d,e,f,g);
HOST_c2l(data,l); T1 = X[10] = l; ROUND_00_15(10,g,h,a,b,c,d,e,f);
HOST_c2l(data,l); T1 = X[11] = l; ROUND_00_15(11,f,g,h,a,b,c,d,e);
HOST_c2l(data,l); T1 = X[12] = l; ROUND_00_15(12,e,f,g,h,a,b,c,d);
HOST_c2l(data,l); T1 = X[13] = l; ROUND_00_15(13,d,e,f,g,h,a,b,c);
HOST_c2l(data,l); T1 = X[14] = l; ROUND_00_15(14,c,d,e,f,g,h,a,b);
HOST_c2l(data,l); T1 = X[15] = l; ROUND_00_15(15,b,c,d,e,f,g,h,a);
}
for (i=16;i<64;i+=8)
{
ROUND_16_63(i+0,a,b,c,d,e,f,g,h,X);
ROUND_16_63(i+1,h,a,b,c,d,e,f,g,X);
ROUND_16_63(i+2,g,h,a,b,c,d,e,f,X);
ROUND_16_63(i+3,f,g,h,a,b,c,d,e,X);
ROUND_16_63(i+4,e,f,g,h,a,b,c,d,X);
ROUND_16_63(i+5,d,e,f,g,h,a,b,c,X);
ROUND_16_63(i+6,c,d,e,f,g,h,a,b,X);
ROUND_16_63(i+7,b,c,d,e,f,g,h,a,X);
}
ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d;
ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
data += SHA256_CBLOCK;
}
}
crypto/sha/sha256.c:291: error: BUFFER_OVERRUN_L2
Offset: [23, 70] Size: 64.
Showing all 5 steps of the trace
crypto/sha/sha256.c:282:7: <Offset trace>
280. }
281.
282. for (i=16;i<64;i+=8)
^
283. {
284. ROUND_16_63(i+0,a,b,c,d,e,f,g,h,X);
crypto/sha/sha256.c:282:7: Assignment
280. }
281.
282. for (i=16;i<64;i+=8)
^
283. {
284. ROUND_16_63(i+0,a,b,c,d,e,f,g,h,X);
crypto/sha/sha256.c:123:1: <Length trace>
121. void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host);
122. #else
123. > static const SHA_LONG K256[64] = {
124. 0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
125. 0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
crypto/sha/sha256.c:123:1: Array declaration
121. void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host);
122. #else
123. > static const SHA_LONG K256[64] = {
124. 0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
125. 0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
crypto/sha/sha256.c:291:3: Array access: Offset: [23, 70] Size: 64
289. ROUND_16_63(i+5,d,e,f,g,h,a,b,c,X);
290. ROUND_16_63(i+6,c,d,e,f,g,h,a,b,X);
291. ROUND_16_63(i+7,b,c,d,e,f,g,h,a,X);
^
292. }
293.
| https://github.com/openssl/openssl/blob/89c53672c231586dbcde7410de4b6ce40e685c74/crypto/sha/sha256.c/#L291 |
d2a_code_trace_data_42242 | void bn_correct_top(BIGNUM *a)
{
BN_ULONG *ftl;
int tmp_top = a->top;
if (tmp_top > 0) {
for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
ftl--;
if (*ftl != 0)
break;
}
a->top = tmp_top;
}
if (a->top == 0)
a->neg = 0;
bn_pollute(a);
}
crypto/ec/ecdh_ossl.c:80: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`.
Showing all 11 steps of the trace
crypto/ec/ecdh_ossl.c:79:14: Call
77.
78. if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) {
79. if (!EC_GROUP_get_cofactor(group, x, NULL) ||
^
80. !BN_mul(x, x, priv_key, ctx)) {
81. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
crypto/ec/ec_lib.c:342:1: Parameter `cofactor->d`
340. }
341.
342. > int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
343. BN_CTX *ctx)
344. {
crypto/ec/ecdh_ossl.c:80:14: Call
78. if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) {
79. if (!EC_GROUP_get_cofactor(group, x, NULL) ||
80. !BN_mul(x, x, priv_key, ctx)) {
^
81. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
82. goto err;
crypto/bn/bn_mul.c:879:13: Assignment
877. if (bn_wexpand(rr, 16) == NULL)
878. goto err;
879. rr->top = 16;
^
880. bn_mul_comba8(rr->d, a->d, b->d);
881. goto end;
crypto/bn/bn_mul.c:972:5: Call
970. end:
971. #endif
972. bn_correct_top(rr);
^
973. if (r != rr && BN_copy(r, rr) == NULL)
974. goto err;
crypto/bn/bn_lib.c:1021:1: <Offset trace>
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1021:1: Parameter `a->top`
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1024:5: Assignment
1022. {
1023. BN_ULONG *ftl;
1024. int tmp_top = a->top;
^
1025.
1026. if (tmp_top > 0) {
crypto/bn/bn_lib.c:1021:1: <Length trace>
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1021:1: Parameter `*a->d`
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`
1025.
1026. if (tmp_top > 0) {
1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
^
1028. ftl--;
1029. if (*ftl != 0)
| https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L1027 |
d2a_code_trace_data_42243 | static void frame_end(MpegEncContext *s)
{
int i;
if (s->unrestricted_mv &&
s->current_picture.reference &&
!s->intra_only) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h;
s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
s->h_edge_pos, s->v_edge_pos,
EDGE_WIDTH, EDGE_WIDTH,
EDGE_TOP | EDGE_BOTTOM);
s->mpvencdsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize,
s->h_edge_pos >> hshift,
s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift,
EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
s->mpvencdsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize,
s->h_edge_pos >> hshift,
s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift,
EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
s->last_pict_type = s->pict_type;
s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality;
if (s->pict_type!= AV_PICTURE_TYPE_B)
s->last_non_b_pict_type = s->pict_type;
if (s->encoding) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
if (!s->picture[i].reference)
ff_mpeg_unref_picture(s, &s->picture[i]);
}
}
s->avctx->coded_frame = s->current_picture_ptr->f;
}
libavcodec/mpegvideo_enc.c:1428: error: Null Dereference
pointer `desc` last assigned on line 1427 could be null and is dereferenced at line 1428, column 22.
libavcodec/mpegvideo_enc.c:1420:1: start of procedure frame_end()
1418. }
1419.
1420. static void frame_end(MpegEncContext *s)
^
1421. {
1422. int i;
libavcodec/mpegvideo_enc.c:1424:9: Taking true branch
1422. int i;
1423.
1424. if (s->unrestricted_mv &&
^
1425. s->current_picture.reference &&
1426. !s->intra_only) {
libavcodec/mpegvideo_enc.c:1425:9: Taking true branch
1423.
1424. if (s->unrestricted_mv &&
1425. s->current_picture.reference &&
^
1426. !s->intra_only) {
1427. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
libavcodec/mpegvideo_enc.c:1426:10: Taking true branch
1424. if (s->unrestricted_mv &&
1425. s->current_picture.reference &&
1426. !s->intra_only) {
^
1427. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1428. int hshift = desc->log2_chroma_w;
libavcodec/mpegvideo_enc.c:1427:9:
1425. s->current_picture.reference &&
1426. !s->intra_only) {
1427. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
^
1428. int hshift = desc->log2_chroma_w;
1429. int vshift = desc->log2_chroma_h;
libavutil/pixdesc.c:1676:1: start of procedure av_pix_fmt_desc_get()
1674. }
1675.
1676. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1677. {
1678. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1678:9: Taking false branch
1676. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1677. {
1678. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1679. return NULL;
1680. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1678:24: Taking true branch
1676. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1677. {
1678. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1679. return NULL;
1680. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1679:9:
1677. {
1678. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1679. return NULL;
^
1680. return &av_pix_fmt_descriptors[pix_fmt];
1681. }
libavutil/pixdesc.c:1681:1: return from a call to av_pix_fmt_desc_get
1679. return NULL;
1680. return &av_pix_fmt_descriptors[pix_fmt];
1681. }
^
1682.
1683. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libavcodec/mpegvideo_enc.c:1428:9:
1426. !s->intra_only) {
1427. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1428. int hshift = desc->log2_chroma_w;
^
1429. int vshift = desc->log2_chroma_h;
1430. s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
| https://github.com/libav/libav/blob/6f54dc43cee6b2f5d183acf98b32a3cf8be4a4fc/libavcodec/mpegvideo_enc.c/#L1428 |
d2a_code_trace_data_42244 | static void compute_lpc_coefs(const double *autoc, int max_order,
double lpc[][MAX_LPC_ORDER], double *ref)
{
int i, j;
double err = autoc[0];
double lpc_tmp[MAX_LPC_ORDER];
for(i=0; i<max_order; i++) {
double r = -autoc[i+1];
for(j=0; j<i; j++)
r -= lpc_tmp[j] * autoc[i-j];
r /= err;
ref[i] = fabs(r);
err *= 1.0 - (r * r);
lpc_tmp[i] = r;
for(j=0; j < i>>1; j++) {
double tmp = lpc_tmp[j];
lpc_tmp[j] += r * lpc_tmp[i-1-j];
lpc_tmp[i-1-j] += r * tmp;
}
if(i & 1)
lpc_tmp[j] += lpc_tmp[j] * r;
for(j=0; j<=i; j++)
lpc[i][j] = -lpc_tmp[j];
}
}
libavcodec/lpc.c:42: error: Uninitialized Value
The value read from lpc_tmp[_] was never initialized.
libavcodec/lpc.c:42:13:
40.
41. for(j=0; j<i; j++)
42. r -= lpc_tmp[j] * autoc[i-j];
^
43.
44. r /= err;
| https://github.com/libav/libav/blob/f0319383436e1abc3fc1464fe4e5f4dc40db3419/libavcodec/lpc.c/#L42 |
d2a_code_trace_data_42245 | static int test_EVP_DigestSignInit(void)
{
int ret = 0;
EVP_PKEY *pkey = NULL;
unsigned char *sig = NULL;
size_t sig_len = 0;
EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
|| !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())
|| !TEST_ptr(pkey = load_example_rsa_key()))
goto out;
if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, EVP_sha256(), NULL, pkey))
|| !TEST_true(EVP_DigestSignUpdate(md_ctx, kMsg, sizeof(kMsg))))
goto out;
if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len))
|| !TEST_size_t_eq(sig_len, (size_t)EVP_PKEY_size(pkey)))
goto out;
if (!TEST_ptr(sig = OPENSSL_malloc(sig_len))
|| !TEST_true(EVP_DigestSignFinal(md_ctx, sig, &sig_len)))
goto out;
if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, EVP_sha256(),
NULL, pkey))
|| !TEST_true(EVP_DigestVerifyUpdate(md_ctx_verify,
kMsg, sizeof(kMsg)))
|| !TEST_true(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len)))
goto out;
ret = 1;
out:
EVP_MD_CTX_free(md_ctx);
EVP_MD_CTX_free(md_ctx_verify);
EVP_PKEY_free(pkey);
OPENSSL_free(sig);
return ret;
}
test/evp_extra_test.c:265: error: MEMORY_LEAK
memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 236, column 10 is not reachable after line 265, column 5.
Showing all 69 steps of the trace
test/evp_extra_test.c:228:1: start of procedure test_EVP_DigestSignInit()
226. }
227.
228. > static int test_EVP_DigestSignInit(void)
229. {
230. int ret = 0;
test/evp_extra_test.c:230:5:
228. static int test_EVP_DigestSignInit(void)
229. {
230. > int ret = 0;
231. EVP_PKEY *pkey = NULL;
232. unsigned char *sig = NULL;
test/evp_extra_test.c:231:5:
229. {
230. int ret = 0;
231. > EVP_PKEY *pkey = NULL;
232. unsigned char *sig = NULL;
233. size_t sig_len = 0;
test/evp_extra_test.c:232:5:
230. int ret = 0;
231. EVP_PKEY *pkey = NULL;
232. > unsigned char *sig = NULL;
233. size_t sig_len = 0;
234. EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
test/evp_extra_test.c:233:5:
231. EVP_PKEY *pkey = NULL;
232. unsigned char *sig = NULL;
233. > size_t sig_len = 0;
234. EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
235.
test/evp_extra_test.c:234:5:
232. unsigned char *sig = NULL;
233. size_t sig_len = 0;
234. > EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
235.
236. if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
test/evp_extra_test.c:236:10:
234. EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
235.
236. > if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
237. || !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())
238. || !TEST_ptr(pkey = load_example_rsa_key()))
crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
42. }
43.
44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:46:5:
44. EVP_MD_CTX *EVP_MD_CTX_new(void)
45. {
46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. }
48.
crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
184. }
185.
186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:188:5:
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. > void *ret = CRYPTO_malloc(num, file, line);
189.
190. FAILTEST();
crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
156. #endif
157.
158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. void *ret = NULL;
crypto/mem.c:160:5:
158. void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. > void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:162:9: Taking false branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:165:9: Taking false branch
163. return malloc_impl(num, file, line);
164.
165. if (num == 0)
^
166. return NULL;
167.
crypto/mem.c:169:5:
167.
168. FAILTEST();
169. > allow_customize = 0;
170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
171. if (call_malloc_debug) {
crypto/mem.c:179:5:
177. }
178. #else
179. > osslargused(file); osslargused(line);
180. ret = malloc(num);
181. #endif
crypto/mem.c:179:24:
177. }
178. #else
179. > osslargused(file); osslargused(line);
180. ret = malloc(num);
181. #endif
crypto/mem.c:180:5:
178. #else
179. osslargused(file); osslargused(line);
180. > ret = malloc(num);
181. #endif
182.
crypto/mem.c:183:5:
181. #endif
182.
183. > return ret;
184. }
185.
crypto/mem.c:184:1: return from a call to CRYPTO_malloc
182.
183. return ret;
184. > }
185.
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:191:9: Taking true branch
189.
190. FAILTEST();
191. if (ret != NULL)
^
192. memset(ret, 0, num);
193. return ret;
crypto/mem.c:192:9:
190. FAILTEST();
191. if (ret != NULL)
192. > memset(ret, 0, num);
193. return ret;
194. }
crypto/mem.c:193:5:
191. if (ret != NULL)
192. memset(ret, 0, num);
193. > return ret;
194. }
195.
crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
192. memset(ret, 0, num);
193. return ret;
194. > }
195.
196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. > }
48.
49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
test/testutil/tests.c:184:1: start of procedure test_ptr()
182. }
183.
184. > int test_ptr(const char *file, int line, const char *s, const void *p)
185. {
186. if (p != NULL)
test/testutil/tests.c:186:9: Taking true branch
184. int test_ptr(const char *file, int line, const char *s, const void *p)
185. {
186. if (p != NULL)
^
187. return 1;
188. test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
test/testutil/tests.c:187:9:
185. {
186. if (p != NULL)
187. > return 1;
188. test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
189. return 0;
test/testutil/tests.c:190:1: return from a call to test_ptr
188. test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
189. return 0;
190. > }
191.
192. int test_true(const char *file, int line, const char *s, int b)
test/evp_extra_test.c:236:10: Taking false branch
234. EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
235.
236. if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
^
237. || !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())
238. || !TEST_ptr(pkey = load_example_rsa_key()))
test/evp_extra_test.c:237:17:
235.
236. if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
237. > || !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())
238. || !TEST_ptr(pkey = load_example_rsa_key()))
239. goto out;
crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
42. }
43.
44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:46:5:
44. EVP_MD_CTX *EVP_MD_CTX_new(void)
45. {
46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. }
48.
crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
184. }
185.
186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:188:5:
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. > void *ret = CRYPTO_malloc(num, file, line);
189.
190. FAILTEST();
crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
156. #endif
157.
158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. void *ret = NULL;
crypto/mem.c:160:5:
158. void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. > void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:162:9: Taking true branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:162:32: Taking true branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:163:9: Skipping __function_pointer__(): unresolved function pointer
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
163. return malloc_impl(num, file, line);
^
164.
165. if (num == 0)
crypto/mem.c:184:1: return from a call to CRYPTO_malloc
182.
183. return ret;
184. > }
185.
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:191:9: Taking false branch
189.
190. FAILTEST();
191. if (ret != NULL)
^
192. memset(ret, 0, num);
193. return ret;
crypto/mem.c:193:5:
191. if (ret != NULL)
192. memset(ret, 0, num);
193. > return ret;
194. }
195.
crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
192. memset(ret, 0, num);
193. return ret;
194. > }
195.
196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. > }
48.
49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
test/testutil/tests.c:184:1: start of procedure test_ptr()
182. }
183.
184. > int test_ptr(const char *file, int line, const char *s, const void *p)
185. {
186. if (p != NULL)
test/testutil/tests.c:186:9: Taking false branch
184. int test_ptr(const char *file, int line, const char *s, const void *p)
185. {
186. if (p != NULL)
^
187. return 1;
188. test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
test/testutil/tests.c:188:5:
186. if (p != NULL)
187. return 1;
188. > test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
189. return 0;
190. }
test/testutil/tests.c:76:1: start of procedure test_fail_message()
74. }
75.
76. > static void test_fail_message(const char *prefix, const char *file, int line,
77. const char *type, const char *fmt, ...)
78. {
test/testutil/tests.c:81:5:
79. va_list ap;
80.
81. > va_start(ap, fmt);
82. test_fail_message_va(prefix, file, line, type, fmt, ap);
83. va_end(ap);
test/testutil/tests.c:82:5: Skipping test_fail_message_va(): empty list of specs
80.
81. va_start(ap, fmt);
82. test_fail_message_va(prefix, file, line, type, fmt, ap);
^
83. va_end(ap);
84. }
test/testutil/tests.c:83:5:
81. va_start(ap, fmt);
82. test_fail_message_va(prefix, file, line, type, fmt, ap);
83. > va_end(ap);
84. }
85.
test/testutil/tests.c:84:1: return from a call to test_fail_message
82. test_fail_message_va(prefix, file, line, type, fmt, ap);
83. va_end(ap);
84. > }
85.
86. void test_info_c90(const char *desc, ...)
test/testutil/tests.c:189:5:
187. return 1;
188. test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
189. > return 0;
190. }
191.
test/testutil/tests.c:190:1: return from a call to test_ptr
188. test_fail_message(NULL, file, line, "ptr", "%s [%p] != NULL", s, p);
189. return 0;
190. > }
191.
192. int test_true(const char *file, int line, const char *s, int b)
test/evp_extra_test.c:237:17: Taking true branch
235.
236. if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
237. || !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())
^
238. || !TEST_ptr(pkey = load_example_rsa_key()))
239. goto out;
test/evp_extra_test.c:264:2:
262. ret = 1;
263.
264. > out:
265. EVP_MD_CTX_free(md_ctx);
266. EVP_MD_CTX_free(md_ctx_verify);
test/evp_extra_test.c:265:5:
263.
264. out:
265. > EVP_MD_CTX_free(md_ctx);
266. EVP_MD_CTX_free(md_ctx_verify);
267. EVP_PKEY_free(pkey);
crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
47. }
48.
49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
50. {
51. EVP_MD_CTX_reset(ctx);
crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
50. {
51. EVP_MD_CTX_reset(ctx);
^
52. OPENSSL_free(ctx);
53. }
crypto/evp/digest.c:52:5:
50. {
51. EVP_MD_CTX_reset(ctx);
52. > OPENSSL_free(ctx);
53. }
54.
crypto/mem.c:253:1: start of procedure CRYPTO_free()
251. }
252.
253. > void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:255:9: Taking true branch
253. void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
256. free_impl(str, file, line);
257. return;
crypto/mem.c:255:30: Taking true branch
253. void CRYPTO_free(void *str, const char *file, int line)
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
256. free_impl(str, file, line);
257. return;
crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer
254. {
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
256. free_impl(str, file, line);
^
257. return;
258. }
crypto/mem.c:257:9:
255. if (free_impl != NULL && free_impl != &CRYPTO_free) {
256. free_impl(str, file, line);
257. > return;
258. }
259.
crypto/mem.c:271:1: return from a call to CRYPTO_free
269. free(str);
270. #endif
271. > }
272.
273. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
51. EVP_MD_CTX_reset(ctx);
52. OPENSSL_free(ctx);
53. > }
54.
55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
| https://github.com/openssl/openssl/blob/8ed9a26616a7101ea698c189fbbb663186676075/test/evp_extra_test.c/#L265 |
d2a_code_trace_data_42246 | static int append_buf(char **buf, int *size, const char *s)
{
const int expand = 256;
int len = strlen(s) + 1;
char *p = *buf;
if (p == NULL) {
*size = ((len + expand - 1) / expand) * expand;
p = *buf = app_malloc(*size, "engine buffer");
} else {
const int blen = strlen(p);
if (blen > 0)
len += 2 + blen;
if (len > *size) {
*size = ((len + expand - 1) / expand) * expand;
p = OPENSSL_realloc(p, *size);
if (p == NULL) {
OPENSSL_free(*buf);
*buf = NULL;
return 0;
}
*buf = p;
}
if (blen > 0) {
p += blen;
*p++ = ',';
*p++ = ' ';
}
}
strcpy(p, s);
return 1;
}
apps/engine.c:403: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, +oo] by call to `append_buf`.
Showing all 7 steps of the trace
apps/engine.c:392:17: Assignment
390. if (list_cap) {
391. int cap_size = 256;
392. char *cap_buf = NULL;
^
393. int k, n;
394. const int *nids;
apps/engine.c:403:25: Call
401. goto end;
402. if (ENGINE_get_DSA(e) != NULL
403. && !append_buf(&cap_buf, &cap_size, "DSA"))
^
404. goto end;
405. if (ENGINE_get_DH(e) != NULL
apps/engine.c:49:1: <Length trace>
47. };
48.
49. > static int append_buf(char **buf, int *size, const char *s)
50. {
51. const int expand = 256;
apps/engine.c:49:1: Parameter `**buf`
47. };
48.
49. > static int append_buf(char **buf, int *size, const char *s)
50. {
51. const int expand = 256;
apps/engine.c:53:5: Assignment
51. const int expand = 256;
52. int len = strlen(s) + 1;
53. char *p = *buf;
^
54.
55. if (p == NULL) {
apps/engine.c:76:13: Assignment
74.
75. if (blen > 0) {
76. p += blen;
^
77. *p++ = ',';
78. *p++ = ' ';
apps/engine.c:77:13: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `append_buf`
75. if (blen > 0) {
76. p += blen;
77. *p++ = ',';
^
78. *p++ = ' ';
79. }
| https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/apps/engine.c/#L77 |
d2a_code_trace_data_42247 | static inline void pred_direct_motion(H264Context * const h, int *mb_type){
MpegEncContext * const s = &h->s;
const int mb_xy = s->mb_x + s->mb_y*s->mb_stride;
const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride;
const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy];
const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy];
const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy];
const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy];
const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy];
const int is_b8x8 = IS_8X8(*mb_type);
unsigned int sub_mb_type;
int i8, i4;
#define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM)
if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){
sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
*mb_type = MB_TYPE_8x8|MB_TYPE_L0L1;
}else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){
sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
*mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
}else{
sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
*mb_type = MB_TYPE_8x8|MB_TYPE_L0L1;
}
if(!is_b8x8)
*mb_type |= MB_TYPE_DIRECT2;
if(MB_FIELD)
*mb_type |= MB_TYPE_INTERLACED;
tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col);
if(h->direct_spatial_mv_pred){
int ref[2];
int mv[2][2];
int list;
for(list=0; list<2; list++){
int refa = h->ref_cache[list][scan8[0] - 1];
int refb = h->ref_cache[list][scan8[0] - 8];
int refc = h->ref_cache[list][scan8[0] - 8 + 4];
if(refc == -2)
refc = h->ref_cache[list][scan8[0] - 8 - 1];
ref[list] = refa;
if(ref[list] < 0 || (refb < ref[list] && refb >= 0))
ref[list] = refb;
if(ref[list] < 0 || (refc < ref[list] && refc >= 0))
ref[list] = refc;
if(ref[list] < 0)
ref[list] = -1;
}
if(ref[0] < 0 && ref[1] < 0){
ref[0] = ref[1] = 0;
mv[0][0] = mv[0][1] =
mv[1][0] = mv[1][1] = 0;
}else{
for(list=0; list<2; list++){
if(ref[list] >= 0)
pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]);
else
mv[list][0] = mv[list][1] = 0;
}
}
if(ref[1] < 0){
if(!is_b8x8)
*mb_type &= ~MB_TYPE_L1;
sub_mb_type &= ~MB_TYPE_L1;
}else if(ref[0] < 0){
if(!is_b8x8)
*mb_type &= ~MB_TYPE_L0;
sub_mb_type &= ~MB_TYPE_L0;
}
if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){
int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride;
int mb_types_col[2];
int b8_stride = h->b8_stride;
int b4_stride = h->b_stride;
*mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8;
if(IS_INTERLACED(*mb_type)){
mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy];
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
if(s->mb_y&1){
l1ref0 -= 2*b8_stride;
l1ref1 -= 2*b8_stride;
l1mv0 -= 4*b4_stride;
l1mv1 -= 4*b4_stride;
}
b8_stride *= 3;
b4_stride *= 6;
}else{
int cur_poc = s->current_picture_ptr->poc;
int *col_poc = h->ref_list[1]->field_poc;
int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc);
int dy = 2*col_parity - (s->mb_y&1);
mb_types_col[0] =
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride];
l1ref0 += dy*b8_stride;
l1ref1 += dy*b8_stride;
l1mv0 += 2*dy*b4_stride;
l1mv1 += 2*dy*b4_stride;
b8_stride = 0;
}
for(i8=0; i8<4; i8++){
int x8 = i8&1;
int y8 = i8>>1;
int xy8 = x8+y8*b8_stride;
int xy4 = 3*x8+y8*b4_stride;
int a=0, b=0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_types_col[y8])
&& ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1)
|| (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){
if(ref[0] > 0)
a= pack16to32(mv[0][0],mv[0][1]);
if(ref[1] > 0)
b= pack16to32(mv[1][0],mv[1][1]);
}else{
a= pack16to32(mv[0][0],mv[0][1]);
b= pack16to32(mv[1][0],mv[1][1]);
}
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4);
}
}else if(IS_16X16(*mb_type)){
int a=0, b=0;
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_type_col)
&& ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)
|| (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1
&& (h->x264_build>33 || !h->x264_build)))){
if(ref[0] > 0)
a= pack16to32(mv[0][0],mv[0][1]);
if(ref[1] > 0)
b= pack16to32(mv[1][0],mv[1][1]);
}else{
a= pack16to32(mv[0][0],mv[0][1]);
b= pack16to32(mv[1][0],mv[1][1]);
}
fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);
fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);
}else{
for(i8=0; i8<4; i8++){
const int x8 = i8&1;
const int y8 = i8>>1;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4);
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0
|| (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0
&& (h->x264_build>33 || !h->x264_build)))){
const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1;
if(IS_SUB_8X8(sub_mb_type)){
const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride];
if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
if(ref[0] == 0)
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
if(ref[1] == 0)
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
}
}else
for(i4=0; i4<4; i4++){
const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride];
if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
if(ref[0] == 0)
*(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0;
if(ref[1] == 0)
*(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0;
}
}
}
}
}
}else{
const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]};
const int *dist_scale_factor = h->dist_scale_factor;
if(FRAME_MBAFF){
if(IS_INTERLACED(*mb_type)){
map_col_to_list0[0] = h->map_col_to_list0_field[0];
map_col_to_list0[1] = h->map_col_to_list0_field[1];
dist_scale_factor = h->dist_scale_factor_field;
}
if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){
const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride;
int mb_types_col[2];
int y_shift;
*mb_type = MB_TYPE_8x8|MB_TYPE_L0L1
| (is_b8x8 ? 0 : MB_TYPE_DIRECT2)
| (*mb_type & MB_TYPE_INTERLACED);
sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16;
if(IS_INTERLACED(*mb_type)){
mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy];
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
if(s->mb_y&1){
l1ref0 -= 2*h->b8_stride;
l1ref1 -= 2*h->b8_stride;
l1mv0 -= 4*h->b_stride;
l1mv1 -= 4*h->b_stride;
}
y_shift = 0;
if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA)
&& (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA)
&& !is_b8x8)
*mb_type |= MB_TYPE_16x8;
else
*mb_type |= MB_TYPE_8x8;
}else{
int dy = (s->mb_y&1) ? 1 : 2;
mb_types_col[0] =
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
l1ref0 += dy*h->b8_stride;
l1ref1 += dy*h->b8_stride;
l1mv0 += 2*dy*h->b_stride;
l1mv1 += 2*dy*h->b_stride;
y_shift = 2;
if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8))
&& !is_b8x8)
*mb_type |= MB_TYPE_16x16;
else
*mb_type |= MB_TYPE_8x8;
}
for(i8=0; i8<4; i8++){
const int x8 = i8&1;
const int y8 = i8>>1;
int ref0, scale;
const int16_t (*l1mv)[2]= l1mv0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
if(IS_INTRA(mb_types_col[y8])){
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
continue;
}
ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride];
if(ref0 >= 0)
ref0 = map_col_to_list0[0][ref0*2>>y_shift];
else{
ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift];
l1mv= l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
{
const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride];
int my_col = (mv_col[1]<<y_shift)/2;
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * my_col + 128) >> 8;
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4);
}
}
return;
}
}
if(IS_16X16(*mb_type)){
int ref, mv0, mv1;
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1);
if(IS_INTRA(mb_type_col)){
ref=mv0=mv1=0;
}else{
const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]]
: map_col_to_list0[1][l1ref1[0]];
const int scale = dist_scale_factor[ref0];
const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0];
int mv_l0[2];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
ref= ref0;
mv0= pack16to32(mv_l0[0],mv_l0[1]);
mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
}
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4);
}else{
for(i8=0; i8<4; i8++){
const int x8 = i8&1;
const int y8 = i8>>1;
int ref0, scale;
const int16_t (*l1mv)[2]= l1mv0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
if(IS_INTRA(mb_type_col)){
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
continue;
}
ref0 = l1ref0[x8 + y8*h->b8_stride];
if(ref0 >= 0)
ref0 = map_col_to_list0[0][ref0];
else{
ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]];
l1mv= l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
if(IS_SUB_8X8(sub_mb_type)){
const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride];
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * mv_col[1] + 128) >> 8;
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4);
}else
for(i4=0; i4<4; i4++){
const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride];
int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
*(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] =
pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
}
}
}
}
}
libavcodec/h264.c:1125: error: Uninitialized Value
The value read from ref[_] was never initialized.
libavcodec/h264.c:1125:17:
1123. fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4);
1124. fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4);
1125. fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
^
1126. fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
1127.
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1125 |
d2a_code_trace_data_42248 | char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
{
const X509_NAME_ENTRY *ne;
int i;
int n, lold, l, l1, l2, num, j, type;
const char *s;
char *p;
unsigned char *q;
BUF_MEM *b = NULL;
static const char hex[17] = "0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
unsigned char ebcdic_buf[1024];
#endif
if (buf == NULL) {
if ((b = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(b, 200))
goto err;
b->data[0] = '\0';
len = 200;
} else if (len == 0) {
return NULL;
}
if (a == NULL) {
if (b) {
buf = b->data;
OPENSSL_free(b);
}
strncpy(buf, "NO X509_NAME", len);
buf[len - 1] = '\0';
return buf;
}
len--;
l = 0;
for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
ne = sk_X509_NAME_ENTRY_value(a->entries, i);
n = OBJ_obj2nid(ne->object);
if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
s = tmp_buf;
}
l1 = strlen(s);
type = ne->value->type;
num = ne->value->length;
if (num > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
q = ne->value->data;
#ifdef CHARSET_EBCDIC
if (type == V_ASN1_GENERALSTRING ||
type == V_ASN1_VISIBLESTRING ||
type == V_ASN1_PRINTABLESTRING ||
type == V_ASN1_TELETEXSTRING ||
type == V_ASN1_IA5STRING) {
if (num > (int)sizeof(ebcdic_buf))
num = sizeof(ebcdic_buf);
ascii2ebcdic(ebcdic_buf, q, num);
q = ebcdic_buf;
}
#endif
if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
for (j = 0; j < num; j++)
if (q[j] != 0)
gs_doit[j & 3] = 1;
if (gs_doit[0] | gs_doit[1] | gs_doit[2])
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
else {
gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
gs_doit[3] = 1;
}
} else
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
for (l2 = j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
l2++;
#ifndef CHARSET_EBCDIC
if ((q[j] < ' ') || (q[j] > '~'))
l2 += 3;
#else
if ((os_toascii[q[j]] < os_toascii[' ']) ||
(os_toascii[q[j]] > os_toascii['~']))
l2 += 3;
#endif
}
lold = l;
l += 1 + l1 + 1 + l2;
if (l > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
if (b != NULL) {
if (!BUF_MEM_grow(b, l + 1))
goto err;
p = &(b->data[lold]);
} else if (l > len) {
break;
} else
p = &(buf[lold]);
*(p++) = '/';
memcpy(p, s, (unsigned int)l1);
p += l1;
*(p++) = '=';
#ifndef CHARSET_EBCDIC
q = ne->value->data;
#endif
for (j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
#ifndef CHARSET_EBCDIC
n = q[j];
if ((n < ' ') || (n > '~')) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = n;
#else
n = os_toascii[q[j]];
if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = q[j];
#endif
}
*p = '\0';
}
if (b != NULL) {
p = b->data;
OPENSSL_free(b);
} else
p = buf;
if (i == 0)
*p = '\0';
return (p);
err:
X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
end:
BUF_MEM_free(b);
return (NULL);
}
crypto/x509/x_name.c:504: error: BUFFER_OVERRUN_L3
Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline`.
Showing all 6 steps of the trace
crypto/x509/x_name.c:504:9: Call
502. l = 80 - 2 - obase;
503.
504. b = X509_NAME_oneline(name, NULL, 0);
^
505. if (!b)
506. return 0;
crypto/x509/x509_obj.c:25:1: <Offset trace>
23. #define NAME_ONELINE_MAX (1024 * 1024)
24.
25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
26. {
27. const X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:25:1: Parameter `len`
23. #define NAME_ONELINE_MAX (1024 * 1024)
24.
25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
26. {
27. const X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:25:1: <Length trace>
23. #define NAME_ONELINE_MAX (1024 * 1024)
24.
25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
26. {
27. const X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:25:1: Parameter `*buf`
23. #define NAME_ONELINE_MAX (1024 * 1024)
24.
25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
26. {
27. const X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:57:9: Array access: Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline`
55. }
56. strncpy(buf, "NO X509_NAME", len);
57. buf[len - 1] = '\0';
^
58. return buf;
59. }
| https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L57 |
d2a_code_trace_data_42249 | void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a)
{
c448_word_t mask = 0 - (a->limb[0] & 1);
c448_dword_t chain = 0;
unsigned int i;
for (i = 0; i < C448_SCALAR_LIMBS; i++) {
chain = (chain + a->limb[i]) + (sc_p->limb[i] & mask);
out->limb[i] = (c448_word_t)chain;
chain >>= C448_WORD_BITS;
}
for (i = 0; i < C448_SCALAR_LIMBS - 1; i++)
out->limb[i] = out->limb[i] >> 1 | out->limb[i + 1] << (WBITS - 1);
out->limb[i] = out->limb[i] >> 1 | (c448_word_t)(chain << (WBITS - 1));
}
crypto/ec/curve448/eddsa.c:193: error: INTEGER_OVERFLOW_L2
(0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve`.
Showing all 5 steps of the trace
crypto/ec/curve448/eddsa.c:185:9: Unknown value from: OPENSSL_cleanse
183. goto err;
184. curve448_scalar_decode_long(nonce_scalar, nonce, sizeof(nonce));
185. OPENSSL_cleanse(nonce, sizeof(nonce));
^
186. }
187.
crypto/ec/curve448/eddsa.c:193:9: Call
191. curve448_point_t p;
192.
193. curve448_scalar_halve(nonce_scalar_2, nonce_scalar);
^
194. for (c = 2; c < C448_EDDSA_ENCODE_RATIO; c <<= 1)
195. curve448_scalar_halve(nonce_scalar_2, nonce_scalar_2);
crypto/ec/curve448/scalar.c:221:1: <RHS trace>
219. }
220.
221. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a)
222. {
223. c448_word_t mask = 0 - (a->limb[0] & 1);
crypto/ec/curve448/scalar.c:221:1: Parameter `a->limb[*]`
219. }
220.
221. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a)
222. {
223. c448_word_t mask = 0 - (a->limb[0] & 1);
crypto/ec/curve448/scalar.c:223:5: Binary operation: (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve`
221. void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a)
222. {
223. c448_word_t mask = 0 - (a->limb[0] & 1);
^
224. c448_dword_t chain = 0;
225. unsigned int i;
| https://github.com/openssl/openssl/blob/a7232276fef30a63070fd9dbb53d3820d3761d5b/crypto/ec/curve448/scalar.c/#L223 |
d2a_code_trace_data_42250 | static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d;
int dmin;
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
LOAD_COMMON2
if(c->pre_pass){
penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1];
}else{
penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
}
map_generation= update_map_generation(c);
assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
&& ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
c->skip=1;
return dmin;
}
CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(c->avctx->last_predictor_count){
const int count= c->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1056: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1056:9:
1054. return dmin;
1055. }
1056. CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
^
1057. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1056 |
d2a_code_trace_data_42251 | static void char2_field_tests(void)
{
BN_CTX *ctx = NULL;
BIGNUM *p, *a, *b;
EC_GROUP *group;
EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =
NULL, *C2_K571 = NULL;
EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =
NULL, *C2_B571 = NULL;
EC_POINT *P, *Q, *R;
BIGNUM *x, *y, *z, *cof;
unsigned char buf[100];
size_t i, len;
int k;
ctx = BN_CTX_new();
if (!ctx)
ABORT;
p = BN_new();
a = BN_new();
b = BN_new();
if (!p || !a || !b)
ABORT;
if (!BN_hex2bn(&p, "13"))
ABORT;
if (!BN_hex2bn(&a, "3"))
ABORT;
if (!BN_hex2bn(&b, "1"))
ABORT;
group = EC_GROUP_new(EC_GF2m_simple_method());
if (!group)
ABORT;
if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx))
ABORT;
{
EC_GROUP *tmp;
tmp = EC_GROUP_new(EC_GROUP_method_of(group));
if (!tmp)
ABORT;
if (!EC_GROUP_copy(tmp, group))
ABORT;
EC_GROUP_free(group);
group = tmp;
}
if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx))
ABORT;
fprintf(stdout,
"Curve defined by Weierstrass equation\n y^2 + x*y = x^3 + a*x^2 + b (mod 0x");
BN_print_fp(stdout, p);
fprintf(stdout, ")\n a = 0x");
BN_print_fp(stdout, a);
fprintf(stdout, "\n b = 0x");
BN_print_fp(stdout, b);
fprintf(stdout, "\n(0x... means binary polynomial)\n");
P = EC_POINT_new(group);
Q = EC_POINT_new(group);
R = EC_POINT_new(group);
if (!P || !Q || !R)
ABORT;
if (!EC_POINT_set_to_infinity(group, P))
ABORT;
if (!EC_POINT_is_at_infinity(group, P))
ABORT;
buf[0] = 0;
if (!EC_POINT_oct2point(group, Q, buf, 1, ctx))
ABORT;
if (!EC_POINT_add(group, P, P, Q, ctx))
ABORT;
if (!EC_POINT_is_at_infinity(group, P))
ABORT;
x = BN_new();
y = BN_new();
z = BN_new();
cof = BN_new();
if (!x || !y || !z || !cof)
ABORT;
if (!BN_hex2bn(&x, "6"))
ABORT;
# ifdef OPENSSL_EC_BIN_PT_COMP
if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx))
ABORT;
# else
if (!BN_hex2bn(&y, "8"))
ABORT;
if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx))
ABORT;
# endif
if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
# ifdef OPENSSL_EC_BIN_PT_COMP
if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx))
ABORT;
# endif
fprintf(stderr, "Point is not on curve: x = 0x");
BN_print_fp(stderr, x);
fprintf(stderr, ", y = 0x");
BN_print_fp(stderr, y);
fprintf(stderr, "\n");
ABORT;
}
fprintf(stdout, "A cyclic subgroup:\n");
k = 100;
do {
if (k-- == 0)
ABORT;
if (EC_POINT_is_at_infinity(group, P))
fprintf(stdout, " point at infinity\n");
else {
if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx))
ABORT;
fprintf(stdout, " x = 0x");
BN_print_fp(stdout, x);
fprintf(stdout, ", y = 0x");
BN_print_fp(stdout, y);
fprintf(stdout, "\n");
}
if (!EC_POINT_copy(R, P))
ABORT;
if (!EC_POINT_add(group, P, P, Q, ctx))
ABORT;
}
while (!EC_POINT_is_at_infinity(group, P));
if (!EC_POINT_add(group, P, Q, R, ctx))
ABORT;
if (!EC_POINT_is_at_infinity(group, P))
ABORT;
# ifdef OPENSSL_EC_BIN_PT_COMP
len =
EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf,
sizeof buf, ctx);
if (len == 0)
ABORT;
if (!EC_POINT_oct2point(group, P, buf, len, ctx))
ABORT;
if (0 != EC_POINT_cmp(group, P, Q, ctx))
ABORT;
fprintf(stdout, "Generator as octet string, compressed form:\n ");
for (i = 0; i < len; i++)
fprintf(stdout, "%02X", buf[i]);
# endif
len =
EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf,
sizeof buf, ctx);
if (len == 0)
ABORT;
if (!EC_POINT_oct2point(group, P, buf, len, ctx))
ABORT;
if (0 != EC_POINT_cmp(group, P, Q, ctx))
ABORT;
fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n ");
for (i = 0; i < len; i++)
fprintf(stdout, "%02X", buf[i]);
# ifdef OPENSSL_EC_BIN_PT_COMP
len =
EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf,
ctx);
if (len == 0)
ABORT;
if (!EC_POINT_oct2point(group, P, buf, len, ctx))
ABORT;
if (0 != EC_POINT_cmp(group, P, Q, ctx))
ABORT;
fprintf(stdout, "\nGenerator as octet string, hybrid form:\n ");
for (i = 0; i < len; i++)
fprintf(stdout, "%02X", buf[i]);
# endif
fprintf(stdout, "\n");
if (!EC_POINT_invert(group, P, ctx))
ABORT;
if (0 != EC_POINT_cmp(group, P, R, ctx))
ABORT;
CHAR2_CURVE_TEST
("NIST curve K-163",
"0800000000000000000000000000000000000000C9",
"1",
"1",
"02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8",
"0289070FB05D38FF58321F2E800536D538CCDAA3D9",
1, "04000000000000000000020108A2E0CC0D99F8A5EF", "2", 163, C2_K163);
CHAR2_CURVE_TEST
("NIST curve B-163",
"0800000000000000000000000000000000000000C9",
"1",
"020A601907B8C953CA1481EB10512F78744A3205FD",
"03F0EBA16286A2D57EA0991168D4994637E8343E36",
"00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1",
1, "040000000000000000000292FE77E70C12A4234C33", "2", 163, C2_B163);
CHAR2_CURVE_TEST
("NIST curve K-233",
"020000000000000000000000000000000000000004000000000000000001",
"0",
"1",
"017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126",
"01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3",
0,
"008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF",
"4", 233, C2_K233);
CHAR2_CURVE_TEST
("NIST curve B-233",
"020000000000000000000000000000000000000004000000000000000001",
"000000000000000000000000000000000000000000000000000000000001",
"0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD",
"00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B",
"01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052",
1,
"01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7",
"2", 233, C2_B233);
CHAR2_CURVE_TEST
("NIST curve K-283",
"0800000000000000000000000000000000000000000000000000000000000000000010A1",
"0",
"1",
"0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836",
"01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259",
0,
"01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61",
"4", 283, C2_K283);
CHAR2_CURVE_TEST
("NIST curve B-283",
"0800000000000000000000000000000000000000000000000000000000000000000010A1",
"000000000000000000000000000000000000000000000000000000000000000000000001",
"027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5",
"05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053",
"03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4",
1,
"03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307",
"2", 283, C2_B283);
CHAR2_CURVE_TEST
("NIST curve K-409",
"02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",
"0",
"1",
"0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746",
"01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B",
1,
"007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF",
"4", 409, C2_K409);
CHAR2_CURVE_TEST
("NIST curve B-409",
"02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F",
"015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7",
"0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706",
1,
"010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173",
"2", 409, C2_B409);
CHAR2_CURVE_TEST
("NIST curve K-571",
"80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",
"0",
"1",
"026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972",
"0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3",
0,
"020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001",
"4", 571, C2_K571);
CHAR2_CURVE_TEST
("NIST curve B-571",
"80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A",
"0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19",
"037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B",
1,
"03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47",
"2", 571, C2_B571);
if (!EC_POINT_copy(Q, P))
ABORT;
if (EC_POINT_is_at_infinity(group, Q))
ABORT;
if (!EC_POINT_dbl(group, P, P, ctx))
ABORT;
if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
ABORT;
if (!EC_POINT_invert(group, Q, ctx))
ABORT;
if (!EC_POINT_add(group, R, P, Q, ctx))
ABORT;
if (!EC_POINT_add(group, R, R, Q, ctx))
ABORT;
if (!EC_POINT_is_at_infinity(group, R))
ABORT;
{
const EC_POINT *points[3];
const BIGNUM *scalars[3];
if (EC_POINT_is_at_infinity(group, Q))
ABORT;
points[0] = Q;
points[1] = Q;
points[2] = Q;
if (!BN_add(y, z, BN_value_one()))
ABORT;
if (BN_is_odd(y))
ABORT;
if (!BN_rshift1(y, y))
ABORT;
scalars[0] = y;
scalars[1] = y;
fprintf(stdout, "combined multiplication ...");
fflush(stdout);
if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
ABORT;
if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
ABORT;
if (0 != EC_POINT_cmp(group, P, R, ctx))
ABORT;
if (0 != EC_POINT_cmp(group, R, Q, ctx))
ABORT;
fprintf(stdout, ".");
fflush(stdout);
if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0))
ABORT;
if (!BN_add(z, z, y))
ABORT;
BN_set_negative(z, 1);
scalars[0] = y;
scalars[1] = z;
if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
ABORT;
if (!EC_POINT_is_at_infinity(group, P))
ABORT;
fprintf(stdout, ".");
fflush(stdout);
if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0))
ABORT;
if (!BN_add(z, x, y))
ABORT;
BN_set_negative(z, 1);
scalars[0] = x;
scalars[1] = y;
scalars[2] = z;
if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx))
ABORT;
if (!EC_POINT_is_at_infinity(group, P))
ABORT;
fprintf(stdout, " ok\n\n");
}
BN_CTX_free(ctx);
BN_free(p);
BN_free(a);
BN_free(b);
EC_GROUP_free(group);
EC_POINT_free(P);
EC_POINT_free(Q);
EC_POINT_free(R);
BN_free(x);
BN_free(y);
BN_free(z);
BN_free(cof);
EC_GROUP_free(C2_K163);
EC_GROUP_free(C2_B163);
EC_GROUP_free(C2_K233);
EC_GROUP_free(C2_B233);
EC_GROUP_free(C2_K283);
EC_GROUP_free(C2_B283);
EC_GROUP_free(C2_K409);
EC_GROUP_free(C2_B409);
EC_GROUP_free(C2_K571);
EC_GROUP_free(C2_B571);
}
test/ectest.c:953: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 945, column 9 is not reachable after line 953, column 10.
Showing all 108 steps of the trace
test/ectest.c:924:1: start of procedure char2_field_tests()
922. # ifndef OPENSSL_NO_EC2M
923.
924. > static void char2_field_tests(void)
925. {
926. BN_CTX *ctx = NULL;
test/ectest.c:926:5:
924. static void char2_field_tests(void)
925. {
926. > BN_CTX *ctx = NULL;
927. BIGNUM *p, *a, *b;
928. EC_GROUP *group;
test/ectest.c:929:5:
927. BIGNUM *p, *a, *b;
928. EC_GROUP *group;
929. > EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =
930. NULL, *C2_K571 = NULL;
931. EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =
test/ectest.c:931:5:
929. EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =
930. NULL, *C2_K571 = NULL;
931. > EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =
932. NULL, *C2_B571 = NULL;
933. EC_POINT *P, *Q, *R;
test/ectest.c:939:5:
937. int k;
938.
939. > ctx = BN_CTX_new();
940. if (!ctx)
941. ABORT;
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/ectest.c:940:10: Taking false branch
938.
939. ctx = BN_CTX_new();
940. if (!ctx)
^
941. ABORT;
942.
test/ectest.c:943:5:
941. ABORT;
942.
943. > p = BN_new();
944. a = BN_new();
945. b = 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/ectest.c:944:5:
942.
943. p = BN_new();
944. > a = BN_new();
945. b = BN_new();
946. if (!p || !a || !b)
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/ectest.c:945:5:
943. p = BN_new();
944. a = BN_new();
945. > b = BN_new();
946. if (!p || !a || !b)
947. ABORT;
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/ectest.c:946:10: Taking false branch
944. a = BN_new();
945. b = BN_new();
946. if (!p || !a || !b)
^
947. ABORT;
948.
test/ectest.c:946:16: Taking false branch
944. a = BN_new();
945. b = BN_new();
946. if (!p || !a || !b)
^
947. ABORT;
948.
test/ectest.c:946:22: Taking false branch
944. a = BN_new();
945. b = BN_new();
946. if (!p || !a || !b)
^
947. ABORT;
948.
test/ectest.c:949:10: Taking false branch
947. ABORT;
948.
949. if (!BN_hex2bn(&p, "13"))
^
950. ABORT;
951. if (!BN_hex2bn(&a, "3"))
test/ectest.c:951:10: Taking false branch
949. if (!BN_hex2bn(&p, "13"))
950. ABORT;
951. if (!BN_hex2bn(&a, "3"))
^
952. ABORT;
953. if (!BN_hex2bn(&b, "1"))
test/ectest.c:953:10: Skipping BN_hex2bn(): empty list of specs
951. if (!BN_hex2bn(&a, "3"))
952. ABORT;
953. if (!BN_hex2bn(&b, "1"))
^
954. ABORT;
955.
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/ectest.c/#L953 |
d2a_code_trace_data_42252 | size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
{
unsigned int M = (ctx->nonce.c[0] >> 3) & 7;
M *= 2;
M += 2;
if (len < M)
return 0;
memcpy(tag, ctx->cmac.c, M);
return M;
}
crypto/evp/e_aes.c:2008: error: BUFFER_OVERRUN_L3
Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag`.
Showing all 7 steps of the trace
crypto/evp/e_aes.c:1963:1: Parameter `ctx->cipher_data->M`
1961. }
1962.
1963. > static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1964. const unsigned char *in, size_t len)
1965. {
crypto/evp/e_aes.c:2008:17: Call
2006. !CRYPTO_ccm128_decrypt(ccm, in, out, len)) {
2007. unsigned char tag[16];
2008. if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) {
^
2009. if (!memcmp(tag, ctx->buf, cctx->M))
2010. rv = len;
crypto/modes/ccm128.c:469:1: <Offset trace>
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:469:1: Parameter `len`
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:469:1: <Length trace>
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:469:1: Parameter `ctx->cmac.c[*]`
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:477:5: Array access: Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag`
475. if (len < M)
476. return 0;
477. memcpy(tag, ctx->cmac.c, M);
^
478. return M;
479. }
| https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/modes/ccm128.c/#L477 |
d2a_code_trace_data_42253 | static void
JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
{
if ((uint32)skiplength<=data->bufferbytesleft)
{
data->buffercurrentbyte+=skiplength;
data->bufferbytesleft-=skiplength;
}
else
{
uint16 m;
m=skiplength-data->bufferbytesleft;
if (m<=data->filebytesleft)
{
data->bufferbytesleft=0;
data->fileoffset+=m;
data->filebytesleft-=m;
data->filepositioned=0;
}
else
{
data->bufferbytesleft=0;
data->filebytesleft=0;
}
}
}
libtiff/tif_jpeg.c:829: error: Integer Overflow L2
([0, +oo] - [-oo, 1]):unsigned64 by call to `JPEGFixupTagsSubsamplingSkip`.
libtiff/tif_jpeg.c:820:7: Call
818. for (o=1; o<data->tif->tif_dir.td_samplesperpixel; o++)
819. {
820. JPEGFixupTagsSubsamplingSkip(data,1);
^
821. if (!JPEGFixupTagsSubsamplingReadByte(data,&p))
822. return(0);
libtiff/tif_jpeg.c:898:1: Parameter `data->filebytesleft`
896. }
897.
898. static void
^
899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
900. {
libtiff/tif_jpeg.c:821:12: Call
819. {
820. JPEGFixupTagsSubsamplingSkip(data,1);
821. if (!JPEGFixupTagsSubsamplingReadByte(data,&p))
^
822. return(0);
823. if (p!=0x11)
libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft`
853. }
854.
855. static int
^
856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
857. {
libtiff/tif_jpeg.c:829:7: Call
827. return(1);
828. }
829. JPEGFixupTagsSubsamplingSkip(data,1);
^
830. }
831. if (((ph!=1)&&(ph!=2)&&(ph!=4))||((pv!=1)&&(pv!=2)&&(pv!=4)))
libtiff/tif_jpeg.c:898:1: <LHS trace>
896. }
897.
898. static void
^
899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
900. {
libtiff/tif_jpeg.c:898:1: Parameter `data->filebytesleft`
896. }
897.
898. static void
^
899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
900. {
libtiff/tif_jpeg.c:898:1: <RHS trace>
896. }
897.
898. static void
^
899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
900. {
libtiff/tif_jpeg.c:898:1: Parameter `data->filebytesleft`
896. }
897.
898. static void
^
899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
900. {
libtiff/tif_jpeg.c:914:4: Binary operation: ([0, +oo] - [-oo, 1]):unsigned64 by call to `JPEGFixupTagsSubsamplingSkip`
912. data->bufferbytesleft=0;
913. data->fileoffset+=m;
914. data->filebytesleft-=m;
^
915. data->filepositioned=0;
916. }
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L914 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.