id
stringlengths 25
25
| content
stringlengths 649
72.1k
| max_stars_repo_path
stringlengths 91
133
|
|---|---|---|
d2a_code_trace_data_45754
|
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:1138: error: Uninitialized Value
The value read from ref[_] was never initialized.
libavcodec/h264.c:1138:32:
1136. if(ref[0] == 0)
1137. fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
1138. if(ref[1] == 0)
^
1139. fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
1140. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1138
|
d2a_code_trace_data_45755
|
void CRYPTO_free(void *str)
{
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0);
free(str);
CRYPTO_mem_debug_free(str, 1);
} else {
free(str);
}
#else
free(str);
#endif
}
apps/ts.c:538: error: USE_AFTER_FREE
call to `EVP_MD_CTX_free()` eventually accesses memory that was invalidated by call to `free()` on line 537 indirectly during the call to `EVP_DigestFinal()`.
Showing all 20 steps of the trace
apps/ts.c:526:30: invalidation part of the trace starts here
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:526:30: passed as argument to `EVP_MD_CTX_new`
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:526:30: return from call to `EVP_MD_CTX_new`
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:526:9: assigned
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:537:14: when calling `EVP_DigestFinal` here
535. EVP_DigestUpdate(md_ctx, buffer, length);
536. }
537. if (!EVP_DigestFinal(md_ctx, *md_value, NULL)) {
^
538. EVP_MD_CTX_free(md_ctx);
539. return 0;
crypto/evp/digest.c:261:1: parameter `ctx` of EVP_DigestFinal
259.
260. /* The caller can assume that this removes any secret data from the context */
261. > int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
262. {
263. int ret;
crypto/evp/digest.c:265:5: when calling `EVP_MD_CTX_reset` here
263. int ret;
264. ret = EVP_DigestFinal_ex(ctx, md, size);
265. EVP_MD_CTX_reset(ctx);
^
266. return ret;
267. }
crypto/evp/digest.c:123:1: parameter `ctx` of EVP_MD_CTX_reset
121.
122. /* This call frees resources associated with the context */
123. > int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
124. {
125. if (ctx == NULL)
crypto/evp/digest.c:137:9: when calling `CRYPTO_clear_free` here
135. if (ctx->digest && ctx->digest->ctx_size && ctx->md_data
136. && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) {
137. OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);
^
138. }
139. EVP_PKEY_CTX_free(ctx->pctx);
crypto/mem.c:249:1: parameter `str` of CRYPTO_clear_free
247. }
248.
249. > void CRYPTO_clear_free(void *str, size_t num)
250. {
251. if (str == NULL)
crypto/mem.c:255:5: when calling `CRYPTO_free` here
253. if (num)
254. OPENSSL_cleanse(str, num);
255. CRYPTO_free(str);
^
256. }
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: was invalidated by call to `free()`
243. }
244. #else
245. free(str);
^
246. #endif
247. }
apps/ts.c:526:30: use-after-lifetime part of the trace starts here
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:526:30: passed as argument to `EVP_MD_CTX_new`
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:526:30: return from call to `EVP_MD_CTX_new`
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:526:9: assigned
524.
525. if (input) {
526. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
^
527. unsigned char buffer[4096];
528. int length;
apps/ts.c:538:13: when calling `EVP_MD_CTX_free` here
536. }
537. if (!EVP_DigestFinal(md_ctx, *md_value, NULL)) {
538. EVP_MD_CTX_free(md_ctx);
^
539. return 0;
540. }
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: invalid access occurs here
243. }
244. #else
245. free(str);
^
246. #endif
247. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245
|
d2a_code_trace_data_45756
|
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/rtpenc_h263_rfc2190.c:116: error: Integer Overflow L2
([1, +oo] - 22):unsigned32 by call to `bitstream_read`.
libavformat/rtpenc_h263_rfc2190.c:116:9: Call
114.
115. bitstream_init(&bc, buf, size * 8);
116. if (bitstream_read(&bc, 22) == 0x20) { /* Picture Start Code */
^
117. info.tr = bitstream_read(&bc, 8);
118. bitstream_skip(&bc, 2); /* PTYPE start, H.261 disambiguation */
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] - 22):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/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L139
|
d2a_code_trace_data_45757
|
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
{
int len = strlen(dst);
va_list vl;
va_start(vl, fmt);
len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
va_end(vl);
return len;
}
libavformat/http.c:477: error: Integer Overflow R2
([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf`.
libavformat/http.c:435:5: Array declaration
433. HTTPContext *s = h->priv_data;
434. int post, err;
435. char headers[1024] = "";
^
436. char *authstr = NULL, *proxyauthstr = NULL;
437. int64_t off = s->off;
libavformat/http.c:477:16: Call
475. sizeof(headers) - len);
476. if (!has_header(s->headers, "\r\nRange: ") && !post)
477. len += av_strlcatf(headers + len, sizeof(headers) - len,
^
478. "Range: bytes=%"PRId64"-\r\n", s->off);
479. if (send_expect_100 && !has_header(s->headers, "\r\nExpect: "))
libavutil/avstring.c:99:1: <LHS trace>
97. }
98.
99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
^
100. {
101. int len = strlen(dst);
libavutil/avstring.c:99:1: Parameter `size`
97. }
98.
99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
^
100. {
101. int len = strlen(dst);
libavutil/avstring.c:105:12: <RHS trace>
103.
104. va_start(vl, fmt);
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
^
106. va_end(vl);
107.
libavutil/avstring.c:105:12: Risky value from: vsnprintf
103.
104. va_start(vl, fmt);
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
^
106. va_end(vl);
107.
libavutil/avstring.c:105:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf`
103.
104. va_start(vl, fmt);
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
^
106. va_end(vl);
107.
|
https://github.com/libav/libav/blob/84a125c4c28f3e3e215d2e6c32f7f0ec43bbc04c/libavutil/avstring.c/#L105
|
d2a_code_trace_data_45758
|
BIO *bio_open_owner(const char *filename, int format, int private)
{
FILE *fp = NULL;
BIO *b = NULL;
int fd = -1, bflags, mode, binmode;
if (!private || filename == NULL || strcmp(filename, "-") == 0)
return bio_open_default(filename, 'w', format);
mode = O_WRONLY;
#ifdef O_CREAT
mode |= O_CREAT;
#endif
#ifdef O_TRUNC
mode |= O_TRUNC;
#endif
binmode = istext(format);
if (binmode) {
#ifdef O_BINARY
mode |= O_BINARY;
#elif defined(_O_BINARY)
mode |= _O_BINARY;
#endif
}
fd = open(filename, mode, 0600);
if (fd < 0)
goto err;
fp = fdopen(fd, modestr('w', format));
if (fp == NULL)
goto err;
bflags = BIO_CLOSE;
if (!binmode)
bflags |= BIO_FP_TEXT;
b = BIO_new_fp(fp, bflags);
if (b)
return b;
err:
BIO_printf(bio_err, "%s: Can't open \"%s\" for writing, %s\n",
opt_getprog(), filename, strerror(errno));
ERR_print_errors(bio_err);
if (fp)
fclose(fp);
else if (fd >= 0)
close(fd);
return NULL;
}
apps/apps.c:2831: error: RESOURCE_LEAK
resource of type `_IO_FILE` acquired by call to `fdopen()` at line 2823, column 10 is not released after line 2831, column 16.
Showing all 33 steps of the trace
apps/apps.c:2795:1: start of procedure bio_open_owner()
2793. * Open a file for writing, owner-read-only.
2794. */
2795. > BIO *bio_open_owner(const char *filename, int format, int private)
2796. {
2797. FILE *fp = NULL;
apps/apps.c:2797:5:
2795. BIO *bio_open_owner(const char *filename, int format, int private)
2796. {
2797. > FILE *fp = NULL;
2798. BIO *b = NULL;
2799. int fd = -1, bflags, mode, binmode;
apps/apps.c:2798:5:
2796. {
2797. FILE *fp = NULL;
2798. > BIO *b = NULL;
2799. int fd = -1, bflags, mode, binmode;
2800.
apps/apps.c:2799:5:
2797. FILE *fp = NULL;
2798. BIO *b = NULL;
2799. > int fd = -1, bflags, mode, binmode;
2800.
2801. if (!private || filename == NULL || strcmp(filename, "-") == 0)
apps/apps.c:2801:10: Taking false branch
2799. int fd = -1, bflags, mode, binmode;
2800.
2801. if (!private || filename == NULL || strcmp(filename, "-") == 0)
^
2802. return bio_open_default(filename, 'w', format);
2803.
apps/apps.c:2801:21: Taking false branch
2799. int fd = -1, bflags, mode, binmode;
2800.
2801. if (!private || filename == NULL || strcmp(filename, "-") == 0)
^
2802. return bio_open_default(filename, 'w', format);
2803.
apps/apps.c:2801:41: Taking false branch
2799. int fd = -1, bflags, mode, binmode;
2800.
2801. if (!private || filename == NULL || strcmp(filename, "-") == 0)
^
2802. return bio_open_default(filename, 'w', format);
2803.
apps/apps.c:2804:5:
2802. return bio_open_default(filename, 'w', format);
2803.
2804. > mode = O_WRONLY;
2805. #ifdef O_CREAT
2806. mode |= O_CREAT;
apps/apps.c:2806:5:
2804. mode = O_WRONLY;
2805. #ifdef O_CREAT
2806. > mode |= O_CREAT;
2807. #endif
2808. #ifdef O_TRUNC
apps/apps.c:2809:5:
2807. #endif
2808. #ifdef O_TRUNC
2809. > mode |= O_TRUNC;
2810. #endif
2811. binmode = istext(format);
apps/apps.c:2811:5:
2809. mode |= O_TRUNC;
2810. #endif
2811. > binmode = istext(format);
2812. if (binmode) {
2813. #ifdef O_BINARY
apps/apps.c:2736:1: start of procedure istext()
2734. * text and binary input/output on non-Unix platforms
2735. */
2736. > static int istext(int format)
2737. {
2738. return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
apps/apps.c:2738:12: Condition is true
2736. static int istext(int format)
2737. {
2738. return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
^
2739. }
2740.
apps/apps.c:2738:5:
2736. static int istext(int format)
2737. {
2738. > return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
2739. }
2740.
apps/apps.c:2739:1: return from a call to istext
2737. {
2738. return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
2739. > }
2740.
2741. BIO *dup_bio_in(int format)
apps/apps.c:2812:9: Taking true branch
2810. #endif
2811. binmode = istext(format);
2812. if (binmode) {
^
2813. #ifdef O_BINARY
2814. mode |= O_BINARY;
apps/apps.c:2820:5:
2818. }
2819.
2820. > fd = open(filename, mode, 0600);
2821. if (fd < 0)
2822. goto err;
apps/apps.c:2821:9: Taking false branch
2819.
2820. fd = open(filename, mode, 0600);
2821. if (fd < 0)
^
2822. goto err;
2823. fp = fdopen(fd, modestr('w', format));
apps/apps.c:2823:5:
2821. if (fd < 0)
2822. goto err;
2823. > fp = fdopen(fd, modestr('w', format));
2824. if (fp == NULL)
2825. goto err;
apps/apps.c:2763:1: start of procedure modestr()
2761. }
2762.
2763. > static const char *modestr(char mode, int format)
2764. {
2765. OPENSSL_assert(mode == 'a' || mode == 'r' || mode == 'w');
apps/apps.c:2765:5: Condition is true
2763. static const char *modestr(char mode, int format)
2764. {
2765. OPENSSL_assert(mode == 'a' || mode == 'r' || mode == 'w');
^
2766.
2767. switch (mode) {
apps/apps.c:2767:5:
2765. OPENSSL_assert(mode == 'a' || mode == 'r' || mode == 'w');
2766.
2767. > switch (mode) {
2768. case 'a':
2769. return istext(format) ? "a" : "ab";
apps/apps.c:2768:5: Switch condition is false. Skipping switch case
2766.
2767. switch (mode) {
2768. case 'a':
^
2769. return istext(format) ? "a" : "ab";
2770. case 'r':
apps/apps.c:2770:5: Switch condition is false. Skipping switch case
2768. case 'a':
2769. return istext(format) ? "a" : "ab";
2770. case 'r':
^
2771. return istext(format) ? "r" : "rb";
2772. case 'w':
apps/apps.c:2772:5: Switch condition is false. Skipping switch case
2770. case 'r':
2771. return istext(format) ? "r" : "rb";
2772. case 'w':
^
2773. return istext(format) ? "w" : "wb";
2774. }
apps/apps.c:2776:5:
2774. }
2775. /* The assert above should make sure we never reach this point */
2776. > return NULL;
2777. }
2778.
apps/apps.c:2777:1: return from a call to modestr
2775. /* The assert above should make sure we never reach this point */
2776. return NULL;
2777. > }
2778.
2779. static const char *modeverb(char mode)
apps/apps.c:2824:9: Taking false branch
2822. goto err;
2823. fp = fdopen(fd, modestr('w', format));
2824. if (fp == NULL)
^
2825. goto err;
2826. bflags = BIO_CLOSE;
apps/apps.c:2826:5:
2824. if (fp == NULL)
2825. goto err;
2826. > bflags = BIO_CLOSE;
2827. if (!binmode)
2828. bflags |= BIO_FP_TEXT;
apps/apps.c:2827:10: Taking false branch
2825. goto err;
2826. bflags = BIO_CLOSE;
2827. if (!binmode)
^
2828. bflags |= BIO_FP_TEXT;
2829. b = BIO_new_fp(fp, bflags);
apps/apps.c:2829:5: Skipping BIO_new_fp(): empty list of specs
2827. if (!binmode)
2828. bflags |= BIO_FP_TEXT;
2829. b = BIO_new_fp(fp, bflags);
^
2830. if (b)
2831. return b;
apps/apps.c:2830:9: Taking true branch
2828. bflags |= BIO_FP_TEXT;
2829. b = BIO_new_fp(fp, bflags);
2830. if (b)
^
2831. return b;
2832.
apps/apps.c:2831:9:
2829. b = BIO_new_fp(fp, bflags);
2830. if (b)
2831. > return b;
2832.
2833. err:
|
https://github.com/openssl/openssl/blob/84cf97af0691290d53c0a51807fa15f0843219ef/apps/apps.c/#L2831
|
d2a_code_trace_data_45759
|
void *lh_delete(_LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
void *ret;
lh->error=0;
rn=getrn(lh,data,&hash);
if (*rn == NULL)
{
lh->num_no_delete++;
return(NULL);
}
else
{
nn= *rn;
*rn=nn->next;
ret=nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
contract(lh);
return(ret);
}
ssl/d1_pkt.c:720: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`.
Showing all 15 steps of the trace
ssl/d1_pkt.c:556:1: Parameter `s->ctx->sessions->num_items`
554. */
555. /* used only by dtls1_read_bytes */
556. > int dtls1_get_record(SSL *s)
557. {
558. int ssl_major,ssl_minor;
ssl/d1_pkt.c:570:5: Call
568. /* The epoch may have changed. If so, process all the
569. * pending records. This is a non-blocking operation. */
570. if(dtls1_process_buffered_records(s)<0)
^
571. return -1;
572.
ssl/d1_pkt.c:303:1: Parameter `s->ctx->sessions->num_items`
301. &((s)->d1->processed_rcds))
302.
303. > static int
304. dtls1_process_buffered_records(SSL *s)
305. {
ssl/d1_pkt.c:720:7: Call
718. }
719.
720. if (!dtls1_process_record(s))
^
721. {
722. rr->length = 0;
ssl/d1_pkt.c:381:1: Parameter `s->ctx->sessions->num_items`
379. #endif
380.
381. > static int
382. dtls1_process_record(SSL *s)
383. {
ssl/d1_pkt.c:540:2: Call
538.
539. f_err:
540. ssl3_send_alert(s,SSL3_AL_FATAL,al);
^
541. err:
542. return(0);
ssl/s3_pkt.c:1798:1: Parameter `s->ctx->sessions->num_items`
1796. }
1797.
1798. > int ssl3_send_alert(SSL *s, int level, int desc)
1799. {
1800. /* Map tls/ssl alert value to correct one */
ssl/s3_pkt.c:1807:3: Call
1805. /* If a fatal one, remove from cache */
1806. if ((level == SSL3_AL_FATAL) && (s->session != NULL))
1807. SSL_CTX_remove_session(s->ctx,s->session);
^
1808.
1809. s->s3->alert_dispatch=1;
ssl/ssl_sess.c:683:1: Parameter `ctx->sessions->num_items`
681. }
682.
683. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
684. {
685. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:685:9: Call
683. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
684. {
685. return remove_session_lock(ctx, c, 1);
^
686. }
687.
ssl/ssl_sess.c:688:1: Parameter `ctx->sessions->num_items`
686. }
687.
688. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
689. {
690. SSL_SESSION *r;
ssl/ssl_sess.c:699:6: Call
697. {
698. ret=1;
699. r=lh_SSL_SESSION_delete(ctx->sessions,c);
^
700. SSL_SESSION_list_remove(ctx,c);
701. }
crypto/lhash/lhash.c:218:1: <LHS trace>
216. }
217.
218. > void *lh_delete(_LHASH *lh, const void *data)
219. {
220. unsigned long hash;
crypto/lhash/lhash.c:218:1: Parameter `lh->num_items`
216. }
217.
218. > void *lh_delete(_LHASH *lh, const void *data)
219. {
220. unsigned long hash;
crypto/lhash/lhash.c:241:2: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `dtls1_process_record`
239. }
240.
241. lh->num_items--;
^
242. if ((lh->num_nodes > MIN_NODES) &&
243. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/732192a0796c4ecbef3b13ccc8ee8ab23e28f483/crypto/lhash/lhash.c/#L241
|
d2a_code_trace_data_45760
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:309: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`.
Showing all 16 steps of the trace
crypto/ec/ecdsa_ossl.c:239:5: Call
237. }
238.
239. BN_CTX_start(ctx);
^
240. tmp = BN_CTX_get(ctx);
241. m = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/ec/ecdsa_ossl.c:309:14: Call
307. goto err;
308. }
309. if (!BN_mod_mul(tmp, tmp, ret->r, order, ctx)) {
^
310. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
311. goto err;
crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:83:5: Call
81. bn_check_top(m);
82.
83. BN_CTX_start(ctx);
^
84. if ((t = BN_CTX_get(ctx)) == NULL)
85. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:32:5: Call
30. }
31.
32. BN_CTX_start(ctx);
^
33. rr = (a != r) ? r : BN_CTX_get(ctx);
34. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_sqr.c:100:5: Call
98. bn_check_top(rr);
99. bn_check_top(tmp);
100. BN_CTX_end(ctx);
^
101. return ret;
102. }
crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:274:1: <LHS trace>
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:274:1: Parameter `st->depth`
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`
274. static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
^
277. }
278.
|
https://github.com/openssl/openssl/blob/ddb634fe6f9aeea34fe036cf804903b4240d38ac/crypto/bn/bn_ctx.c/#L276
|
d2a_code_trace_data_45761
|
int ossl_init_thread_start(uint64_t opts)
{
struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
if (locals == NULL)
return 0;
if (opts & OPENSSL_INIT_THREAD_ASYNC) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
"marking thread for async\n");
#endif
locals->async = 1;
}
if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
"marking thread for err_state\n");
#endif
locals->err_state = 1;
}
return 1;
}
crypto/init.c:393: error: MEMORY_LEAK
memory dynamically allocated by call to `ossl_init_get_thread_local()` at line 375, column 44 is not reachable after line 393, column 9.
Showing all 38 steps of the trace
crypto/init.c:373:1: start of procedure ossl_init_thread_start()
371. }
372.
373. > int ossl_init_thread_start(uint64_t opts)
374. {
375. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
crypto/init.c:375:5:
373. int ossl_init_thread_start(uint64_t opts)
374. {
375. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
376.
377. if (locals == NULL)
crypto/init.c:87:1: start of procedure ossl_init_get_thread_local()
85. }
86.
87. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
88. {
89. struct thread_local_inits_st *local =
crypto/init.c:89:5:
87. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
88. {
89. > struct thread_local_inits_st *local =
90. CRYPTO_THREAD_get_local(&threadstopkey);
91.
crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local()
118. }
119.
120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
121. {
122. return pthread_getspecific(*key);
crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation
120. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
121. {
122. return pthread_getspecific(*key);
^
123. }
124.
crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local
121. {
122. return pthread_getspecific(*key);
123. > }
124.
125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
crypto/init.c:92:9: Taking true branch
90. CRYPTO_THREAD_get_local(&threadstopkey);
91.
92. if (local == NULL && alloc) {
^
93. local = OPENSSL_zalloc(sizeof *local);
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
crypto/init.c:92:26: Taking true branch
90. CRYPTO_THREAD_get_local(&threadstopkey);
91.
92. if (local == NULL && alloc) {
^
93. local = OPENSSL_zalloc(sizeof *local);
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
crypto/init.c:93:9:
91.
92. if (local == NULL && alloc) {
93. > local = OPENSSL_zalloc(sizeof *local);
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
95. }
crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
144. }
145.
146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:148:5:
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. > void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
117. }
118.
119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. void *ret = NULL;
crypto/mem.c:121:5:
119. void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. > void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:123:9: Taking false branch
121. void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
124. return malloc_impl(num, file, line);
125.
crypto/mem.c:126:9: Taking false branch
124. return malloc_impl(num, file, line);
125.
126. if (num <= 0)
^
127. return NULL;
128.
crypto/mem.c:129:5:
127. return NULL;
128.
129. > allow_customize = 0;
130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
131. if (call_malloc_debug) {
crypto/mem.c:139:5:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:139:24:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:140:5:
138. #else
139. osslargused(file); osslargused(line);
140. > ret = malloc(num);
141. #endif
142.
crypto/mem.c:143:5:
141. #endif
142.
143. > return ret;
144. }
145.
crypto/mem.c:144:1: return from a call to CRYPTO_malloc
142.
143. return ret;
144. > }
145.
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:150:9: Taking true branch
148. void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
^
151. memset(ret, 0, num);
152. return ret;
crypto/mem.c:151:9:
149.
150. if (ret != NULL)
151. > memset(ret, 0, num);
152. return ret;
153. }
crypto/mem.c:152:5:
150. if (ret != NULL)
151. memset(ret, 0, num);
152. > return ret;
153. }
154.
crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
151. memset(ret, 0, num);
152. return ret;
153. > }
154.
155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/init.c:94:9:
92. if (local == NULL && alloc) {
93. local = OPENSSL_zalloc(sizeof *local);
94. > CRYPTO_THREAD_set_local(&threadstopkey, local);
95. }
96. if (!alloc) {
crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local()
123. }
124.
125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
126. {
127. if (pthread_setspecific(*key, val) != 0)
crypto/threads_pthread.c:127:9: Taking true branch
125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
126. {
127. if (pthread_setspecific(*key, val) != 0)
^
128. return 0;
129.
crypto/threads_pthread.c:128:9:
126. {
127. if (pthread_setspecific(*key, val) != 0)
128. > return 0;
129.
130. return 1;
crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local
129.
130. return 1;
131. > }
132.
133. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)
crypto/init.c:96:10: Taking false branch
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
95. }
96. if (!alloc) {
^
97. CRYPTO_THREAD_set_local(&threadstopkey, NULL);
98. }
crypto/init.c:100:5:
98. }
99.
100. > return local;
101. }
102.
crypto/init.c:101:1: return from a call to ossl_init_get_thread_local
99.
100. return local;
101. > }
102.
103. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;
crypto/init.c:377:9: Taking false branch
375. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
376.
377. if (locals == NULL)
^
378. return 0;
379.
crypto/init.c:380:9: Taking false branch
378. return 0;
379.
380. if (opts & OPENSSL_INIT_THREAD_ASYNC) {
^
381. #ifdef OPENSSL_INIT_DEBUG
382. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
crypto/init.c:388:9: Taking true branch
386. }
387.
388. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
^
389. #ifdef OPENSSL_INIT_DEBUG
390. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
crypto/init.c:393:9:
391. "marking thread for err_state\n");
392. #endif
393. > locals->err_state = 1;
394. }
395.
|
https://github.com/openssl/openssl/blob/91056e72693b4ee8cb5339d9091871ffc3b6f776/crypto/init.c/#L393
|
d2a_code_trace_data_45762
|
static int sdp_read_header(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
int size, i, err;
char *content;
char url[1024];
if (!ff_network_init())
return AVERROR(EIO);
if (s->max_delay < 0)
s->max_delay = DEFAULT_REORDERING_DELAY;
if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
content = av_malloc(SDP_MAX_SIZE);
size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
if (size <= 0) {
av_free(content);
return AVERROR_INVALIDDATA;
}
content[size] ='\0';
err = ff_sdp_parse(s, content);
av_free(content);
if (err) goto fail;
for (i = 0; i < rt->nb_rtsp_streams; i++) {
char namebuf[50];
rtsp_st = rt->rtsp_streams[i];
if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port,
rtsp_st->sdp_ttl,
rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
if (rtsp_st->source_addr[0])
av_strlcatf(url, sizeof(url), "&sources=%s", rtsp_st->source_addr);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
}
if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
fail:
ff_rtsp_close_streams(s);
ff_network_close();
return err;
}
libavformat/rtsp.c:2085: error: Null Dereference
pointer `content` last assigned on line 2079 could be null and is dereferenced at line 2085, column 5.
libavformat/rtsp.c:2061:1: start of procedure sdp_read_header()
2059. }
2060.
2061. static int sdp_read_header(AVFormatContext *s)
^
2062. {
2063. RTSPState *rt = s->priv_data;
libavformat/rtsp.c:2063:5:
2061. static int sdp_read_header(AVFormatContext *s)
2062. {
2063. RTSPState *rt = s->priv_data;
^
2064. RTSPStream *rtsp_st;
2065. int size, i, err;
libavformat/rtsp.c:2069:10:
2067. char url[1024];
2068.
2069. if (!ff_network_init())
^
2070. return AVERROR(EIO);
2071.
libavformat/network.c:122:1: start of procedure ff_network_init()
120. int ff_network_inited_globally;
121.
122. int ff_network_init(void)
^
123. {
124. #if HAVE_WINSOCK2_H
libavformat/network.c:128:10: Taking true branch
126. #endif
127.
128. if (!ff_network_inited_globally)
^
129. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
130. "network initialization. Please use "
libavformat/network.c:129:9: Skipping av_log(): empty list of specs
127.
128. if (!ff_network_inited_globally)
129. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
^
130. "network initialization. Please use "
131. "avformat_network_init(), this will "
libavformat/network.c:137:5:
135. return 0;
136. #endif
137. return 1;
^
138. }
139.
libavformat/network.c:138:1: return from a call to ff_network_init
136. #endif
137. return 1;
138. }
^
139.
140. int ff_network_wait_fd(int fd, int write)
libavformat/rtsp.c:2069:10: Taking false branch
2067. char url[1024];
2068.
2069. if (!ff_network_init())
^
2070. return AVERROR(EIO);
2071.
libavformat/rtsp.c:2072:9: Taking false branch
2070. return AVERROR(EIO);
2071.
2072. if (s->max_delay < 0) /* Not set by the caller */
^
2073. s->max_delay = DEFAULT_REORDERING_DELAY;
2074. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
libavformat/rtsp.c:2074:9: Taking true branch
2072. if (s->max_delay < 0) /* Not set by the caller */
2073. s->max_delay = DEFAULT_REORDERING_DELAY;
2074. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
^
2075. rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
2076.
libavformat/rtsp.c:2075:9:
2073. s->max_delay = DEFAULT_REORDERING_DELAY;
2074. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
2075. rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
^
2076.
2077. /* read the whole sdp file */
libavformat/rtsp.c:2079:5:
2077. /* read the whole sdp file */
2078. /* XXX: better loading */
2079. content = av_malloc(SDP_MAX_SIZE);
^
2080. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2081. if (size <= 0) {
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possible ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possible ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking true branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:81:9:
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
81. ptr = NULL;
^
82. #elif HAVE_ALIGNED_MALLOC
83. ptr = _aligned_malloc(size, 32);
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavformat/rtsp.c:2080:5: Skipping avio_read(): empty list of specs
2078. /* XXX: better loading */
2079. content = av_malloc(SDP_MAX_SIZE);
2080. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
^
2081. if (size <= 0) {
2082. av_free(content);
libavformat/rtsp.c:2081:9: Taking false branch
2079. content = av_malloc(SDP_MAX_SIZE);
2080. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2081. if (size <= 0) {
^
2082. av_free(content);
2083. return AVERROR_INVALIDDATA;
libavformat/rtsp.c:2085:5:
2083. return AVERROR_INVALIDDATA;
2084. }
2085. content[size] ='\0';
^
2086.
2087. err = ff_sdp_parse(s, content);
|
https://github.com/libav/libav/blob/fd8189932147a524fe43532b46baa35e8be92a1b/libavformat/rtsp.c/#L2085
|
d2a_code_trace_data_45763
|
static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
const uint8_t *buf, int buf_size)
{
GetBitContext gb;
int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
int dts_flag = -1, cts_flag = -1;
int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
init_get_bits(&gb, buf, buf_size * 8);
if (sl->use_au_start)
au_start_flag = get_bits1(&gb);
if (sl->use_au_end)
au_end_flag = get_bits1(&gb);
if (!sl->use_au_start && !sl->use_au_end)
au_start_flag = au_end_flag = 1;
if (sl->ocr_len > 0)
ocr_flag = get_bits1(&gb);
if (sl->use_idle)
idle_flag = get_bits1(&gb);
if (sl->use_padding)
padding_flag = get_bits1(&gb);
if (padding_flag)
padding_bits = get_bits(&gb, 3);
if (!idle_flag && (!padding_flag || padding_bits != 0)) {
if (sl->packet_seq_num_len)
skip_bits_long(&gb, sl->packet_seq_num_len);
if (sl->degr_prior_len)
if (get_bits1(&gb))
skip_bits(&gb, sl->degr_prior_len);
if (ocr_flag)
skip_bits_long(&gb, sl->ocr_len);
if (au_start_flag) {
if (sl->use_rand_acc_pt)
get_bits1(&gb);
if (sl->au_seq_num_len > 0)
skip_bits_long(&gb, sl->au_seq_num_len);
if (sl->use_timestamps) {
dts_flag = get_bits1(&gb);
cts_flag = get_bits1(&gb);
}
}
if (sl->inst_bitrate_len)
inst_bitrate_flag = get_bits1(&gb);
if (dts_flag == 1)
dts = get_bits64(&gb, sl->timestamp_len);
if (cts_flag == 1)
cts = get_bits64(&gb, sl->timestamp_len);
if (sl->au_len > 0)
skip_bits_long(&gb, sl->au_len);
if (inst_bitrate_flag)
skip_bits_long(&gb, sl->inst_bitrate_len);
}
if (dts != AV_NOPTS_VALUE)
pes->dts = dts;
if (cts != AV_NOPTS_VALUE)
pes->pts = cts;
if (sl->timestamp_len && sl->timestamp_res)
avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res);
return (get_bits_count(&gb) + 7) >> 3;
}
libavformat/mpegts.c:741: error: Null Dereference
pointer `&gb->buffer` last assigned on line 736 could be null and is dereferenced by call to `get_bits1()` at line 741, column 23.
libavformat/mpegts.c:728:1: start of procedure read_sl_header()
726. }
727.
728. static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
^
729. const uint8_t *buf, int buf_size)
730. {
libavformat/mpegts.c:732:5:
730. {
731. GetBitContext gb;
732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
^
733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
734. int dts_flag = -1, cts_flag = -1;
libavformat/mpegts.c:733:5:
731. GetBitContext gb;
732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
^
734. int dts_flag = -1, cts_flag = -1;
735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
libavformat/mpegts.c:734:5:
732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
734. int dts_flag = -1, cts_flag = -1;
^
735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
736. init_get_bits(&gb, buf, buf_size * 8);
libavformat/mpegts.c:735:5:
733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
734. int dts_flag = -1, cts_flag = -1;
735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
^
736. init_get_bits(&gb, buf, buf_size * 8);
737.
libavformat/mpegts.c:736:5:
734. int dts_flag = -1, cts_flag = -1;
735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
736. init_get_bits(&gb, buf, buf_size * 8);
^
737.
738. if (sl->use_au_start)
libavcodec/get_bits.h:376:1: start of procedure init_get_bits()
374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
375. */
376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
377. int bit_size)
378. {
libavcodec/get_bits.h:380:5:
378. {
379. int buffer_size;
380. int ret = 0;
^
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
libavcodec/get_bits.h:382:9: Taking true branch
380. int ret = 0;
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
383. bit_size = 0;
384. buffer = NULL;
libavcodec/get_bits.h:383:9:
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
383. bit_size = 0;
^
384. buffer = NULL;
385. ret = AVERROR_INVALIDDATA;
libavcodec/get_bits.h:384:9:
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
383. bit_size = 0;
384. buffer = NULL;
^
385. ret = AVERROR_INVALIDDATA;
386. }
libavcodec/get_bits.h:385:9:
383. bit_size = 0;
384. buffer = NULL;
385. ret = AVERROR_INVALIDDATA;
^
386. }
387.
libavcodec/get_bits.h:388:5:
386. }
387.
388. buffer_size = (bit_size + 7) >> 3;
^
389.
390. s->buffer = buffer;
libavcodec/get_bits.h:390:5:
388. buffer_size = (bit_size + 7) >> 3;
389.
390. s->buffer = buffer;
^
391. s->size_in_bits = bit_size;
392. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:391:5:
389.
390. s->buffer = buffer;
391. s->size_in_bits = bit_size;
^
392. #if !UNCHECKED_BITSTREAM_READER
393. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:393:5:
391. s->size_in_bits = bit_size;
392. #if !UNCHECKED_BITSTREAM_READER
393. s->size_in_bits_plus8 = bit_size + 8;
^
394. #endif
395. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:395:5:
393. s->size_in_bits_plus8 = bit_size + 8;
394. #endif
395. s->buffer_end = buffer + buffer_size;
^
396. s->index = 0;
397.
libavcodec/get_bits.h:396:5:
394. #endif
395. s->buffer_end = buffer + buffer_size;
396. s->index = 0;
^
397.
398. return ret;
libavcodec/get_bits.h:398:5:
396. s->index = 0;
397.
398. return ret;
^
399. }
400.
libavcodec/get_bits.h:399:1: return from a call to init_get_bits
397.
398. return ret;
399. }
^
400.
401. /**
libavformat/mpegts.c:738:9: Taking false branch
736. init_get_bits(&gb, buf, buf_size * 8);
737.
738. if (sl->use_au_start)
^
739. au_start_flag = get_bits1(&gb);
740. if (sl->use_au_end)
libavformat/mpegts.c:740:9: Taking true branch
738. if (sl->use_au_start)
739. au_start_flag = get_bits1(&gb);
740. if (sl->use_au_end)
^
741. au_end_flag = get_bits1(&gb);
742. if (!sl->use_au_start && !sl->use_au_end)
libavformat/mpegts.c:741:9:
739. au_start_flag = get_bits1(&gb);
740. if (sl->use_au_end)
741. au_end_flag = get_bits1(&gb);
^
742. if (!sl->use_au_start && !sl->use_au_end)
743. au_start_flag = au_end_flag = 1;
libavcodec/get_bits.h:272:1: start of procedure get_bits1()
270. }
271.
272. static inline unsigned int get_bits1(GetBitContext *s)
^
273. {
274. unsigned int index = s->index;
libavcodec/get_bits.h:274:5:
272. static inline unsigned int get_bits1(GetBitContext *s)
273. {
274. unsigned int index = s->index;
^
275. uint8_t result = s->buffer[index >> 3];
276. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:275:5:
273. {
274. unsigned int index = s->index;
275. uint8_t result = s->buffer[index >> 3];
^
276. #ifdef BITSTREAM_READER_LE
277. result >>= index & 7;
|
https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavformat/mpegts.c/#L741
|
d2a_code_trace_data_45764
|
static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs,
STORE_ATTR_TYPES code)
{
if (ATTR_IS_SET(attrs,code))
{
switch(code)
{
case STORE_ATTR_FRIENDLYNAME:
case STORE_ATTR_EMAIL:
case STORE_ATTR_FILENAME:
STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0);
break;
case STORE_ATTR_KEYID:
case STORE_ATTR_ISSUERKEYID:
case STORE_ATTR_SUBJECTKEYID:
case STORE_ATTR_ISSUERSERIALHASH:
case STORE_ATTR_CERTHASH:
STORE_ATTR_INFO_modify_sha1str(attrs, code, NULL, 0);
break;
case STORE_ATTR_ISSUER:
case STORE_ATTR_SUBJECT:
STORE_ATTR_INFO_modify_dn(attrs, code, NULL);
break;
case STORE_ATTR_SERIAL:
STORE_ATTR_INFO_modify_number(attrs, code, NULL);
break;
default:
break;
}
}
}
crypto/store/str_lib.c:1169: error: NULL_DEREFERENCE
pointer `null` is dereferenced by call to `STORE_ATTR_INFO_modify_sha1str()` at line 1169, column 4.
Showing all 80 steps of the trace
crypto/store/str_lib.c:1152:1: start of procedure STORE_ATTR_INFO_attr_free()
1150. return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO));
1151. }
1152. > static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs,
1153. STORE_ATTR_TYPES code)
1154. {
crypto/store/str_lib.c:1155:6: Taking true branch
1153. STORE_ATTR_TYPES code)
1154. {
1155. if (ATTR_IS_SET(attrs,code))
^
1156. {
1157. switch(code)
crypto/store/str_lib.c:1155:6: Taking true branch
1153. STORE_ATTR_TYPES code)
1154. {
1155. if (ATTR_IS_SET(attrs,code))
^
1156. {
1157. switch(code)
crypto/store/str_lib.c:1155:6: Taking true branch
1153. STORE_ATTR_TYPES code)
1154. {
1155. if (ATTR_IS_SET(attrs,code))
^
1156. {
1157. switch(code)
crypto/store/str_lib.c:1157:3:
1155. if (ATTR_IS_SET(attrs,code))
1156. {
1157. > switch(code)
1158. {
1159. case STORE_ATTR_FRIENDLYNAME:
crypto/store/str_lib.c:1159:3: Switch condition is false. Skipping switch case
1157. switch(code)
1158. {
1159. case STORE_ATTR_FRIENDLYNAME:
^
1160. case STORE_ATTR_EMAIL:
1161. case STORE_ATTR_FILENAME:
crypto/store/str_lib.c:1160:3: Switch condition is false. Skipping switch case
1158. {
1159. case STORE_ATTR_FRIENDLYNAME:
1160. case STORE_ATTR_EMAIL:
^
1161. case STORE_ATTR_FILENAME:
1162. STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0);
crypto/store/str_lib.c:1161:3: Switch condition is false. Skipping switch case
1159. case STORE_ATTR_FRIENDLYNAME:
1160. case STORE_ATTR_EMAIL:
1161. case STORE_ATTR_FILENAME:
^
1162. STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0);
1163. break;
crypto/store/str_lib.c:1164:3: Switch condition is true. Entering switch case
1162. STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0);
1163. break;
1164. case STORE_ATTR_KEYID:
^
1165. case STORE_ATTR_ISSUERKEYID:
1166. case STORE_ATTR_SUBJECTKEYID:
crypto/store/str_lib.c:1169:4:
1167. case STORE_ATTR_ISSUERSERIALHASH:
1168. case STORE_ATTR_CERTHASH:
1169. > STORE_ATTR_INFO_modify_sha1str(attrs, code, NULL, 0);
1170. break;
1171. case STORE_ATTR_ISSUER:
crypto/store/str_lib.c:1350:1: start of procedure STORE_ATTR_INFO_modify_sha1str()
1348. return STORE_ATTR_INFO_set_cstr(attrs, code, cstr, cstr_size);
1349. }
1350. > int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1351. unsigned char *sha1str, size_t sha1str_size)
1352. {
crypto/store/str_lib.c:1353:7: Taking false branch
1351. unsigned char *sha1str, size_t sha1str_size)
1352. {
1353. if (!attrs)
^
1354. {
1355. STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR,
crypto/store/str_lib.c:1359:6: Taking true branch
1357. return 0;
1358. }
1359. if (ATTR_IS_SET(attrs,code))
^
1360. {
1361. OPENSSL_free(attrs->values[code].sha1string);
crypto/store/str_lib.c:1359:6: Taking false branch
1357. return 0;
1358. }
1359. if (ATTR_IS_SET(attrs,code))
^
1360. {
1361. OPENSSL_free(attrs->values[code].sha1string);
crypto/store/str_lib.c:1365:2:
1363. CLEAR_ATTRBIT(attrs, code);
1364. }
1365. > return STORE_ATTR_INFO_set_sha1str(attrs, code, sha1str, sha1str_size);
1366. }
1367. int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
crypto/store/str_lib.c:1271:1: start of procedure STORE_ATTR_INFO_set_sha1str()
1269. return 0;
1270. }
1271. > int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1272. unsigned char *sha1str, size_t sha1str_size)
1273. {
crypto/store/str_lib.c:1274:7: Taking false branch
1272. unsigned char *sha1str, size_t sha1str_size)
1273. {
1274. if (!attrs)
^
1275. {
1276. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR,
crypto/store/str_lib.c:1280:7: Taking false branch
1278. return 0;
1279. }
1280. if (!ATTR_IS_SET(attrs,code))
^
1281. {
1282. if ((attrs->values[code].sha1string =
crypto/store/str_lib.c:1280:7: Taking true branch
1278. return 0;
1279. }
1280. if (!ATTR_IS_SET(attrs,code))
^
1281. {
1282. if ((attrs->values[code].sha1string =
crypto/store/str_lib.c:1282:8:
1280. if (!ATTR_IS_SET(attrs,code))
1281. {
1282. > if ((attrs->values[code].sha1string =
1283. (unsigned char *)BUF_memdup(sha1str,
1284. sha1str_size)))
crypto/buffer/buffer.c:187:1: start of procedure BUF_memdup()
185. }
186.
187. > void *BUF_memdup(const void *data, size_t siz)
188. {
189. void *ret;
crypto/buffer/buffer.c:191:6: Taking false branch
189. void *ret;
190.
191. if (data == NULL) return(NULL);
^
192.
193. ret=OPENSSL_malloc(siz);
crypto/buffer/buffer.c:193:2:
191. if (data == NULL) return(NULL);
192.
193. > ret=OPENSSL_malloc(siz);
194. if (ret == NULL)
195. {
crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
289. }
290.
291. > void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. void *ret = NULL;
crypto/mem.c:293:2:
291. void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. > void *ret = NULL;
294. extern unsigned char cleanse_ctr;
295.
crypto/mem.c:296:6: Taking false branch
294. extern unsigned char cleanse_ctr;
295.
296. if (num < 0) return NULL;
^
297.
298. allow_customize = 0;
crypto/mem.c:298:2:
296. if (num < 0) return NULL;
297.
298. > allow_customize = 0;
299. if (malloc_debug_func != NULL)
300. {
crypto/mem.c:299:6: Taking false branch
297.
298. allow_customize = 0;
299. if (malloc_debug_func != NULL)
^
300. {
301. allow_customize_debug = 0;
crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
304. ret = malloc_ex_func(num,file,line);
^
305. #ifdef LEVITTE_DEBUG_MEM
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:308:6: Taking false branch
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
307. #endif
308. if (malloc_debug_func != NULL)
^
309. malloc_debug_func(ret, num, file, line, 1);
310.
crypto/mem.c:314:12: Taking false branch
312. * sanitisation function can't be optimised out. NB: We only do
313. * this for >2Kb so the overhead doesn't bother us. */
314. if(ret && (num > 2048))
^
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
crypto/mem.c:317:2:
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
317. > return ret;
318. }
319.
crypto/mem.c:318:2: return from a call to CRYPTO_malloc
316.
317. return ret;
318. }
^
319.
320. void *CRYPTO_realloc(void *str, int num, const char *file, int line)
crypto/buffer/buffer.c:194:6: Taking true branch
192.
193. ret=OPENSSL_malloc(siz);
194. if (ret == NULL)
^
195. {
196. BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE);
crypto/buffer/buffer.c:196:3:
194. if (ret == NULL)
195. {
196. > BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE);
197. return(NULL);
198. }
crypto/err/err.c:619:1: start of procedure ERR_put_error()
617. /********************************************************/
618.
619. > void ERR_put_error(int lib, int func, int reason, const char *file,
620. int line)
621. {
crypto/err/err.c:643:2: Skipping ERR_get_state(): empty list of specs
641. }
642. #endif
643. es=ERR_get_state();
^
644.
645. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:645:2:
643. es=ERR_get_state();
644.
645. > es->top=(es->top+1)%ERR_NUM_ERRORS;
646. if (es->top == es->bottom)
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:646:6: Taking false branch
644.
645. es->top=(es->top+1)%ERR_NUM_ERRORS;
646. if (es->top == es->bottom)
^
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
648. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
crypto/err/err.c:648:2:
646. if (es->top == es->bottom)
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
648. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
crypto/err/err.c:649:2:
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
648. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
649. > es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
crypto/err/err.c:650:2:
648. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
649. es->err_file[es->top]=file;
650. > es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
652. }
crypto/err/err.c:651:2: Taking true branch
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
^
652. }
653.
crypto/err/err.c:651:2: Taking true branch
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
^
652. }
653.
crypto/mem.c:367:1: start of procedure CRYPTO_free()
365. }
366.
367. > void CRYPTO_free(void *str)
368. {
369. if (free_debug_func != NULL)
crypto/mem.c:369:6: Taking true branch
367. void CRYPTO_free(void *str)
368. {
369. if (free_debug_func != NULL)
^
370. free_debug_func(str, 0);
371. #ifdef LEVITTE_DEBUG_MEM
crypto/mem.c:370:3: Skipping __function_pointer__(): unresolved function pointer
368. {
369. if (free_debug_func != NULL)
370. free_debug_func(str, 0);
^
371. #ifdef LEVITTE_DEBUG_MEM
372. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
crypto/mem.c:374:2: Skipping __function_pointer__(): unresolved function pointer
372. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
373. #endif
374. free_func(str);
^
375. if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
crypto/mem.c:375:6: Taking true branch
373. #endif
374. free_func(str);
375. if (free_debug_func != NULL)
^
376. free_debug_func(NULL, 1);
377. }
crypto/mem.c:376:3: Skipping __function_pointer__(): unresolved function pointer
374. free_func(str);
375. if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
^
377. }
378.
crypto/mem.c:375:2:
373. #endif
374. free_func(str);
375. > if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
377. }
crypto/mem.c:377:2: return from a call to CRYPTO_free
375. if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
377. }
^
378.
379. void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
crypto/err/err.c:651:2:
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. > err_clear_data(es,es->top);
652. }
653.
crypto/err/err.c:652:2: return from a call to ERR_put_error
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
652. }
^
653.
654. void ERR_clear_error(void)
crypto/buffer/buffer.c:197:3:
195. {
196. BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE);
197. > return(NULL);
198. }
199. return memcpy(ret, data, siz);
crypto/buffer/buffer.c:200:2: return from a call to BUF_memdup
198. }
199. return memcpy(ret, data, siz);
200. }
^
201.
202. size_t BUF_strlcpy(char *dst, const char *src, size_t size)
crypto/store/str_lib.c:1282:8: Taking false branch
1280. if (!ATTR_IS_SET(attrs,code))
1281. {
1282. if ((attrs->values[code].sha1string =
^
1283. (unsigned char *)BUF_memdup(sha1str,
1284. sha1str_size)))
crypto/store/str_lib.c:1286:3:
1284. sha1str_size)))
1285. return 1;
1286. > STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR,
1287. ERR_R_MALLOC_FAILURE);
1288. return 0;
crypto/err/err.c:619:1: start of procedure ERR_put_error()
617. /********************************************************/
618.
619. > void ERR_put_error(int lib, int func, int reason, const char *file,
620. int line)
621. {
crypto/err/err.c:643:2: Skipping ERR_get_state(): empty list of specs
641. }
642. #endif
643. es=ERR_get_state();
^
644.
645. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:645:2:
643. es=ERR_get_state();
644.
645. > es->top=(es->top+1)%ERR_NUM_ERRORS;
646. if (es->top == es->bottom)
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:646:6: Taking false branch
644.
645. es->top=(es->top+1)%ERR_NUM_ERRORS;
646. if (es->top == es->bottom)
^
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
648. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
crypto/err/err.c:648:2:
646. if (es->top == es->bottom)
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
648. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
crypto/err/err.c:649:2:
647. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
648. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
649. > es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
crypto/err/err.c:650:2:
648. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
649. es->err_file[es->top]=file;
650. > es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
652. }
crypto/err/err.c:651:2: Taking true branch
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
^
652. }
653.
crypto/err/err.c:651:2: Taking true branch
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
^
652. }
653.
crypto/mem.c:367:1: start of procedure CRYPTO_free()
365. }
366.
367. > void CRYPTO_free(void *str)
368. {
369. if (free_debug_func != NULL)
crypto/mem.c:369:6: Taking true branch
367. void CRYPTO_free(void *str)
368. {
369. if (free_debug_func != NULL)
^
370. free_debug_func(str, 0);
371. #ifdef LEVITTE_DEBUG_MEM
crypto/mem.c:370:3: Skipping __function_pointer__(): unresolved function pointer
368. {
369. if (free_debug_func != NULL)
370. free_debug_func(str, 0);
^
371. #ifdef LEVITTE_DEBUG_MEM
372. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
crypto/mem.c:374:2: Skipping __function_pointer__(): unresolved function pointer
372. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
373. #endif
374. free_func(str);
^
375. if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
crypto/mem.c:375:6: Taking true branch
373. #endif
374. free_func(str);
375. if (free_debug_func != NULL)
^
376. free_debug_func(NULL, 1);
377. }
crypto/mem.c:376:3: Skipping __function_pointer__(): unresolved function pointer
374. free_func(str);
375. if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
^
377. }
378.
crypto/mem.c:375:2:
373. #endif
374. free_func(str);
375. > if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
377. }
crypto/mem.c:377:2: return from a call to CRYPTO_free
375. if (free_debug_func != NULL)
376. free_debug_func(NULL, 1);
377. }
^
378.
379. void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
crypto/err/err.c:651:2:
649. es->err_file[es->top]=file;
650. es->err_line[es->top]=line;
651. > err_clear_data(es,es->top);
652. }
653.
crypto/err/err.c:652:2: return from a call to ERR_put_error
650. es->err_line[es->top]=line;
651. err_clear_data(es,es->top);
652. }
^
653.
654. void ERR_clear_error(void)
crypto/store/str_lib.c:1288:3:
1286. STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR,
1287. ERR_R_MALLOC_FAILURE);
1288. > return 0;
1289. }
1290. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, STORE_R_ALREADY_HAS_A_VALUE);
crypto/store/str_lib.c:1292:2: return from a call to STORE_ATTR_INFO_set_sha1str
1290. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, STORE_R_ALREADY_HAS_A_VALUE);
1291. return 0;
1292. }
^
1293. int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1294. X509_NAME *dn)
crypto/store/str_lib.c:1366:2: return from a call to STORE_ATTR_INFO_modify_sha1str
1364. }
1365. return STORE_ATTR_INFO_set_sha1str(attrs, code, sha1str, sha1str_size);
1366. }
^
1367. int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1368. X509_NAME *dn)
|
https://github.com/openssl/openssl/blob/c2dac35a02e47010b3dc501f07e31287cc3e252e/crypto/store/str_lib.c/#L1169
|
d2a_code_trace_data_45765
|
int fbytes(unsigned char *buf, int num)
{
int ret;
BIGNUM *tmp = NULL;
if (use_fake == 0)
return old_rand->bytes(buf, num);
use_fake = 0;
if (fbytes_counter >= 8)
return 0;
tmp = BN_new();
if (!tmp)
return 0;
if (!BN_dec2bn(&tmp, numbers[fbytes_counter])) {
BN_free(tmp);
return 0;
}
fbytes_counter++;
if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf))
ret = 0;
else
ret = 1;
BN_free(tmp);
return ret;
}
test/ecdsatest.c:171: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 168, column 11 is not reachable after line 171, column 10.
Showing all 29 steps of the trace
test/ecdsatest.c:156:1: start of procedure fbytes()
154. };
155.
156. > int fbytes(unsigned char *buf, int num)
157. {
158. int ret;
test/ecdsatest.c:159:5:
157. {
158. int ret;
159. > BIGNUM *tmp = NULL;
160.
161. if (use_fake == 0)
test/ecdsatest.c:161:9: Taking false branch
159. BIGNUM *tmp = NULL;
160.
161. if (use_fake == 0)
^
162. return old_rand->bytes(buf, num);
163.
test/ecdsatest.c:164:5:
162. return old_rand->bytes(buf, num);
163.
164. > use_fake = 0;
165.
166. if (fbytes_counter >= 8)
test/ecdsatest.c:166:9: Taking false branch
164. use_fake = 0;
165.
166. if (fbytes_counter >= 8)
^
167. return 0;
168. tmp = BN_new();
test/ecdsatest.c:168:5:
166. if (fbytes_counter >= 8)
167. return 0;
168. > tmp = BN_new();
169. if (!tmp)
170. return 0;
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/ecdsatest.c:169:10: Taking false branch
167. return 0;
168. tmp = BN_new();
169. if (!tmp)
^
170. return 0;
171. if (!BN_dec2bn(&tmp, numbers[fbytes_counter])) {
test/ecdsatest.c:171:10: Skipping BN_dec2bn(): empty list of specs
169. if (!tmp)
170. return 0;
171. if (!BN_dec2bn(&tmp, numbers[fbytes_counter])) {
^
172. BN_free(tmp);
173. return 0;
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/ecdsatest.c/#L171
|
d2a_code_trace_data_45766
|
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap,
int width, int height)
{
uint8_t *src_m1, *src_0, *src_p1, *src_p2;
int y;
uint8_t *buf;
buf = (uint8_t*)av_malloc(width);
src_m1 = src1;
memcpy(buf,src_m1,width);
src_0=&src_m1[src_wrap];
src_p1=&src_0[src_wrap];
src_p2=&src_p1[src_wrap];
for(y=0;y<(height-2);y+=2) {
deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width);
src_m1 = src_p1;
src_0 = src_p2;
src_p1 += 2*src_wrap;
src_p2 += 2*src_wrap;
}
deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width);
av_free(buf);
}
libavcodec/imgconvert.c:1059: error: Null Dereference
pointer `buf` last assigned on line 1056 could be null and is dereferenced by call to `memcpy()` at line 1059, column 5.
libavcodec/imgconvert.c:1050:1: start of procedure deinterlace_bottom_field_inplace()
1048. }
1049.
1050. static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap,
^
1051. int width, int height)
1052. {
libavcodec/imgconvert.c:1056:5:
1054. int y;
1055. uint8_t *buf;
1056. buf = (uint8_t*)av_malloc(width);
^
1057.
1058. src_m1 = src1;
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(FF_INTERNAL_MEM_TYPE size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(FF_INTERNAL_MEM_TYPE size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking true branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-16) )
^
73. return NULL;
74.
libavutil/mem.c:73:9:
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-16) )
73. return NULL;
^
74.
75. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:117:1: return from a call to av_malloc
115. #endif
116. return ptr;
117. }
^
118.
119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)
libavcodec/imgconvert.c:1058:5:
1056. buf = (uint8_t*)av_malloc(width);
1057.
1058. src_m1 = src1;
^
1059. memcpy(buf,src_m1,width);
1060. src_0=&src_m1[src_wrap];
libavcodec/imgconvert.c:1059:5:
1057.
1058. src_m1 = src1;
1059. memcpy(buf,src_m1,width);
^
1060. src_0=&src_m1[src_wrap];
1061. src_p1=&src_0[src_wrap];
|
https://github.com/libav/libav/blob/938b62538a719785bce0f1d49d3065937b29e3aa/libavcodec/imgconvert.c/#L1059
|
d2a_code_trace_data_45767
|
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:230: 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:224:10: Call
222. }
223.
224. if (!EC_POINT_mul(group, pt, s, EC_KEY_get0_public_key(key), t, ctx)
^
225. || !EC_POINT_get_affine_coordinates_GFp(group, pt, x1, NULL, ctx)) {
226. SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_EC_LIB);
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 `(*scalars)->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/sm2/sm2_sign.c:230:10: Call
228. }
229.
230. if (!BN_mod_add(t, e, x1, order, ctx)) {
^
231. SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_BN_LIB);
232. goto done;
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. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:23:15: Call
21. if (a->neg == b->neg) {
22. r_neg = a->neg;
23. ret = BN_uadd(r, a, b);
^
24. } else {
25. cmp_res = BN_ucmp(a, b);
crypto/bn/bn_add.c:76:1: Parameter `r->top`
74.
75. /* unsigned add of b to a, r can be equal to a or b. */
76. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
77. {
78. int max, min, dif;
crypto/bn/bn_add.c:96:9: Call
94. dif = max - min;
95.
96. if (bn_wexpand(r, max + 1) == NULL)
^
97. return 0;
98.
crypto/bn/bn_lib.c:941:1: Parameter `a->top`
939. }
940.
941. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:943:37: Call
941. BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
944. }
945.
crypto/bn/bn_lib.c:246:1: Parameter `b->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/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_lib.c/#L233
|
d2a_code_trace_data_45768
|
static int opt_preset(const char *opt, const char *arg)
{
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
char *codec_name = *opt == 'v' ? video_codec_name :
*opt == 'a' ? audio_codec_name :
subtitle_codec_name;
if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
fprintf(stderr, "File for preset '%s' not found\n", arg);
ffmpeg_exit(1);
}
while(!feof(f)){
int e= fscanf(f, "%999[^\n]\n", line) - 1;
if(line[0] == '#' && !e)
continue;
e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
if(e){
fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
ffmpeg_exit(1);
}
if(!strcmp(tmp, "acodec")){
opt_audio_codec(tmp2);
}else if(!strcmp(tmp, "vcodec")){
opt_video_codec(tmp2);
}else if(!strcmp(tmp, "scodec")){
opt_subtitle_codec(tmp2);
}else if(!strcmp(tmp, "dcodec")){
opt_data_codec(tmp2);
}else if(opt_default(tmp, tmp2) < 0){
fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
ffmpeg_exit(1);
}
}
fclose(f);
return 0;
}
ffmpeg.c:4245: error: Null Dereference
pointer `f` last assigned on line 4240 could be null and is dereferenced by call to `feof()` at line 4245, column 12.
ffmpeg.c:4232:1: start of procedure opt_preset()
4230. }
4231.
4232. static int opt_preset(const char *opt, const char *arg)
^
4233. {
4234. FILE *f=NULL;
ffmpeg.c:4234:5:
4232. static int opt_preset(const char *opt, const char *arg)
4233. {
4234. FILE *f=NULL;
^
4235. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4236. char *codec_name = *opt == 'v' ? video_codec_name :
ffmpeg.c:4236:24: Condition is false
4234. FILE *f=NULL;
4235. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4236. char *codec_name = *opt == 'v' ? video_codec_name :
^
4237. *opt == 'a' ? audio_codec_name :
4238. subtitle_codec_name;
ffmpeg.c:4237:24: Condition is false
4235. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4236. char *codec_name = *opt == 'v' ? video_codec_name :
4237. *opt == 'a' ? audio_codec_name :
^
4238. subtitle_codec_name;
4239.
ffmpeg.c:4236:24:
4234. FILE *f=NULL;
4235. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4236. char *codec_name = *opt == 'v' ? video_codec_name :
^
4237. *opt == 'a' ? audio_codec_name :
4238. subtitle_codec_name;
ffmpeg.c:4236:5:
4234. FILE *f=NULL;
4235. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4236. char *codec_name = *opt == 'v' ? video_codec_name :
^
4237. *opt == 'a' ? audio_codec_name :
4238. subtitle_codec_name;
ffmpeg.c:4240:64: Condition is false
4238. subtitle_codec_name;
4239.
4240. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4241. fprintf(stderr, "File for preset '%s' not found\n", arg);
4242. ffmpeg_exit(1);
ffmpeg.c:4240:11: Taking true branch
4238. subtitle_codec_name;
4239.
4240. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4241. fprintf(stderr, "File for preset '%s' not found\n", arg);
4242. ffmpeg_exit(1);
ffmpeg.c:4241:9:
4239.
4240. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4241. fprintf(stderr, "File for preset '%s' not found\n", arg);
^
4242. ffmpeg_exit(1);
4243. }
ffmpeg.c:4242:9: Skipping ffmpeg_exit(): empty list of specs
4240. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4241. fprintf(stderr, "File for preset '%s' not found\n", arg);
4242. ffmpeg_exit(1);
^
4243. }
4244.
ffmpeg.c:4245:12:
4243. }
4244.
4245. while(!feof(f)){
^
4246. int e= fscanf(f, "%999[^\n]\n", line) - 1;
4247. if(line[0] == '#' && !e)
|
https://github.com/libav/libav/blob/6465c820da7b104150366a8cdd837c00cf364235/ffmpeg.c/#L4245
|
d2a_code_trace_data_45769
|
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
const int size, const int h, int ref_index, int src_index,
me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
MotionEstContext * const c= &s->me;
const int stride= c->stride;
const int uvstride= c->uvstride;
const int qpel= flags&FLAG_QPEL;
const int chroma= flags&FLAG_CHROMA;
const int dxy= subx + (suby<<(1+qpel));
const int hx= subx + (x<<(1+qpel));
const int hy= suby + (y<<(1+qpel));
uint8_t * const * const ref= c->ref[ref_index];
uint8_t * const * const src= c->src[src_index];
int d;
if(flags&FLAG_DIRECT){
assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1));
if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){
const int time_pp= s->pp_time;
const int time_pb= s->pb_time;
const int mask= 2*qpel+1;
if(s->mv_type==MV_TYPE_8X8){
int i;
for(i=0; i<4; i++){
int fx = c->direct_basis_mv[i][0] + hx;
int fy = c->direct_basis_mv[i][1] + hy;
int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4));
int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4));
int fxy= (fx&mask) + ((fy&mask)<<(qpel+1));
int bxy= (bx&mask) + ((by&mask)<<(qpel+1));
uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1);
if(qpel){
c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride);
c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride);
}else{
c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8);
c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8);
}
}
}else{
int fx = c->direct_basis_mv[0][0] + hx;
int fy = c->direct_basis_mv[0][1] + hy;
int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp);
int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp);
int fxy= (fx&mask) + ((fy&mask)<<(qpel+1));
int bxy= (bx&mask) + ((by&mask)<<(qpel+1));
if(qpel){
c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride);
c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride);
c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride);
c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride);
c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride);
c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride);
c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride);
c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride);
}else{
assert((fx>>1) + 16*s->mb_x >= -16);
assert((fy>>1) + 16*s->mb_y >= -16);
assert((fx>>1) + 16*s->mb_x <= s->width);
assert((fy>>1) + 16*s->mb_y <= s->height);
assert((bx>>1) + 16*s->mb_x >= -16);
assert((by>>1) + 16*s->mb_y >= -16);
assert((bx>>1) + 16*s->mb_x <= s->width);
assert((by>>1) + 16*s->mb_y <= s->height);
c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16);
c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16);
}
}
d = cmp_func(s, c->temp, src[0], stride, 16);
}else
d= 256*256*256*32;
}else{
int uvdxy;
if(dxy){
if(qpel){
c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride);
if(chroma){
int cx= hx/2;
int cy= hy/2;
cx= (cx>>1)|(cx&1);
cy= (cy>>1)|(cy&1);
uvdxy= (cx&1) + 2*(cy&1);
}
}else{
c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h);
if(chroma)
uvdxy= dxy | (x&1) | (2*(y&1));
}
d = cmp_func(s, c->temp, src[0], stride, h);
}else{
d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h);
if(chroma)
uvdxy= (x&1) + 2*(y&1);
}
if(chroma){
uint8_t * const uvtemp= c->temp + 16*stride;
c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1);
d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1);
}
}
#if 0
if(full_pel){
const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);
score_map[index]= d;
}
d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor;
#endif
return d;
}
libavcodec/motion_est.c:1938: error: Buffer Overrun L2
Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `interlaced_search`.
libavcodec/motion_est.c:1938:16: Call
1936. s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0);
1937. c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
1938. bimin= interlaced_search(s, 2,
^
1939. s->b_field_mv_table[1], s->b_field_select_table[1],
1940. s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0);
libavcodec/motion_est.c:893:1: Parameter `ref_index`
891. }
892.
893. static int interlaced_search(MpegEncContext *s, int ref_index,
^
894. int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select)
895. {
libavcodec/motion_est.c:953:20: Call
951. P_MV1[1]= my / 2;
952.
953. dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1);
^
954.
955. dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h);
libavcodec/motion_est_template.c:1191:1: Parameter `ref_index`
1189.
1190. //try to merge with above FIXME (needs PSNR test)
1191. static int epzs_motion_search2(MpegEncContext * s,
^
1192. int *mx_ptr, int *my_ptr, int P[10][2],
1193. int src_index, int ref_index, int16_t (*last_mv)[2],
libavcodec/motion_est_template.c:1241:11: Call
1239. }
1240.
1241. dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
^
1242.
1243. *mx_ptr= best[0];
libavcodec/motion_est_template.c:973:1: Parameter `ref_index`
971. }
972.
973. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin,
^
974. int src_index, int ref_index, int const penalty_factor,
975. int size, int h, int flags){
libavcodec/motion_est_template.c:980:18: Call
978. return funny_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
979. else if(c->dia_size<-1)
980. return sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
^
981. else if(c->dia_size<2)
982. return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
libavcodec/motion_est_template.c:809:1: Parameter `ref_index`
807.
808. #define MAX_SAB_SIZE ME_MAP_SIZE
809. static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
^
810. int src_index, int ref_index, int const penalty_factor,
811. int size, int h, int flags)
libavcodec/motion_est_template.c:872:9: Call
870. continue;
871.
872. SAB_CHECK_MV(x-1, y)
^
873. SAB_CHECK_MV(x+1, y)
874. SAB_CHECK_MV(x , y-1)
libavcodec/motion_est.c:108:1: <Length trace>
106. against a proposed motion-compensated prediction of that block
107. */
108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
^
109. const int size, const int h, int ref_index, int src_index,
110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
libavcodec/motion_est.c:108:1: Parameter `ref_index`
106. against a proposed motion-compensated prediction of that block
107. */
108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
^
109. const int size, const int h, int ref_index, int src_index,
110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
libavcodec/motion_est.c:119:5: Assignment
117. const int hx= subx + (x<<(1+qpel));
118. const int hy= suby + (y<<(1+qpel));
119. uint8_t * const * const ref= c->ref[ref_index];
^
120. uint8_t * const * const src= c->src[src_index];
121. int d;
libavcodec/motion_est.c:208:50: Array access: Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `interlaced_search`
206. if(chroma){
207. uint8_t * const uvtemp= c->temp + 16*stride;
208. c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
^
209. c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
210. d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L208
|
d2a_code_trace_data_45770
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_sp800_56b_check.c:362: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mul`.
Showing all 14 steps of the trace
crypto/rsa/rsa_sp800_56b_check.c:360:5: Call
358. return 0;
359.
360. BN_CTX_start(ctx);
^
361. r = BN_CTX_get(ctx);
362. if (r == NULL || !BN_mul(r, rsa->p, rsa->q, 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_sp800_56b_check.c:362:23: Call
360. BN_CTX_start(ctx);
361. r = BN_CTX_get(ctx);
362. if (r == NULL || !BN_mul(r, rsa->p, rsa->q, ctx))
^
363. goto err;
364. /* (Step 4.c): Check n = pq */
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <LHS trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_45771
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_sp800_56b_check.c:67: error: INTEGER_OVERFLOW_L2
([0, 10+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 15 steps of the trace
crypto/rsa/rsa_sp800_56b_check.c:24:1: Parameter `ctx->stack.depth`
22. * 6.4.1.3.3: rsakpv2-crt Step 7
23. */
24. > int rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx)
25. {
26. int ret = 0;
crypto/rsa/rsa_sp800_56b_check.c:36:5: Call
34. }
35.
36. BN_CTX_start(ctx);
^
37. r = BN_CTX_get(ctx);
38. p1 = 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_sp800_56b_check.c:37:9: Call
35.
36. BN_CTX_start(ctx);
37. r = BN_CTX_get(ctx);
^
38. p1 = BN_CTX_get(ctx);
39. q1 = 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_sp800_56b_check.c:38:10: Call
36. BN_CTX_start(ctx);
37. r = BN_CTX_get(ctx);
38. p1 = BN_CTX_get(ctx);
^
39. q1 = BN_CTX_get(ctx);
40. ret = (q1 != 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_sp800_56b_check.c:39:10: Call
37. r = BN_CTX_get(ctx);
38. p1 = BN_CTX_get(ctx);
39. q1 = BN_CTX_get(ctx);
^
40. ret = (q1 != NULL)
41. /* p1 = p -1 */
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_sp800_56b_check.c:67:5: Call
65. BN_clear(p1);
66. BN_clear(q1);
67. BN_CTX_end(ctx);
^
68. return ret;
69. }
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <LHS trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, 10+max(0, ctx->stack.depth)] - 1):unsigned32 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/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_45772
|
static void load_module(const char *filename)
{
void *dll;
void (*init_func)(void);
dll = dlopen(filename, RTLD_NOW);
if (!dll) {
fprintf(stderr, "Could not load module '%s' - %s\n",
filename, dlerror());
return;
}
init_func = dlsym(dll, "ffserver_module_init");
if (!init_func) {
fprintf(stderr,
"%s: init function 'ffserver_module_init()' not found\n",
filename);
dlclose(dll);
}
init_func();
}
ffserver.c:3747: error: Null Dereference
pointer `init_func` last assigned on line 3739 could be null and is dereferenced at line 3747, column 5.
ffserver.c:3728:1: start of procedure load_module()
3726.
3727. #if HAVE_DLOPEN
3728. static void load_module(const char *filename)
^
3729. {
3730. void *dll;
ffserver.c:3732:5: Skipping dlopen(): method has no implementation
3730. void *dll;
3731. void (*init_func)(void);
3732. dll = dlopen(filename, RTLD_NOW);
^
3733. if (!dll) {
3734. fprintf(stderr, "Could not load module '%s' - %s\n",
ffserver.c:3733:10: Taking false branch
3731. void (*init_func)(void);
3732. dll = dlopen(filename, RTLD_NOW);
3733. if (!dll) {
^
3734. fprintf(stderr, "Could not load module '%s' - %s\n",
3735. filename, dlerror());
ffserver.c:3739:5: Skipping dlsym(): method has no implementation
3737. }
3738.
3739. init_func = dlsym(dll, "ffserver_module_init");
^
3740. if (!init_func) {
3741. fprintf(stderr,
ffserver.c:3740:10: Taking true branch
3738.
3739. init_func = dlsym(dll, "ffserver_module_init");
3740. if (!init_func) {
^
3741. fprintf(stderr,
3742. "%s: init function 'ffserver_module_init()' not found\n",
ffserver.c:3741:9:
3739. init_func = dlsym(dll, "ffserver_module_init");
3740. if (!init_func) {
3741. fprintf(stderr,
^
3742. "%s: init function 'ffserver_module_init()' not found\n",
3743. filename);
ffserver.c:3744:9: Skipping dlclose(): method has no implementation
3742. "%s: init function 'ffserver_module_init()' not found\n",
3743. filename);
3744. dlclose(dll);
^
3745. }
3746.
ffserver.c:3747:5:
3745. }
3746.
3747. init_func();
^
3748. }
3749. #endif
|
https://github.com/libav/libav/blob/b903fe9137c1ffefc91c1a3713a9bc1444709330/ffserver.c/#L3747
|
d2a_code_trace_data_45773
|
int BN_num_bits_word(BN_ULONG l)
{
BN_ULONG x, mask;
int bits = (l != 0);
#if BN_BITS2 > 32
x = l >> 32;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 32 & mask;
l ^= (x ^ l) & mask;
#endif
x = l >> 16;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 16 & mask;
l ^= (x ^ l) & mask;
x = l >> 8;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 8 & mask;
l ^= (x ^ l) & mask;
x = l >> 4;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 4 & mask;
l ^= (x ^ l) & mask;
x = l >> 2;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 2 & mask;
l ^= (x ^ l) & mask;
x = l >> 1;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 1 & mask;
return bits;
}
crypto/rsa/rsa_chk.c:157: error: INTEGER_OVERFLOW_L2
(0 - [0, max(1, `key->e->top`)]):unsigned64 by call to `BN_mod_mul`.
Showing all 19 steps of the trace
crypto/rsa/rsa_chk.c:25:1: Parameter `key->e->top`
23. * rsa_sp800_56b_check_keypair.
24. */
25. > int RSA_check_key_ex(const RSA *key, BN_GENCB *cb)
26. {
27. #ifdef FIPS_MODE
crypto/rsa/rsa_chk.c:68:9: Call
66. }
67.
68. if (BN_is_one(key->e)) {
^
69. ret = 0;
70. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_BAD_E_VALUE);
crypto/bn/bn_lib.c:869:1: Parameter `a->top`
867. }
868.
869. > int BN_is_one(const BIGNUM *a)
870. {
871. return BN_abs_is_word(a, 1) && !a->neg;
crypto/bn/bn_lib.c:871:12: Call
869. int BN_is_one(const BIGNUM *a)
870. {
871. return BN_abs_is_word(a, 1) && !a->neg;
^
872. }
873.
crypto/bn/bn_lib.c:859:1: Parameter `a->top`
857. }
858.
859. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
860. {
861. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/rsa/rsa_chk.c:72:10: Call
70. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_BAD_E_VALUE);
71. }
72. if (!BN_is_odd(key->e)) {
^
73. ret = 0;
74. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_BAD_E_VALUE);
crypto/bn/bn_lib.c:879:1: Parameter `a->top`
877. }
878.
879. > int BN_is_odd(const BIGNUM *a)
880. {
881. return (a->top > 0) && (a->d[0] & 1);
crypto/rsa/rsa_chk.c:157:10: Call
155. goto err;
156. }
157. if (!BN_mod_mul(i, key->d, key->e, k, ctx)) {
^
158. ret = -1;
159. goto err;
crypto/bn/bn_mod.c:193:1: Parameter `b->top`
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: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 `b->top`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:507:1: Parameter `b->top`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
crypto/bn/bn_mul.c:525:5: Assignment
523.
524. al = a->top;
525. bl = b->top;
^
526.
527. if ((al == 0) || (bl == 0)) {
crypto/bn/bn_mul.c:574:21: Call
572. }
573. if (i == -1) {
574. j = BN_num_bits_word((BN_ULONG)bl);
^
575. }
576. j = 1 << (j - 1);
crypto/bn/bn_lib.c:90:1: <RHS trace>
88. }
89.
90. > int BN_num_bits_word(BN_ULONG l)
91. {
92. BN_ULONG x, mask;
crypto/bn/bn_lib.c:90:1: Parameter `l`
88. }
89.
90. > int BN_num_bits_word(BN_ULONG l)
91. {
92. BN_ULONG x, mask;
crypto/bn/bn_lib.c:96:5: Assignment
94.
95. #if BN_BITS2 > 32
96. x = l >> 32;
^
97. mask = (0 - x) & BN_MASK2;
98. mask = (0 - (mask >> (BN_BITS2 - 1)));
crypto/bn/bn_lib.c:97:5: Binary operation: (0 - [0, max(1, key->e->top)]):unsigned64 by call to `BN_mod_mul`
95. #if BN_BITS2 > 32
96. x = l >> 32;
97. mask = (0 - x) & BN_MASK2;
^
98. mask = (0 - (mask >> (BN_BITS2 - 1)));
99. bits += 32 & mask;
|
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_lib.c/#L97
|
d2a_code_trace_data_45774
|
static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
LPC_TYPE *lpc, int lpc_stride, int fail,
int normalize)
{
int i, j;
LPC_TYPE err;
LPC_TYPE *lpc_last = lpc;
if (normalize)
err = *autoc++;
if (fail && (autoc[max_order - 1] == 0 || err <= 0))
return -1;
for(i=0; i<max_order; i++) {
LPC_TYPE r = -autoc[i];
if (normalize) {
for(j=0; j<i; j++)
r -= lpc_last[j] * autoc[i-j-1];
r /= err;
err *= 1.0 - (r * r);
}
lpc[i] = r;
for(j=0; j < (i+1)>>1; j++) {
LPC_TYPE f = lpc_last[ j];
LPC_TYPE b = lpc_last[i-1-j];
lpc[ j] = f + r * b;
lpc[i-1-j] = b + r * f;
}
if (fail && err < 0)
return -1;
lpc_last = lpc;
lpc += lpc_stride;
}
return 0;
}
libavcodec/ra144enc.c:463: error: Buffer Overrun L3
Offset: [-8, 9] (⇐ [0, 1] + [-8, 8]) Size: 33 by call to `ff_lpc_calc_coefs`.
libavcodec/ra144enc.c:463:5: Call
461. 32)];
462.
463. ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER,
^
464. LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON,
465. 0, ORDER_METHOD_EST, 12, 0);
libavcodec/lpc.c:155:1: Array declaration
153. * see #FFLPCType for details
154. */
155. int ff_lpc_calc_coefs(LPCContext *s,
^
156. const int32_t *samples, int blocksize, int min_order,
157. int max_order, int precision,
libavcodec/lpc.c:185:9: Call
183. s->lpc_compute_autocorr(windowed_samples, blocksize, max_order, autoc);
184.
185. compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
^
186.
187. for(i=0; i<max_order; i++)
libavcodec/lpc.h:116:1: <Offset trace>
114. * Produce LPC coefficients from autocorrelation data.
115. */
116. static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
^
117. LPC_TYPE *lpc, int lpc_stride, int fail,
118. int normalize)
libavcodec/lpc.h:116:1: Parameter `max_order`
114. * Produce LPC coefficients from autocorrelation data.
115. */
116. static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
^
117. LPC_TYPE *lpc, int lpc_stride, int fail,
118. int normalize)
libavcodec/lpc.h:116:1: <Length trace>
114. * Produce LPC coefficients from autocorrelation data.
115. */
116. static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
^
117. LPC_TYPE *lpc, int lpc_stride, int fail,
118. int normalize)
libavcodec/lpc.h:116:1: Parameter `*autoc`
114. * Produce LPC coefficients from autocorrelation data.
115. */
116. static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
^
117. LPC_TYPE *lpc, int lpc_stride, int fail,
118. int normalize)
libavcodec/lpc.h:135:36: Array access: Offset: [-8, 9] (⇐ [0, 1] + [-8, 8]) Size: 33 by call to `ff_lpc_calc_coefs`
133. if (normalize) {
134. for(j=0; j<i; j++)
135. r -= lpc_last[j] * autoc[i-j-1];
^
136.
137. r /= err;
|
https://github.com/libav/libav/blob/96c1e6d40d389eeb628840030dfe340d762a7ac8/libavcodec/lpc.h/#L135
|
d2a_code_trace_data_45775
|
int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
{
if(s->me_method>=ME_EPZS){
int score[8];
int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2);
uint8_t * fcode_tab= s->fcode_tab;
int best_fcode=-1;
int best_score=-10000000;
if(s->msmpeg4_version)
range= FFMIN(range, 16);
else if(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
range= FFMIN(range, 256);
for(i=0; i<8; i++) score[i]= s->mb_num*(8-i);
for(y=0; y<s->mb_height; y++){
int x;
int xy= y*s->mb_stride;
for(x=0; x<s->mb_width; x++){
if(s->mb_type[xy] & type){
int mx= mv_table[xy][0];
int my= mv_table[xy][1];
int fcode= FFMAX(fcode_tab[mx + MAX_MV],
fcode_tab[my + MAX_MV]);
int j;
if(mx >= range || mx < -range ||
my >= range || my < -range)
continue;
for(j=0; j<fcode && j<8; j++){
if(s->pict_type==FF_B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
score[j]-= 170;
}
}
xy++;
}
}
for(i=1; i<8; i++){
if(score[i] > best_score){
best_score= score[i];
best_fcode= i;
}
}
return best_fcode;
}else{
return 1;
}
}
libavcodec/motion_est.c:2030: error: Uninitialized Value
The value read from score[_] was never initialized.
libavcodec/motion_est.c:2030:29:
2028. for(j=0; j<fcode && j<8; j++){
2029. if(s->pict_type==FF_B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
2030. score[j]-= 170;
^
2031. }
2032. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L2030
|
d2a_code_trace_data_45776
|
void CRYPTO_free(void *str, const char *file, int line)
{
if (free_impl != NULL && free_impl != &CRYPTO_free) {
free_impl(str, file, line);
return;
}
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0, file, line);
free(str);
CRYPTO_mem_debug_free(str, 1, file, line);
} else {
free(str);
}
#else
free(str);
#endif
}
test/crltest.c:294: error: USE_AFTER_FREE
call to `sk_X509_CRL_push()` eventually accesses memory that was invalidated by call to `free()` on line 291 indirectly during the call to `sk_X509_CRL_push()`.
Showing all 24 steps of the trace
test/crltest.c:289:30: invalidation part of the trace starts here
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:289:30: passed as argument to `sk_X509_CRL_new_null`
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:289:30: return from call to `sk_X509_CRL_new_null`
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:289:5: assigned
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:291:5: when calling `sk_X509_CRL_push` here
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
290.
291. sk_X509_CRL_push(sk, x1);
^
292. X509_CRL_up_ref(x1);
293. if (x2 != NULL) {
include/openssl/x509.h:228:1: parameter `sk` of sk_X509_CRL_push
226. typedef struct X509_crl_info_st X509_CRL_INFO;
227.
228. > DEFINE_STACK_OF(X509_CRL)
229.
230. typedef struct private_key_st {
include/openssl/x509.h:228:1: when calling `OPENSSL_sk_push` here
226. typedef struct X509_crl_info_st X509_CRL_INFO;
227.
228. > DEFINE_STACK_OF(X509_CRL)
229.
230. typedef struct private_key_st {
crypto/stack/stack.c:307:1: parameter `st` of OPENSSL_sk_push
305. }
306.
307. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
308. {
309. if (st == NULL)
crypto/stack/stack.c:311:12: when calling `OPENSSL_sk_insert` here
309. if (st == NULL)
310. return -1;
311. return OPENSSL_sk_insert(st, data, st->num);
^
312. }
313.
crypto/stack/stack.c:222:1: parameter `st` of OPENSSL_sk_insert
220. }
221.
222. > int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
223. {
224. if (st == NULL || st->num < 0 || st->num == max_nodes)
crypto/stack/stack.c:227:10: when calling `sk_reserve` here
225. return 0;
226.
227. if (!sk_reserve(st, 1, 0))
^
228. return 0;
229.
crypto/stack/stack.c:166:1: parameter `st` of sk_reserve
164.
165. /* internal STACK storage allocation */
166. > static int sk_reserve(OPENSSL_STACK *st, int n, int exact)
167. {
168. const void **tmpdata;
crypto/stack/stack.c:203:15: when calling `CRYPTO_realloc` here
201. }
202.
203. tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
^
204. if (tmpdata == NULL)
205. return 0;
crypto/mem.c:208:1: parameter `str` of CRYPTO_realloc
206. }
207.
208. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
209. {
210. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
crypto/mem.c:218:9: when calling `CRYPTO_free` here
216.
217. if (num == 0) {
218. CRYPTO_free(str, file, line);
^
219. return NULL;
220. }
crypto/mem.c:265:1: parameter `str` of CRYPTO_free
263. }
264.
265. > void CRYPTO_free(void *str, const char *file, int line)
266. {
267. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:281:5: was invalidated by call to `free()`
279. }
280. #else
281. free(str);
^
282. #endif
283. }
test/crltest.c:289:30: use-after-lifetime part of the trace starts here
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:289:30: passed as argument to `sk_X509_CRL_new_null`
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:289:30: return from call to `sk_X509_CRL_new_null`
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:289:5: assigned
287. static STACK_OF(X509_CRL) *make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
288. {
289. STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
^
290.
291. sk_X509_CRL_push(sk, x1);
test/crltest.c:294:9: when calling `sk_X509_CRL_push` here
292. X509_CRL_up_ref(x1);
293. if (x2 != NULL) {
294. sk_X509_CRL_push(sk, x2);
^
295. X509_CRL_up_ref(x2);
296. }
crypto/mem.c:265:1: parameter `str` of CRYPTO_free
263. }
264.
265. > void CRYPTO_free(void *str, const char *file, int line)
266. {
267. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:281:5: invalid access occurs here
279. }
280. #else
281. free(str);
^
282. #endif
283. }
|
https://github.com/openssl/openssl/blob/270a4bba49849de7f928f4fab186205abd132411/crypto/mem.c/#L281
|
d2a_code_trace_data_45777
|
static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
{
while (*inouts && (*inouts)->next)
inouts = &((*inouts)->next);
if (!*inouts)
*inouts = *element;
else
(*inouts)->next = *element;
*element = NULL;
}
libavfilter/graphparser.c:255: error: Memory Leak
`*inouts->next` is not reachable after line 255, column 9.
libavfilter/graphparser.c:247:1: start of procedure append_inout()
245. }
246.
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
^
248. {
249. while (*inouts && (*inouts)->next)
libavfilter/graphparser.c:249:12: Loop condition is true. Entering loop body
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:249:24:
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:249:23: Loop condition is true. Entering loop body
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:250:9:
248. {
249. while (*inouts && (*inouts)->next)
250. inouts = &((*inouts)->next);
^
251.
252. if (!*inouts)
libavfilter/graphparser.c:249:12: Loop condition is true. Entering loop body
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:249:24:
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:249:23: Loop condition is true. Entering loop body
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:250:9:
248. {
249. while (*inouts && (*inouts)->next)
250. inouts = &((*inouts)->next);
^
251.
252. if (!*inouts)
libavfilter/graphparser.c:249:12: Loop condition is true. Entering loop body
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:249:24:
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:249:23: Loop condition is false. Leaving loop
247. static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
248. {
249. while (*inouts && (*inouts)->next)
^
250. inouts = &((*inouts)->next);
251.
libavfilter/graphparser.c:252:10: Taking false branch
250. inouts = &((*inouts)->next);
251.
252. if (!*inouts)
^
253. *inouts = *element;
254. else
libavfilter/graphparser.c:255:9:
253. *inouts = *element;
254. else
255. (*inouts)->next = *element;
^
256. *element = NULL;
257. }
|
https://github.com/libav/libav/blob/95a41311ac3a44773cc4dc407408aca35b1f8e26/libavfilter/graphparser.c/#L255
|
d2a_code_trace_data_45778
|
int av_base64_decode(uint8_t * out, const char *in, int out_length)
{
int i, v;
uint8_t *dst = out;
v = 0;
for (i = 0; in[i] && in[i] != '='; i++) {
unsigned int index= in[i]-43;
if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff)
return -1;
v = (v << 6) + map2[index];
if (i & 3) {
if (dst - out < out_length) {
*dst++ = v >> (6 - 2 * (i & 3));
}
}
}
return (dst - out);
}
libavformat/rtp_h264.c:392: error: Buffer Overrun L3
Offset: [-43, 79] Size: 80 by call to `sdp_parse_fmtp_config_h264`.
libavformat/rtp_h264.c:389:16: Call
387.
388. /* loop on each attribute */
389. while (rtsp_next_attr_and_value
^
390. (&p, attr, sizeof(attr), value, sizeof(value))) {
391. /* grab the codec extra_data from the config parameter of the fmtp line */
libavformat/rtsp.c:287:1: Parameter `*value`
285. * because it is used in rtp_h264.c, which is forthcoming.
286. */
287. int rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size)
^
288. {
289. skip_spaces(p);
libavformat/rtp_h264.c:392:13: Call
390. (&p, attr, sizeof(attr), value, sizeof(value))) {
391. /* grab the codec extra_data from the config parameter of the fmtp line */
392. sdp_parse_fmtp_config_h264(stream, h264_data, attr, value);
^
393. }
394. } else if (av_strstart(p, "cliprect:", &p)) {
libavformat/rtp_h264.c:130:13: Assignment
128. *dst++ = *value++;
129. }
130. *dst++ = '\0';
^
131.
132. if (*value == ',')
libavformat/rtp_h264.c:135:26: Call
133. value++;
134.
135. packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
^
136. if (packet_size) {
137. uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size);
libavutil/base64.c:46:1: <Offset trace>
44. };
45.
46. int av_base64_decode(uint8_t * out, const char *in, int out_length)
^
47. {
48. int i, v;
libavutil/base64.c:46:1: Parameter `*in`
44. };
45.
46. int av_base64_decode(uint8_t * out, const char *in, int out_length)
^
47. {
48. int i, v;
libavutil/base64.c:53:9: Assignment
51. v = 0;
52. for (i = 0; in[i] && in[i] != '='; i++) {
53. unsigned int index= in[i]-43;
^
54. if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff)
55. return -1;
libavutil/base64.c:32:1: <Length trace>
30.
31. /* ---------------- private code */
32. static const uint8_t map2[] =
^
33. {
34. 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36,
libavutil/base64.c:32:1: Array declaration
30.
31. /* ---------------- private code */
32. static const uint8_t map2[] =
^
33. {
34. 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36,
libavutil/base64.c:54:54: Array access: Offset: [-43, 79] Size: 80 by call to `sdp_parse_fmtp_config_h264`
52. for (i = 0; in[i] && in[i] != '='; i++) {
53. unsigned int index= in[i]-43;
54. if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff)
^
55. return -1;
56. v = (v << 6) + map2[index];
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavutil/base64.c/#L54
|
d2a_code_trace_data_45779
|
static int compat_decode(AVCodecContext *avctx, AVFrame *frame,
int *got_frame, AVPacket *pkt)
{
AVCodecInternal *avci = avctx->internal;
int ret;
av_assert0(avci->compat_decode_consumed == 0);
*got_frame = 0;
avci->compat_decode = 1;
if (avci->compat_decode_partial_size > 0 &&
avci->compat_decode_partial_size != pkt->size) {
av_log(avctx, AV_LOG_ERROR,
"Got unexpected packet size after a partial decode\n");
ret = AVERROR(EINVAL);
goto finish;
}
if (!avci->compat_decode_partial_size) {
ret = avcodec_send_packet(avctx, pkt);
if (ret == AVERROR_EOF)
ret = 0;
else if (ret == AVERROR(EAGAIN)) {
ret = AVERROR_BUG;
goto finish;
} else if (ret < 0)
goto finish;
}
while (ret >= 0) {
ret = avcodec_receive_frame(avctx, frame);
if (ret < 0) {
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
ret = 0;
goto finish;
}
if (frame != avci->compat_decode_frame) {
if (!avctx->refcounted_frames) {
ret = unrefcount_frame(avci, frame);
if (ret < 0)
goto finish;
}
*got_frame = 1;
frame = avci->compat_decode_frame;
} else {
if (!avci->compat_decode_warned) {
av_log(avctx, AV_LOG_WARNING, "The deprecated avcodec_decode_* "
"API cannot return all the frames for this decoder. "
"Some frames will be dropped. Update your code to the "
"new decoding API to fix this.\n");
avci->compat_decode_warned = 1;
}
}
if (avci->draining || (!avctx->codec->bsfs && avci->compat_decode_consumed < pkt->size))
break;
}
finish:
if (ret == 0) {
if (avctx->codec->bsfs)
ret = pkt->size;
else
ret = FFMIN(avci->compat_decode_consumed, pkt->size);
}
avci->compat_decode_consumed = 0;
avci->compat_decode_partial_size = (ret >= 0) ? pkt->size - ret : 0;
return ret;
}
libavcodec/decode.c:653: error: Uninitialized Value
The value read from ret was never initialized.
libavcodec/decode.c:653:9:
651.
652. finish:
653. if (ret == 0) {
^
654. /* if there are any bsfs then assume full packet is always consumed */
655. if (avctx->codec->bsfs)
|
https://github.com/libav/libav/blob/839010aca9713b5cd6ebe7a1db7e805c3625b168/libavcodec/decode.c/#L653
|
d2a_code_trace_data_45780
|
static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
{
BN_ULONG ret = 0;
int wordpos;
wordpos = bitpos / BN_BITS2;
bitpos %= BN_BITS2;
if (wordpos >= 0 && wordpos < a->top) {
ret = a->d[wordpos] & BN_MASK2;
if (bitpos) {
ret >>= bitpos;
if (++wordpos < a->top)
ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
}
}
return ret & BN_MASK2;
}
crypto/ec/ec_lib.c:1049: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp_mont`.
Showing all 13 steps of the trace
crypto/ec/ec_lib.c:1043:10: Call
1041. if (!BN_set_word(e, 2))
1042. goto err;
1043. if (!BN_sub(e, group->order, e))
^
1044. goto err;
1045. /*-
crypto/bn/bn_add.c:59:19: Call
57. if (cmp_res > 0) {
58. r_neg = a->neg;
59. ret = BN_usub(r, a, b);
^
60. } else if (cmp_res < 0) {
61. r_neg = !b->neg;
crypto/bn/bn_add.c:125:1: Parameter `r->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/ec/ec_lib.c:1049:10: Call
1047. * No need for scatter-gather or BN_FLG_CONSTTIME.
1048. */
1049. if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data))
^
1050. goto err;
1051.
crypto/bn/bn_exp.c:296:1: Parameter `*p->d`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c:310:16: Call
308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
311. }
312.
crypto/bn/bn_exp.c:596:1: Parameter `*p->d`
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:1061:18: Call
1059. wmask = (1 << window0) - 1;
1060. bits -= window0;
1061. wvalue = bn_get_bits(p, bits) & wmask;
^
1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
1063. window))
crypto/bn/bn_exp.c:476:1: <Offset trace>
474. }
475.
476. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
477. {
478. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:476:1: Parameter `a->top`
474. }
475.
476. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
477. {
478. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:476:1: <Length trace>
474. }
475.
476. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
477. {
478. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:476:1: Parameter `*a->d`
474. }
475.
476. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
477. {
478. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:488:24: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp_mont`
486. ret >>= bitpos;
487. if (++wordpos < a->top)
488. ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
^
489. }
490. }
|
https://github.com/openssl/openssl/blob/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_exp.c/#L488
|
d2a_code_trace_data_45781
|
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;
}
test/ectest.c:77: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`.
Showing all 21 steps of the trace
test/ectest.c:65:10: Call
63. goto err;
64.
65. if (!TEST_true(EC_GROUP_get_order(group, order, ctx))
^
66. || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
67. || !TEST_true(EC_POINT_is_at_infinity(group, Q))
crypto/ec/ec_lib.c:321:1: Parameter `order->top`
319. }
320.
321. > int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
322. {
323. if (group->order == NULL)
test/ectest.c:77:14: Call
75. const EC_POINT *points[6];
76.
77. if (!TEST_true(BN_set_word(n1, i))
^
78. /*
79. * If i == 1, P will be the predefined generator for which
crypto/bn/bn_lib.c:395:1: Parameter `a->top`
393. }
394.
395. > int BN_set_word(BIGNUM *a, BN_ULONG w)
396. {
397. bn_check_top(a);
crypto/bn/bn_lib.c:398:9: Call
396. {
397. bn_check_top(a);
398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
399. return (0);
400. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `a->top`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:284:1: Parameter `b->top`
282. */
283.
284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
285. {
286. bn_check_top(b);
crypto/bn/bn_lib.c:289:23: Call
287.
288. if (words > b->dmax) {
289. BN_ULONG *a = bn_expand_internal(b, words);
^
290. if (!a)
291. return NULL;
crypto/bn/bn_lib.c:246:1: <Offset trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `words`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:263:13: Call
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:186:1: Parameter `num`
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:17: Call
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:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/mem.c:188:5: Assignment
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:193:5: Assignment
191. if (ret != NULL)
192. memset(ret, 0, num);
193. return ret;
^
194. }
195.
crypto/bn/bn_lib.c:263:9: Assignment
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`
269. assert(b->top <= words);
270. if (b->top > 0)
271. memcpy(a, b->d, sizeof(*a) * b->top);
^
272.
273. return a;
|
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_45782
|
static void opt_output_file(const char *filename)
{
AVFormatContext *oc;
int use_video, use_audio, use_subtitle;
int input_has_video, input_has_audio, input_has_subtitle;
AVFormatParameters params, *ap = ¶ms;
if (!strcmp(filename, "-"))
filename = "pipe:";
oc = avformat_alloc_context();
if (!file_oformat) {
file_oformat = guess_format(NULL, filename, NULL);
if (!file_oformat) {
fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
filename);
av_exit(1);
}
}
oc->oformat = file_oformat;
av_strlcpy(oc->filename, filename, sizeof(oc->filename));
if (!strcmp(file_oformat->name, "ffm") &&
av_strstart(filename, "http:", NULL)) {
int err = read_ffserver_streams(oc, filename);
if (err < 0) {
print_error(filename, err);
av_exit(1);
}
} else {
use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
if (nb_input_files > 0) {
check_audio_video_sub_inputs(&input_has_video, &input_has_audio,
&input_has_subtitle);
if (!input_has_video)
use_video = 0;
if (!input_has_audio)
use_audio = 0;
if (!input_has_subtitle)
use_subtitle = 0;
}
if (audio_disable) {
use_audio = 0;
}
if (video_disable) {
use_video = 0;
}
if (subtitle_disable) {
use_subtitle = 0;
}
if (use_video) {
new_video_stream(oc);
}
if (use_audio) {
new_audio_stream(oc);
}
if (use_subtitle) {
new_subtitle_stream(oc);
}
oc->timestamp = rec_timestamp;
for(; metadata_count>0; metadata_count--){
av_metadata_set(&oc->metadata, metadata[metadata_count-1].key,
metadata[metadata_count-1].value);
}
av_metadata_conv(oc, oc->oformat->metadata_conv, NULL);
}
output_files[nb_output_files++] = oc;
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
if (!av_filename_number_test(oc->filename)) {
print_error(oc->filename, AVERROR_NUMEXPECTED);
av_exit(1);
}
}
if (!(oc->oformat->flags & AVFMT_NOFILE)) {
if (!file_overwrite &&
(strchr(filename, ':') == NULL ||
filename[1] == ':' ||
av_strstart(filename, "file:", NULL))) {
if (url_exist(filename)) {
int c;
if (!using_stdin) {
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
fflush(stderr);
c = getchar();
if (toupper(c) != 'Y') {
fprintf(stderr, "Not overwriting - exiting\n");
av_exit(1);
}
}
else {
fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
av_exit(1);
}
}
}
if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
fprintf(stderr, "Could not open '%s'\n", filename);
av_exit(1);
}
}
memset(ap, 0, sizeof(*ap));
if (av_set_parameters(oc, ap) < 0) {
fprintf(stderr, "%s: Invalid encoding parameters\n",
oc->filename);
av_exit(1);
}
oc->preload= (int)(mux_preload*AV_TIME_BASE);
oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
oc->loop_output = loop_output;
oc->flags |= AVFMT_FLAG_NONBLOCK;
set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM);
file_oformat = NULL;
file_iformat = NULL;
}
ffmpeg.c:3285: error: Null Dereference
pointer `oc` last assigned on line 3274 could be null and is dereferenced at line 3285, column 5.
ffmpeg.c:3264:1: start of procedure opt_output_file()
3262. }
3263.
3264. static void opt_output_file(const char *filename)
^
3265. {
3266. AVFormatContext *oc;
ffmpeg.c:3269:5:
3267. int use_video, use_audio, use_subtitle;
3268. int input_has_video, input_has_audio, input_has_subtitle;
3269. AVFormatParameters params, *ap = ¶ms;
^
3270.
3271. if (!strcmp(filename, "-"))
ffmpeg.c:3271:10: Taking false branch
3269. AVFormatParameters params, *ap = ¶ms;
3270.
3271. if (!strcmp(filename, "-"))
^
3272. filename = "pipe:";
3273.
ffmpeg.c:3274:5:
3272. filename = "pipe:";
3273.
3274. oc = avformat_alloc_context();
^
3275.
3276. if (!file_oformat) {
libavformat/options.c:77:1: start of procedure avformat_alloc_context()
75. }
76.
77. AVFormatContext *avformat_alloc_context(void)
^
78. {
79. AVFormatContext *ic;
libavformat/options.c:80:5:
78. {
79. AVFormatContext *ic;
80. ic = av_malloc(sizeof(AVFormatContext));
^
81. if (!ic) return ic;
82. avformat_get_context_defaults(ic);
libavutil/mem.c:47:1: start of procedure av_malloc()
45. linker will do it automatically. */
46.
47. void *av_malloc(unsigned int size)
^
48. {
49. void *ptr = NULL;
libavutil/mem.c:49:5:
47. void *av_malloc(unsigned int size)
48. {
49. void *ptr = NULL;
^
50. #if CONFIG_MEMALIGN_HACK
51. long diff;
libavutil/mem.c:55:8: Taking false branch
53.
54. /* let's disallow possible ambiguous cases */
55. if(size > (INT_MAX-16) )
^
56. return NULL;
57.
libavutil/mem.c:66:9: Taking false branch
64. ((char*)ptr)[-1]= diff;
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
^
67. ptr = NULL;
68. #elif HAVE_MEMALIGN
libavutil/mem.c:99:5:
97. ptr = malloc(size);
98. #endif
99. return ptr;
^
100. }
101.
libavutil/mem.c:100:1: return from a call to av_malloc
98. #endif
99. return ptr;
100. }
^
101.
102. void *av_realloc(void *ptr, unsigned int size)
libavformat/options.c:81:10: Taking true branch
79. AVFormatContext *ic;
80. ic = av_malloc(sizeof(AVFormatContext));
81. if (!ic) return ic;
^
82. avformat_get_context_defaults(ic);
83. ic->av_class = &av_format_context_class;
libavformat/options.c:81:14:
79. AVFormatContext *ic;
80. ic = av_malloc(sizeof(AVFormatContext));
81. if (!ic) return ic;
^
82. avformat_get_context_defaults(ic);
83. ic->av_class = &av_format_context_class;
libavformat/options.c:85:1: return from a call to avformat_alloc_context
83. ic->av_class = &av_format_context_class;
84. return ic;
85. }
^
86.
87. #if LIBAVFORMAT_VERSION_MAJOR < 53
ffmpeg.c:3276:10: Taking true branch
3274. oc = avformat_alloc_context();
3275.
3276. if (!file_oformat) {
^
3277. file_oformat = guess_format(NULL, filename, NULL);
3278. if (!file_oformat) {
ffmpeg.c:3277:9: Skipping guess_format(): empty list of specs
3275.
3276. if (!file_oformat) {
3277. file_oformat = guess_format(NULL, filename, NULL);
^
3278. if (!file_oformat) {
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
ffmpeg.c:3278:14: Taking true branch
3276. if (!file_oformat) {
3277. file_oformat = guess_format(NULL, filename, NULL);
3278. if (!file_oformat) {
^
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3280. filename);
ffmpeg.c:3279:13:
3277. file_oformat = guess_format(NULL, filename, NULL);
3278. if (!file_oformat) {
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
^
3280. filename);
3281. av_exit(1);
ffmpeg.c:3281:13: Skipping av_exit(): empty list of specs
3279. fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3280. filename);
3281. av_exit(1);
^
3282. }
3283. }
ffmpeg.c:3285:5:
3283. }
3284.
3285. oc->oformat = file_oformat;
^
3286. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3287.
|
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L3285
|
d2a_code_trace_data_45783
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/srp/srp_lib.c:168: 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:168:36: Call
166. return NULL;
167.
168. if ((A = BN_new()) != NULL && !BN_mod_exp(A, g, a, N, bn_ctx)) {
^
169. BN_free(A);
170. A = NULL;
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_45784
|
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size)
{
size_t i;
if (in) {
out += size - 1;
for (i = 0; i < size; i++)
*out-- = *in++;
} else {
unsigned char *q;
char c;
q = out + size - 1;
for (i = 0; i < size / 2; i++) {
c = *q;
*q-- = *out;
*out++ = c;
}
}
}
ssl/statem/statem_lib.c:435: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `BUF_reverse`.
Showing all 7 steps of the trace
ssl/statem/statem_lib.c:400:9: Call
398. }
399.
400. j = EVP_PKEY_size(pkey);
^
401. if (((int)len > j) || ((int)PACKET_remaining(pkt) > j)
402. || (PACKET_remaining(pkt) == 0)) {
crypto/evp/p_lib.c:47:5: Assignment
45. if (pkey && pkey->ameth && pkey->ameth->pkey_size)
46. return pkey->ameth->pkey_size(pkey);
47. return 0;
^
48. }
49.
ssl/statem/statem_lib.c:400:5: Assignment
398. }
399.
400. j = EVP_PKEY_size(pkey);
^
401. if (((int)len > j) || ((int)PACKET_remaining(pkt) > j)
402. || (PACKET_remaining(pkt) == 0)) {
ssl/statem/statem_lib.c:435:13: Call
433. goto f_err;
434. }
435. BUF_reverse(gost_data, data, len);
^
436. data = gost_data;
437. }
crypto/buffer/buffer.c:147:1: <LHS trace>
145. }
146.
147. > void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size)
148. {
149. size_t i;
crypto/buffer/buffer.c:147:1: Parameter `size`
145. }
146.
147. > void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size)
148. {
149. size_t i;
crypto/buffer/buffer.c:151:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `BUF_reverse`
149. size_t i;
150. if (in) {
151. out += size - 1;
^
152. for (i = 0; i < size; i++)
153. *out-- = *in++;
|
https://github.com/openssl/openssl/blob/62b0a0dea612e3683c6bd4bef359fceda00238e8/crypto/buffer/buffer.c/#L151
|
d2a_code_trace_data_45785
|
static const char *skip_space(const char *s)
{
while (ossl_isspace(*s))
s++;
return s;
}
test/property_test.c:352: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, 50] by call to `ossl_method_store_add`.
Showing all 25 steps of the trace
test/property_test.c:335:1: Array declaration
333. }
334.
335. > static int test_query_cache_stochastic(void)
336. {
337. const int max = 10000, tail = 10;
test/property_test.c:352:14: Call
350. v[i] = 2 * i;
351. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i);
352. if (!TEST_true(ossl_method_store_add(store, NULL, i, buf, "abc",
^
353. NULL, NULL))
354. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i))
crypto/property/property.c:177:1: Parameter `*properties`
175. }
176.
177. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
178. int nid, const char *properties, void *method,
179. int (*method_up_ref)(void *),
crypto/property/property.c:213:28: Call
211. ossl_method_cache_flush(store, nid);
212. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
213. impl->properties = ossl_parse_property(store->ctx, properties);
^
214. if (impl->properties == NULL)
215. goto err;
crypto/property/property_parse.c:329:1: Parameter `*defn`
327. }
328.
329. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn)
330. {
331. PROPERTY_DEFINITION *prop = NULL;
crypto/property/property_parse.c:334:5: Assignment
332. OSSL_PROPERTY_LIST *res = NULL;
333. STACK_OF(PROPERTY_DEFINITION) *sk;
334. const char *s = defn;
^
335. int done;
336.
crypto/property/property_parse.c:340:9: Call
338. return NULL;
339.
340. s = skip_space(s);
^
341. done = *s == '\0';
342. while (!done) {
crypto/property/property_parse.c:52:1: Parameter `*s`
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:56:5: Assignment
54. while (ossl_isspace(*s))
55. s++;
56. return s;
^
57. }
58.
crypto/property/property_parse.c:340:5: Assignment
338. return NULL;
339.
340. s = skip_space(s);
^
341. done = *s == '\0';
342. while (!done) {
crypto/property/property_parse.c:350:14: Call
348. memset(&prop->v, 0, sizeof(prop->v));
349. prop->optional = 0;
350. if (!parse_name(ctx, &s, 1, &prop->name_idx))
^
351. goto err;
352. prop->oper = PROPERTY_OPER_EQ;
crypto/property/property_parse.c:83:1: Parameter `**t`
81. }
82.
83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
84. OSSL_PROPERTY_IDX *idx)
85. {
crypto/property/property_parse.c:358:13: Call
356. goto err;
357. }
358. if (match_ch(&s, '=')) {
^
359. if (!parse_value(ctx, &s, prop, 1)) {
360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
crypto/property/property_parse.c:59:1: Parameter `**t`
57. }
58.
59. > static int match_ch(const char *t[], char m)
60. {
61. const char *s = *t;
crypto/property/property_parse.c:359:18: Call
357. }
358. if (match_ch(&s, '=')) {
359. if (!parse_value(ctx, &s, prop, 1)) {
^
360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
361. "HERE-->%s", start);
crypto/property/property_parse.c:254:1: Parameter `**t`
252. }
253.
254. > static int parse_value(OPENSSL_CTX *ctx, const char *t[],
255. PROPERTY_DEFINITION *res, int create)
256. {
crypto/property/property_parse.c:257:5: Assignment
255. PROPERTY_DEFINITION *res, int create)
256. {
257. const char *s = *t;
^
258. int r = 0;
259.
crypto/property/property_parse.c:261:9: Assignment
259.
260. if (*s == '"' || *s == '\'') {
261. s++;
^
262. r = parse_string(ctx, &s, s[-1], res, create);
263. } else if (*s == '+') {
crypto/property/property_parse.c:262:13: Call
260. if (*s == '"' || *s == '\'') {
261. s++;
262. r = parse_string(ctx, &s, s[-1], res, create);
^
263. } else if (*s == '+') {
264. s++;
crypto/property/property_parse.c:190:1: Parameter `**t`
188. }
189.
190. > static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
191. PROPERTY_DEFINITION *res, const int create)
192. {
crypto/property/property_parse.c:194:5: Assignment
192. {
193. char v[1000];
194. const char *s = *t;
^
195. size_t i = 0;
196. int err = 0;
crypto/property/property_parse.c:216:10: Call
214. res->v.str_val = ossl_property_value(ctx, v, create);
215. }
216. *t = skip_space(s + 1);
^
217. res->type = PROPERTY_TYPE_STRING;
218. return !err;
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, 50] 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/c1d56231ef6385b557ec72eec508e55ea26ca8b0/crypto/property/property_parse.c/#L54
|
d2a_code_trace_data_45786
|
static ngx_int_t
ngx_http_uwsgi_create_request(ngx_http_request_t *r)
{
u_char ch, *lowcase_key;
size_t key_len, val_len, len, allocated;
ngx_uint_t i, n, hash, skip_empty, header_params;
ngx_buf_t *b;
ngx_chain_t *cl, *body;
ngx_list_part_t *part;
ngx_table_elt_t *header, **ignored;
ngx_http_uwsgi_params_t *params;
ngx_http_script_code_pt code;
ngx_http_script_engine_t e, le;
ngx_http_uwsgi_loc_conf_t *uwcf;
ngx_http_script_len_code_pt lcode;
len = 0;
header_params = 0;
ignored = NULL;
uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
#if (NGX_HTTP_CACHE)
params = r->upstream->cacheable ? &uwcf->params_cache : &uwcf->params;
#else
params = &uwcf->params;
#endif
if (params->lengths) {
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
ngx_http_script_flush_no_cacheable_variables(r, params->flushes);
le.flushed = 1;
le.ip = params->lengths->elts;
le.request = r;
while (*(uintptr_t *) le.ip) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
key_len = lcode(&le);
lcode = *(ngx_http_script_len_code_pt *) le.ip;
skip_empty = lcode(&le);
for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
}
le.ip += sizeof(uintptr_t);
if (skip_empty && val_len == 0) {
continue;
}
len += 2 + key_len + 2 + val_len;
}
}
if (uwcf->upstream.pass_request_headers) {
allocated = 0;
lowcase_key = NULL;
if (params->number) {
n = 0;
part = &r->headers_in.headers.part;
while (part) {
n += part->nelts;
part = part->next;
}
ignored = ngx_palloc(r->pool, n * sizeof(void *));
if (ignored == NULL) {
return NGX_ERROR;
}
}
part = &r->headers_in.headers.part;
header = part->elts;
for (i = 0; ; i++) {
if (i >= part->nelts) {
if (part->next == NULL) {
break;
}
part = part->next;
header = part->elts;
i = 0;
}
if (params->number) {
if (allocated < header[i].key.len) {
allocated = header[i].key.len + 16;
lowcase_key = ngx_pnalloc(r->pool, allocated);
if (lowcase_key == NULL) {
return NGX_ERROR;
}
}
hash = 0;
for (n = 0; n < header[i].key.len; n++) {
ch = header[i].key.data[n];
if (ch >= 'A' && ch <= 'Z') {
ch |= 0x20;
} else if (ch == '-') {
ch = '_';
}
hash = ngx_hash(hash, ch);
lowcase_key[n] = ch;
}
if (ngx_hash_find(¶ms->hash, hash, lowcase_key, n)) {
ignored[header_params++] = &header[i];
continue;
}
}
len += 2 + sizeof("HTTP_") - 1 + header[i].key.len
+ 2 + header[i].value.len;
}
}
len += uwcf->uwsgi_string.len;
#if 0
if (len > 0 && len < 2) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
"uwsgi request is too little: %uz", len);
return NGX_ERROR;
}
#endif
if (len > 65535) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
"uwsgi request is too big: %uz", len);
return NGX_ERROR;
}
b = ngx_create_temp_buf(r->pool, len + 4);
if (b == NULL) {
return NGX_ERROR;
}
cl = ngx_alloc_chain_link(r->pool);
if (cl == NULL) {
return NGX_ERROR;
}
cl->buf = b;
*b->last++ = (u_char) uwcf->modifier1;
*b->last++ = (u_char) (len & 0xff);
*b->last++ = (u_char) ((len >> 8) & 0xff);
*b->last++ = (u_char) uwcf->modifier2;
if (params->lengths) {
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
e.ip = params->values->elts;
e.pos = b->last;
e.request = r;
e.flushed = 1;
le.ip = params->lengths->elts;
while (*(uintptr_t *) le.ip) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
key_len = (u_char) lcode(&le);
lcode = *(ngx_http_script_len_code_pt *) le.ip;
skip_empty = lcode(&le);
for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
}
le.ip += sizeof(uintptr_t);
if (skip_empty && val_len == 0) {
e.skip = 1;
while (*(uintptr_t *) e.ip) {
code = *(ngx_http_script_code_pt *) e.ip;
code((ngx_http_script_engine_t *) &e);
}
e.ip += sizeof(uintptr_t);
e.skip = 0;
continue;
}
*e.pos++ = (u_char) (key_len & 0xff);
*e.pos++ = (u_char) ((key_len >> 8) & 0xff);
code = *(ngx_http_script_code_pt *) e.ip;
code((ngx_http_script_engine_t *) &e);
*e.pos++ = (u_char) (val_len & 0xff);
*e.pos++ = (u_char) ((val_len >> 8) & 0xff);
while (*(uintptr_t *) e.ip) {
code = *(ngx_http_script_code_pt *) e.ip;
code((ngx_http_script_engine_t *) &e);
}
e.ip += sizeof(uintptr_t);
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"uwsgi param: \"%*s: %*s\"",
key_len, e.pos - (key_len + 2 + val_len),
val_len, e.pos - val_len);
}
b->last = e.pos;
}
if (uwcf->upstream.pass_request_headers) {
part = &r->headers_in.headers.part;
header = part->elts;
for (i = 0; ; i++) {
if (i >= part->nelts) {
if (part->next == NULL) {
break;
}
part = part->next;
header = part->elts;
i = 0;
}
for (n = 0; n < header_params; n++) {
if (&header[i] == ignored[n]) {
goto next;
}
}
key_len = sizeof("HTTP_") - 1 + header[i].key.len;
*b->last++ = (u_char) (key_len & 0xff);
*b->last++ = (u_char) ((key_len >> 8) & 0xff);
b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1);
for (n = 0; n < header[i].key.len; n++) {
ch = header[i].key.data[n];
if (ch >= 'a' && ch <= 'z') {
ch &= ~0x20;
} else if (ch == '-') {
ch = '_';
}
*b->last++ = ch;
}
val_len = header[i].value.len;
*b->last++ = (u_char) (val_len & 0xff);
*b->last++ = (u_char) ((val_len >> 8) & 0xff);
b->last = ngx_copy(b->last, header[i].value.data, val_len);
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"uwsgi param: \"%*s: %*s\"",
key_len, b->last - (key_len + 2 + val_len),
val_len, b->last - val_len);
next:
continue;
}
}
b->last = ngx_copy(b->last, uwcf->uwsgi_string.data,
uwcf->uwsgi_string.len);
if (r->request_body_no_buffering) {
r->upstream->request_bufs = cl;
} else if (uwcf->upstream.pass_request_body) {
body = r->upstream->request_bufs;
r->upstream->request_bufs = cl;
while (body) {
b = ngx_alloc_buf(r->pool);
if (b == NULL) {
return NGX_ERROR;
}
ngx_memcpy(b, body->buf, sizeof(ngx_buf_t));
cl->next = ngx_alloc_chain_link(r->pool);
if (cl->next == NULL) {
return NGX_ERROR;
}
cl = cl->next;
cl->buf = b;
body = body->next;
}
} else {
r->upstream->request_bufs = cl;
}
cl->next = NULL;
return NGX_OK;
}
src/http/modules/ngx_http_uwsgi_module.c:1024: error: Buffer Overrun L3
Offset: [1, +oo] Size: [0, 65539].
src/http/modules/ngx_http_uwsgi_module.c:839:5: <Length trace>
837. ngx_http_script_len_code_pt lcode;
838.
839. len = 0;
^
840. header_params = 0;
841. ignored = NULL;
src/http/modules/ngx_http_uwsgi_module.c:839:5: Assignment
837. ngx_http_script_len_code_pt lcode;
838.
839. len = 0;
^
840. header_params = 0;
841. ignored = NULL;
src/http/modules/ngx_http_uwsgi_module.c:952:5: Assignment
950. }
951.
952. len += uwcf->uwsgi_string.len;
^
953.
954. #if 0
src/http/modules/ngx_http_uwsgi_module.c:969:9: Call
967. }
968.
969. b = ngx_create_temp_buf(r->pool, len + 4);
^
970. if (b == NULL) {
971. return NGX_ERROR;
src/core/ngx_buf.c:12:1: Parameter `size`
10.
11.
12. ngx_buf_t *
^
13. ngx_create_temp_buf(ngx_pool_t *pool, size_t size)
14. {
src/core/ngx_buf.c:22:16: Call
20. }
21.
22. b->start = ngx_palloc(pool, size);
^
23. if (b->start == NULL) {
24. return NULL;
src/core/ngx_palloc.c:127:16: Call
125. #if !(NGX_DEBUG_PALLOC)
126. if (size <= pool->max) {
127. return ngx_palloc_small(pool, size, 1);
^
128. }
129. #endif
src/core/ngx_palloc.c:157:9: Assignment
155.
156. do {
157. m = p->d.last;
^
158.
159. if (align) {
src/core/ngx_palloc.c:166:13: Assignment
164. p->d.last = m + size;
165.
166. return m;
^
167. }
168.
src/core/ngx_palloc.c:127:9: Assignment
125. #if !(NGX_DEBUG_PALLOC)
126. if (size <= pool->max) {
127. return ngx_palloc_small(pool, size, 1);
^
128. }
129. #endif
src/core/ngx_buf.c:22:5: Assignment
20. }
21.
22. b->start = ngx_palloc(pool, size);
^
23. if (b->start == NULL) {
24. return NULL;
src/core/ngx_buf.c:39:5: Assignment
37.
38. b->pos = b->start;
39. b->last = b->start;
^
40. b->end = b->last + size;
41. b->temporary = 1;
src/http/modules/ngx_http_uwsgi_module.c:990:9: Assignment
988.
989. e.ip = params->values->elts;
990. e.pos = b->last;
^
991. e.request = r;
992. e.flushed = 1;
src/http/modules/ngx_http_uwsgi_module.c:1023:14: Assignment
1021. }
1022.
1023. *e.pos++ = (u_char) (key_len & 0xff);
^
1024. *e.pos++ = (u_char) ((key_len >> 8) & 0xff);
1025.
src/http/modules/ngx_http_uwsgi_module.c:1024:13: Array access: Offset: [1, +oo] Size: [0, 65539]
1022.
1023. *e.pos++ = (u_char) (key_len & 0xff);
1024. *e.pos++ = (u_char) ((key_len >> 8) & 0xff);
^
1025.
1026. code = *(ngx_http_script_code_pt *) e.ip;
|
https://github.com/nginx/nginx/blob/b71792b11086d9df748f36d02f93d360d135cd7c/src/http/modules/ngx_http_uwsgi_module.c/#L1024
|
d2a_code_trace_data_45787
|
static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
{
size_t packlen = pkt->written - sub->pwritten;
if (packlen == 0
&& (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0)
return 0;
if (packlen == 0
&& sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) {
if (!doclose)
return 0;
if ((pkt->curr - sub->lenbytes) == sub->packet_len) {
pkt->written -= sub->lenbytes;
pkt->curr -= sub->lenbytes;
}
sub->packet_len = 0;
sub->lenbytes = 0;
}
if (sub->lenbytes > 0
&& !put_value(&GETBUF(pkt)[sub->packet_len], packlen,
sub->lenbytes))
return 0;
if (doclose) {
pkt->subs = sub->parent;
OPENSSL_free(sub);
}
return 1;
}
test/wpackettest.c:160: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `WPACKET_finish`.
Showing all 13 steps of the trace
test/wpackettest.c:139:10: Call
137. return cleanup(&pkt);
138.
139. if (!TEST_true(WPACKET_init_len(&pkt, buf, 1))
^
140. /*
141. * Should fail because we already consumed 1 byte with the
ssl/packet.c:134:1: Parameter `lenbytes`
132. }
133.
134. > int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes)
135. {
136. /* Internal API, so should not fail */
ssl/packet.c:145:12: Call
143. pkt->maxsize = maxmaxsize(lenbytes);
144.
145. return wpacket_intern_init_len(pkt, lenbytes);
^
146. }
147.
ssl/packet.c:90:1: Parameter `lenbytes`
88. }
89.
90. > static int wpacket_intern_init_len(WPACKET *pkt, size_t lenbytes)
91. {
92. unsigned char *lenchars;
ssl/packet.c:104:5: Assignment
102. return 1;
103.
104. pkt->subs->pwritten = lenbytes;
^
105. pkt->subs->lenbytes = lenbytes;
106.
test/wpackettest.c:160:17: Call
158. || !TEST_true(WPACKET_put_bytes_u8(&pkt, 0xff))
159. || !TEST_false(WPACKET_put_bytes_u8(&pkt, 0xff))
160. || !TEST_true(WPACKET_finish(&pkt))
^
161. || !TEST_true(WPACKET_get_total_written(&pkt, &written))
162. || !TEST_mem_eq(buf->data, written, simple2, sizeof(simple2)))
ssl/packet.c:255:1: Parameter `pkt->written`
253. }
254.
255. > int WPACKET_finish(WPACKET *pkt)
256. {
257. int ret;
ssl/packet.c:266:11: Call
264. return 0;
265.
266. ret = wpacket_intern_close(pkt, pkt->subs, 1);
^
267. if (ret) {
268. OPENSSL_free(pkt->subs);
ssl/packet.c:188:1: <LHS trace>
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:188:1: Parameter `pkt->written`
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:188:1: <RHS trace>
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:188:1: Parameter `sub->pwritten`
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:190:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `WPACKET_finish`
188. static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
^
191.
192. if (packlen == 0
|
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet.c/#L190
|
d2a_code_trace_data_45788
|
int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_one(b);
BN_zero(c);
if (BN_mod_exp(d, a, b, c, ctx)) {
fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
return 0;
}
BN_bntest_rand(c, 30, 0, 1);
for (i = 0; i < num2; i++) {
BN_bntest_rand(a, 20 + i * 5, 0, 0);
BN_bntest_rand(b, 2 + i, 0, 0);
if (!BN_mod_exp(d, a, b, c, ctx))
return (0);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " ^ ");
BN_print(bp, b);
BIO_puts(bp, " % ");
BN_print(bp, c);
BIO_puts(bp, " - ");
}
BN_print(bp, d);
BIO_puts(bp, "\n");
}
BN_exp(e, a, b, ctx);
BN_sub(e, e, d);
BN_div(a, b, e, c, ctx);
if (!BN_is_zero(b)) {
fprintf(stderr, "Modulo exponentiation test failed!\n");
return 0;
}
}
BN_hex2bn(&a, "050505050505");
BN_hex2bn(&b, "02");
BN_hex2bn(&c,
"4141414141414141414141274141414141414141414141414141414141414141"
"4141414141414141414141414141414141414141414141414141414141414141"
"4141414141414141414141800000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000001");
BN_mod_exp(d, a, b, c, ctx);
BN_mul(e, a, a, ctx);
if (BN_cmp(d, e)) {
fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n");
return 0;
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
return (1);
}
test/bntest.c:994: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 988, column 9 is not reachable after line 994, column 17.
Showing all 143 steps of the trace
test/bntest.c:979:1: start of procedure test_mod_exp()
977. }
978.
979. > int test_mod_exp(BIO *bp, BN_CTX *ctx)
980. {
981. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:984:5:
982. int i;
983.
984. > a = BN_new();
985. b = BN_new();
986. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:985:5:
983.
984. a = BN_new();
985. > b = BN_new();
986. c = BN_new();
987. 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:986:5:
984. a = BN_new();
985. b = BN_new();
986. > c = BN_new();
987. d = BN_new();
988. 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:987:5:
985. b = BN_new();
986. c = BN_new();
987. > d = BN_new();
988. e = BN_new();
989.
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:988:5:
986. c = BN_new();
987. d = BN_new();
988. > e = BN_new();
989.
990. BN_one(a);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:990:5:
988. e = BN_new();
989.
990. > BN_one(a);
991. BN_one(b);
992. BN_zero(c);
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:991:5:
989.
990. BN_one(a);
991. > BN_one(b);
992. BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:992:5:
990. BN_one(a);
991. BN_one(b);
992. > BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is false
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:993:9: Taking true branch
991. BN_one(b);
992. BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
^
994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995. return 0;
test/bntest.c:994:9:
992. BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
994. > fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995. return 0;
996. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L994
|
d2a_code_trace_data_45789
|
static void decode_audio_s16(int16_t *out, const uint8_t *buf, int buf_size,
int channels)
{
int ch;
const uint8_t *buf_end = buf + buf_size;
int predictor[2];
int st = channels - 1;
for (ch = 0; ch < channels; ch++) {
predictor[ch] = (int16_t)AV_RL16(buf);
buf += 2;
*out++ = predictor[ch];
}
ch = 0;
while (buf < buf_end) {
uint8_t b = *buf++;
if (b & 0x80)
predictor[ch] -= vmdaudio_table[b & 0x7F];
else
predictor[ch] += vmdaudio_table[b];
predictor[ch] = av_clip_int16(predictor[ch]);
*out++ = predictor[ch];
ch ^= st;
}
}
libavcodec/vmdav.c:491: error: Uninitialized Value
The value read from predictor[_] was never initialized.
libavcodec/vmdav.c:491:13:
489. predictor[ch] -= vmdaudio_table[b & 0x7F];
490. else
491. predictor[ch] += vmdaudio_table[b];
^
492. predictor[ch] = av_clip_int16(predictor[ch]);
493. *out++ = predictor[ch];
|
https://github.com/libav/libav/blob/4568c2bf975e51d843bf1ff6ac06060a8a6291b3/libavcodec/vmdav.c/#L491
|
d2a_code_trace_data_45790
|
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/ocsp/ocsp_prn.c:238: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`.
Showing all 11 steps of the trace
crypto/ocsp/ocsp_prn.c:217:15: Call
215.
216. i = ASN1_STRING_length(rb->response);
217. if ((br = OCSP_response_get1_basic(o)) == NULL)
^
218. goto err;
219. rd = br->tbsResponseData;
crypto/ocsp/ocsp_cl.c:204:1: Parameter `*resp->responseBytes->response->data`
202. */
203.
204. > OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp)
205. {
206. OCSP_RESPBYTES *rb;
crypto/ocsp/ocsp_prn.c:220:9: Call
218. goto err;
219. rd = br->tbsResponseData;
220. l = ASN1_INTEGER_get(rd->version);
^
221. if (BIO_printf(bp, "\n Version: %lu (0x%lx)\n", l + 1, l) <= 0)
222. goto err;
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/ocsp/ocsp_prn.c:238:10: Call
236. if (BIO_printf(bp, "\n Produced At: ") <= 0)
237. goto err;
238. if (!ASN1_GENERALIZEDTIME_print(bp, rd->producedAt))
^
239. goto err;
240. if (BIO_printf(bp, "\n Responses:\n") <= 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_GENERALIZEDTIME_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_45791
|
static int config_props(AVFilterLink *link)
{
YADIFContext *s = link->src->priv;
link->time_base.num = link->src->inputs[0]->time_base.num;
link->time_base.den = link->src->inputs[0]->time_base.den * 2;
link->w = link->src->inputs[0]->w;
link->h = link->src->inputs[0]->h;
if (s->mode & 1)
link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate,
(AVRational){2, 1});
s->csp = av_pix_fmt_desc_get(link->format);
if (s->csp->comp[0].depth > 8) {
s->filter_line = filter_line_c_16bit;
s->filter_edges = filter_edges_16bit;
} else {
s->filter_line = filter_line_c;
s->filter_edges = filter_edges;
if (ARCH_X86)
ff_yadif_init_x86(s);
}
return 0;
}
libavfilter/vf_yadif.c:470: error: Null Dereference
pointer `s->csp` last assigned on line 469 could be null and is dereferenced at line 470, column 9.
libavfilter/vf_yadif.c:456:1: start of procedure config_props()
454. }
455.
456. static int config_props(AVFilterLink *link)
^
457. {
458. YADIFContext *s = link->src->priv;
libavfilter/vf_yadif.c:458:5:
456. static int config_props(AVFilterLink *link)
457. {
458. YADIFContext *s = link->src->priv;
^
459.
460. link->time_base.num = link->src->inputs[0]->time_base.num;
libavfilter/vf_yadif.c:460:5:
458. YADIFContext *s = link->src->priv;
459.
460. link->time_base.num = link->src->inputs[0]->time_base.num;
^
461. link->time_base.den = link->src->inputs[0]->time_base.den * 2;
462. link->w = link->src->inputs[0]->w;
libavfilter/vf_yadif.c:461:5:
459.
460. link->time_base.num = link->src->inputs[0]->time_base.num;
461. link->time_base.den = link->src->inputs[0]->time_base.den * 2;
^
462. link->w = link->src->inputs[0]->w;
463. link->h = link->src->inputs[0]->h;
libavfilter/vf_yadif.c:462:5:
460. link->time_base.num = link->src->inputs[0]->time_base.num;
461. link->time_base.den = link->src->inputs[0]->time_base.den * 2;
462. link->w = link->src->inputs[0]->w;
^
463. link->h = link->src->inputs[0]->h;
464.
libavfilter/vf_yadif.c:463:5:
461. link->time_base.den = link->src->inputs[0]->time_base.den * 2;
462. link->w = link->src->inputs[0]->w;
463. link->h = link->src->inputs[0]->h;
^
464.
465. if (s->mode & 1)
libavfilter/vf_yadif.c:465:9: Taking true branch
463. link->h = link->src->inputs[0]->h;
464.
465. if (s->mode & 1)
^
466. link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate,
467. (AVRational){2, 1});
libavfilter/vf_yadif.c:466:9:
464.
465. if (s->mode & 1)
466. link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate,
^
467. (AVRational){2, 1});
468.
libavutil/rational.c:79:1: start of procedure av_mul_q()
77. }
78.
79. AVRational av_mul_q(AVRational b, AVRational c)
^
80. {
81. av_reduce(&b.num, &b.den,
libavutil/rational.c:81:5: Skipping av_reduce(): empty list of specs
79. AVRational av_mul_q(AVRational b, AVRational c)
80. {
81. av_reduce(&b.num, &b.den,
^
82. b.num * (int64_t) c.num,
83. b.den * (int64_t) c.den, INT_MAX);
libavutil/rational.c:84:5:
82. b.num * (int64_t) c.num,
83. b.den * (int64_t) c.den, INT_MAX);
84. return b;
^
85. }
86.
libavutil/rational.c:85:1: return from a call to av_mul_q
83. b.den * (int64_t) c.den, INT_MAX);
84. return b;
85. }
^
86.
87. AVRational av_div_q(AVRational b, AVRational c)
libavfilter/vf_yadif.c:469:5:
467. (AVRational){2, 1});
468.
469. s->csp = av_pix_fmt_desc_get(link->format);
^
470. if (s->csp->comp[0].depth > 8) {
471. s->filter_line = filter_line_c_16bit;
libavutil/pixdesc.c:1686:1: start of procedure av_pix_fmt_desc_get()
1684. }
1685.
1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1688:9: Taking false branch
1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1689. return NULL;
1690. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1688:24: Taking true branch
1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1689. return NULL;
1690. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1689:9:
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1689. return NULL;
^
1690. return &av_pix_fmt_descriptors[pix_fmt];
1691. }
libavutil/pixdesc.c:1691:1: return from a call to av_pix_fmt_desc_get
1689. return NULL;
1690. return &av_pix_fmt_descriptors[pix_fmt];
1691. }
^
1692.
1693. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libavfilter/vf_yadif.c:470:9:
468.
469. s->csp = av_pix_fmt_desc_get(link->format);
470. if (s->csp->comp[0].depth > 8) {
^
471. s->filter_line = filter_line_c_16bit;
472. s->filter_edges = filter_edges_16bit;
|
https://github.com/libav/libav/blob/65e73bc60f98dc7b26c687e145dfb755d3f2ccfa/libavfilter/vf_yadif.c/#L470
|
d2a_code_trace_data_45792
|
static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
CONF *conf, char *section)
{
EVP_PKEY *pktmp;
pktmp = X509_get_pubkey(x);
EVP_PKEY_copy_parameters(pktmp,pkey);
EVP_PKEY_save_parameters(pktmp,1);
EVP_PKEY_free(pktmp);
if (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;
if (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
goto err;
if (!X509_set_pubkey(x,pkey)) goto err;
if (clrext)
{
while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
}
if (conf)
{
X509V3_CTX ctx;
X509_set_version(x,2);
X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
X509V3_set_nconf(&ctx, conf);
if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;
}
if (!X509_sign(x,pkey,digest)) goto err;
return 1;
err:
ERR_print_errors(bio_err);
return 0;
}
apps/x509.c:1301: error: NULL_DEREFERENCE
pointer `pktmp` last assigned on line 1300 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1301, column 2.
Showing all 17 steps of the trace
apps/x509.c:1294:1: start of procedure sign()
1292.
1293. /* self sign */
1294. > static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
1295. CONF *conf, char *section)
1296. {
apps/x509.c:1300:2:
1298. EVP_PKEY *pktmp;
1299.
1300. > pktmp = X509_get_pubkey(x);
1301. EVP_PKEY_copy_parameters(pktmp,pkey);
1302. EVP_PKEY_save_parameters(pktmp,1);
crypto/x509/x509_cmp.c:300:1: start of procedure X509_get_pubkey()
298. }
299.
300. > EVP_PKEY *X509_get_pubkey(X509 *x)
301. {
302. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:302:7: Taking false branch
300. EVP_PKEY *X509_get_pubkey(X509 *x)
301. {
302. if ((x == NULL) || (x->cert_info == NULL))
^
303. return(NULL);
304. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:302:22: Taking false branch
300. EVP_PKEY *X509_get_pubkey(X509 *x)
301. {
302. if ((x == NULL) || (x->cert_info == NULL))
^
303. return(NULL);
304. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:304:2:
302. if ((x == NULL) || (x->cert_info == NULL))
303. return(NULL);
304. > return(X509_PUBKEY_get(x->cert_info->key));
305. }
306.
crypto/asn1/x_pubkey.c:133:1: start of procedure X509_PUBKEY_get()
131. }
132.
133. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
134. {
135. EVP_PKEY *ret=NULL;
crypto/asn1/x_pubkey.c:135:2:
133. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
134. {
135. > EVP_PKEY *ret=NULL;
136.
137. if (key == NULL) goto error;
crypto/asn1/x_pubkey.c:137:6: Taking false branch
135. EVP_PKEY *ret=NULL;
136.
137. if (key == NULL) goto error;
^
138.
139. if (key->pkey != NULL)
crypto/asn1/x_pubkey.c:139:6: Taking false branch
137. if (key == NULL) goto error;
138.
139. if (key->pkey != NULL)
^
140. {
141. CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
crypto/asn1/x_pubkey.c:145:6: Taking true branch
143. }
144.
145. if (key->public_key == NULL) goto error;
^
146.
147. if ((ret = EVP_PKEY_new()) == NULL)
crypto/asn1/x_pubkey.c:191:2:
189. return ret;
190.
191. > error:
192. if (ret != NULL)
193. EVP_PKEY_free(ret);
crypto/asn1/x_pubkey.c:192:6: Taking false branch
190.
191. error:
192. if (ret != NULL)
^
193. EVP_PKEY_free(ret);
194. return(NULL);
crypto/asn1/x_pubkey.c:194:2:
192. if (ret != NULL)
193. EVP_PKEY_free(ret);
194. > return(NULL);
195. }
196.
crypto/asn1/x_pubkey.c:195:2: return from a call to X509_PUBKEY_get
193. EVP_PKEY_free(ret);
194. return(NULL);
195. }
^
196.
197. /* Now two pseudo ASN1 routines that take an EVP_PKEY structure
crypto/x509/x509_cmp.c:305:2: return from a call to X509_get_pubkey
303. return(NULL);
304. return(X509_PUBKEY_get(x->cert_info->key));
305. }
^
306.
307. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
apps/x509.c:1301:2:
1299.
1300. pktmp = X509_get_pubkey(x);
1301. > EVP_PKEY_copy_parameters(pktmp,pkey);
1302. EVP_PKEY_save_parameters(pktmp,1);
1303. EVP_PKEY_free(pktmp);
|
https://github.com/openssl/openssl/blob/360ef6769e97f2918ae67a2909951eb8612043ee/apps/x509.c/#L1301
|
d2a_code_trace_data_45793
|
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
{
InputStream *ist = s->opaque;
const enum AVPixelFormat *p;
int ret;
for (p = pix_fmts; *p != -1; p++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
const HWAccel *hwaccel;
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
break;
hwaccel = get_hwaccel(*p);
if (!hwaccel ||
(ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) ||
(ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id))
continue;
ret = hwaccel->init(s);
if (ret < 0) {
if (ist->hwaccel_id == hwaccel->id) {
av_log(NULL, AV_LOG_FATAL,
"%s hwaccel requested for input stream #%d:%d, "
"but cannot be initialized.\n", hwaccel->name,
ist->file_index, ist->st->index);
exit_program(1);
}
continue;
}
ist->active_hwaccel_id = hwaccel->id;
ist->hwaccel_pix_fmt = *p;
break;
}
return *p;
}
avconv.c:1494: error: Null Dereference
pointer `desc` last assigned on line 1491 could be null and is dereferenced at line 1494, column 15.
avconv.c:1484:1: start of procedure get_format()
1482. }
1483.
1484. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
^
1485. {
1486. InputStream *ist = s->opaque;
avconv.c:1486:5:
1484. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
1485. {
1486. InputStream *ist = s->opaque;
^
1487. const enum AVPixelFormat *p;
1488. int ret;
avconv.c:1490:10:
1488. int ret;
1489.
1490. for (p = pix_fmts; *p != -1; p++) {
^
1491. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1492. const HWAccel *hwaccel;
avconv.c:1490:24: Loop condition is true. Entering loop body
1488. int ret;
1489.
1490. for (p = pix_fmts; *p != -1; p++) {
^
1491. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1492. const HWAccel *hwaccel;
avconv.c:1491:9:
1489.
1490. for (p = pix_fmts; *p != -1; p++) {
1491. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
^
1492. const HWAccel *hwaccel;
1493.
libavutil/pixdesc.c:1559:1: start of procedure av_pix_fmt_desc_get()
1557. }
1558.
1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1560. {
1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1561:9: Taking false branch
1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1560. {
1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1562. return NULL;
1563. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1561:24: Taking true branch
1559. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1560. {
1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1562. return NULL;
1563. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1562:9:
1560. {
1561. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1562. return NULL;
^
1563. return &av_pix_fmt_descriptors[pix_fmt];
1564. }
libavutil/pixdesc.c:1564:1: return from a call to av_pix_fmt_desc_get
1562. return NULL;
1563. return &av_pix_fmt_descriptors[pix_fmt];
1564. }
^
1565.
1566. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
avconv.c:1494:15:
1492. const HWAccel *hwaccel;
1493.
1494. if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
^
1495. break;
1496.
|
https://github.com/libav/libav/blob/dc0c70e018f6b04488333e7e26ec26359e614e4e/avconv.c/#L1494
|
d2a_code_trace_data_45794
|
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);
}
test/exptest.c:159: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`.
Showing all 15 steps of the trace
test/exptest.c:149:5: Call
147. RAND_bytes(&c, 1);
148. c = (c % BN_BITS) - BN_BITS2;
149. BN_rand(a, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY);
^
150.
151. RAND_bytes(&c, 1);
crypto/bn/bn_rand.c:98:12: Call
96. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
97. {
98. return bnrand(0, rnd, bits, top, bottom);
^
99. }
100.
crypto/bn/bn_rand.c:17:1: Parameter `rnd->top`
15. #include <openssl/sha.h>
16.
17. > static int bnrand(int testing, BIGNUM *rnd, int bits, int top, int bottom)
18. {
19. unsigned char *buf = NULL;
test/exptest.c:159:10: Call
157. BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD);
158.
159. if (!TEST_true(BN_mod(a, a, m, ctx))
^
160. || !TEST_true(BN_mod(b, b, m, ctx))
161. || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL))
crypto/bn/bn_div.c:140:1: Parameter `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:207:11: Call
205. sdiv->neg = 0;
206. norm_shift += BN_BITS2;
207. if (!(BN_lshift(snum, num, norm_shift)))
^
208. goto err;
209. snum->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return (0);
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return (0);
100. r->neg = a->neg;
crypto/bn/bn_lib.c: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_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_div`
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/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/bn/bn_shift.c/#L112
|
d2a_code_trace_data_45795
|
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);
}
apps/s_server.c:823: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_new`.
Showing all 14 steps of the trace
apps/s_server.c:823:7: Call
821.
822. if (con == NULL) {
823. con=SSL_new(ctx);
^
824. #ifndef NO_KRB5
825. if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
ssl/ssl_lib.c:175:1: Parameter `ctx->sessions->num_items`
173. }
174.
175. > SSL *SSL_new(SSL_CTX *ctx)
176. {
177. SSL *s;
ssl/ssl_lib.c:239:2: Call
237. s->mode=ctx->mode;
238. s->read_ahead=ctx->read_ahead; /* used to happen in SSL_clear */
239. SSL_clear(s);
^
240.
241. CRYPTO_new_ex_data(ssl_meth,s,&s->ex_data);
ssl/ssl_lib.c:86:1: Parameter `s->ctx->sessions->num_items`
84. };
85.
86. > int SSL_clear(SSL *s)
87. {
88. int state;
ssl/ssl_lib.c:134:6: Call
132. ssl_clear_cipher_ctx(s);
133.
134. if (ssl_clear_bad_session(s))
^
135. {
136. SSL_SESSION_free(s->session);
ssl/ssl_sess.c:614:1: Parameter `s->ctx->sessions->num_items`
612. }
613.
614. > int ssl_clear_bad_session(SSL *s)
615. {
616. if ( (s->session != NULL) &&
ssl/ssl_sess.c:620:3: Call
618. !(SSL_in_init(s) || SSL_in_before(s)))
619. {
620. SSL_CTX_remove_session(s->ctx,s->session);
^
621. return(1);
622. }
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, +oo] - 1):unsigned64 by call to `SSL_new`
238. }
239.
240. lh->num_items--;
^
241. if ((lh->num_nodes > MIN_NODES) &&
242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/crypto/lhash/lhash.c/#L240
|
d2a_code_trace_data_45796
|
static int opt_vstats(const char *opt, const char *arg)
{
char filename[40];
time_t today2 = time(NULL);
struct tm *today = localtime(&today2);
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
today->tm_sec);
return opt_vstats_file(opt, filename);
}
avconv.c:4733: error: Null Dereference
pointer `today` last assigned on line 4731 could be null and is dereferenced at line 4733, column 69.
avconv.c:4727:1: start of procedure opt_vstats()
4725. }
4726.
4727. static int opt_vstats(const char *opt, const char *arg)
^
4728. {
4729. char filename[40];
avconv.c:4730:5:
4728. {
4729. char filename[40];
4730. time_t today2 = time(NULL);
^
4731. struct tm *today = localtime(&today2);
4732.
avconv.c:4731:5:
4729. char filename[40];
4730. time_t today2 = time(NULL);
4731. struct tm *today = localtime(&today2);
^
4732.
4733. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
avconv.c:4733:5:
4731. struct tm *today = localtime(&today2);
4732.
4733. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
4734. today->tm_sec);
4735. return opt_vstats_file(opt, filename);
|
https://github.com/libav/libav/blob/ab9f9876615fd856184912cf3863a80cf3a721b6/avconv.c/#L4733
|
d2a_code_trace_data_45797
|
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str)
{
char *tmp = NULL;
char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
int reason_code = -1;
int ret = 0;
unsigned int i;
ASN1_OBJECT *hold = NULL;
ASN1_GENERALIZEDTIME *comp_time = NULL;
tmp = BUF_strdup(str);
p = strchr(tmp, ',');
rtime_str = tmp;
if (p)
{
*p = '\0';
p++;
reason_str = p;
p = strchr(p, ',');
if (p)
{
*p = '\0';
arg_str = p + 1;
}
}
if (prevtm)
{
*prevtm = ASN1_UTCTIME_new();
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str))
{
BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str);
goto err;
}
}
if (reason_str)
{
for (i = 0; i < NUM_REASONS; i++)
{
if(!strcasecmp(reason_str, crl_reasons[i]))
{
reason_code = i;
break;
}
}
if (reason_code == OCSP_REVOKED_STATUS_NOSTATUS)
{
BIO_printf(bio_err, "invalid reason code %s\n", reason_str);
goto err;
}
if (reason_code == 7)
reason_code = OCSP_REVOKED_STATUS_REMOVEFROMCRL;
else if (reason_code == 8)
{
if (!arg_str)
{
BIO_printf(bio_err, "missing hold instruction\n");
goto err;
}
reason_code = OCSP_REVOKED_STATUS_CERTIFICATEHOLD;
hold = OBJ_txt2obj(arg_str, 0);
if (!hold)
{
BIO_printf(bio_err, "invalid object identifier %s\n", arg_str);
goto err;
}
if (phold) *phold = hold;
}
else if ((reason_code == 9) || (reason_code == 10))
{
if (!arg_str)
{
BIO_printf(bio_err, "missing compromised time\n");
goto err;
}
comp_time = ASN1_GENERALIZEDTIME_new();
if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str))
{
BIO_printf(bio_err, "invalid compromised time %s\n", arg_str);
goto err;
}
if (reason_code == 9)
reason_code = OCSP_REVOKED_STATUS_KEYCOMPROMISE;
else
reason_code = OCSP_REVOKED_STATUS_CACOMPROMISE;
}
}
if (preason) *preason = reason_code;
if (pinvtm) *pinvtm = comp_time;
else ASN1_GENERALIZEDTIME_free(comp_time);
ret = 1;
err:
if (tmp) OPENSSL_free(tmp);
if (!phold) ASN1_OBJECT_free(hold);
if (!pinvtm) ASN1_GENERALIZEDTIME_free(comp_time);
return ret;
}
apps/ca.c:2883: error: NULL_DEREFERENCE
pointer `tmp` last assigned on line 2881 could be null and is dereferenced by call to `strchr()` at line 2883, column 6.
Showing all 53 steps of the trace
apps/ca.c:2872:1: start of procedure unpack_revinfo()
2870. }
2871.
2872. > int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str)
2873. {
2874. char *tmp = NULL;
apps/ca.c:2874:2:
2872. int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str)
2873. {
2874. > char *tmp = NULL;
2875. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2876. int reason_code = -1;
apps/ca.c:2875:2:
2873. {
2874. char *tmp = NULL;
2875. > char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2876. int reason_code = -1;
2877. int ret = 0;
apps/ca.c:2876:2:
2874. char *tmp = NULL;
2875. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2876. > int reason_code = -1;
2877. int ret = 0;
2878. unsigned int i;
apps/ca.c:2877:2:
2875. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2876. int reason_code = -1;
2877. > int ret = 0;
2878. unsigned int i;
2879. ASN1_OBJECT *hold = NULL;
apps/ca.c:2879:2:
2877. int ret = 0;
2878. unsigned int i;
2879. > ASN1_OBJECT *hold = NULL;
2880. ASN1_GENERALIZEDTIME *comp_time = NULL;
2881. tmp = BUF_strdup(str);
apps/ca.c:2880:2:
2878. unsigned int i;
2879. ASN1_OBJECT *hold = NULL;
2880. > ASN1_GENERALIZEDTIME *comp_time = NULL;
2881. tmp = BUF_strdup(str);
2882.
apps/ca.c:2881:2:
2879. ASN1_OBJECT *hold = NULL;
2880. ASN1_GENERALIZEDTIME *comp_time = NULL;
2881. > tmp = BUF_strdup(str);
2882.
2883. p = strchr(tmp, ',');
crypto/buffer/buffer.c:165:1: start of procedure BUF_strdup()
163. }
164.
165. > char *BUF_strdup(const char *str)
166. {
167. if (str == NULL) return(NULL);
crypto/buffer/buffer.c:167:6: Taking false branch
165. char *BUF_strdup(const char *str)
166. {
167. if (str == NULL) return(NULL);
^
168. return BUF_strndup(str, strlen(str));
169. }
crypto/buffer/buffer.c:168:2:
166. {
167. if (str == NULL) return(NULL);
168. > return BUF_strndup(str, strlen(str));
169. }
170.
crypto/buffer/buffer.c:171:1: start of procedure BUF_strndup()
169. }
170.
171. > char *BUF_strndup(const char *str, size_t siz)
172. {
173. char *ret;
crypto/buffer/buffer.c:175:6: Taking false branch
173. char *ret;
174.
175. if (str == NULL) return(NULL);
^
176.
177. ret=OPENSSL_malloc(siz+1);
crypto/buffer/buffer.c:177:2:
175. if (str == NULL) return(NULL);
176.
177. > ret=OPENSSL_malloc(siz+1);
178. if (ret == NULL)
179. {
crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
289. }
290.
291. > void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. void *ret = NULL;
crypto/mem.c:293:2:
291. void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. > void *ret = NULL;
294. extern unsigned char cleanse_ctr;
295.
crypto/mem.c:296:6: Taking false branch
294. extern unsigned char cleanse_ctr;
295.
296. if (num <= 0) return NULL;
^
297.
298. allow_customize = 0;
crypto/mem.c:298:2:
296. if (num <= 0) return NULL;
297.
298. > allow_customize = 0;
299. if (malloc_debug_func != NULL)
300. {
crypto/mem.c:299:6: Taking true branch
297.
298. allow_customize = 0;
299. if (malloc_debug_func != NULL)
^
300. {
301. allow_customize_debug = 0;
crypto/mem.c:301:3:
299. if (malloc_debug_func != NULL)
300. {
301. > allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
300. {
301. allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
^
303. }
304. ret = malloc_ex_func(num,file,line);
crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
304. ret = malloc_ex_func(num,file,line);
^
305. #ifdef LEVITTE_DEBUG_MEM
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:308:6: Taking true branch
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
307. #endif
308. if (malloc_debug_func != NULL)
^
309. malloc_debug_func(ret, num, file, line, 1);
310.
crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
307. #endif
308. if (malloc_debug_func != NULL)
309. malloc_debug_func(ret, num, file, line, 1);
^
310.
311. /* Create a dependency on the value of 'cleanse_ctr' so our memory
crypto/mem.c:314:12: Taking false branch
312. * sanitisation function can't be optimised out. NB: We only do
313. * this for >2Kb so the overhead doesn't bother us. */
314. if(ret && (num > 2048))
^
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
crypto/mem.c:317:2:
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
317. > return ret;
318. }
319.
crypto/mem.c:318:2: return from a call to CRYPTO_malloc
316.
317. return ret;
318. }
^
319.
320. void *CRYPTO_realloc(void *str, int num, const char *file, int line)
crypto/buffer/buffer.c:178:6: Taking true branch
176.
177. ret=OPENSSL_malloc(siz+1);
178. if (ret == NULL)
^
179. {
180. BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
crypto/buffer/buffer.c:180:3:
178. if (ret == NULL)
179. {
180. > BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
181. return(NULL);
182. }
crypto/err/err.c:664:1: start of procedure ERR_put_error()
662. /********************************************************/
663.
664. > void ERR_put_error(int lib, int func, int reason, const char *file,
665. int line)
666. {
crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
686. }
687. #endif
688. es=ERR_get_state();
^
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:690:2:
688. es=ERR_get_state();
689.
690. > es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:691:6: Taking false branch
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
^
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
crypto/err/err.c:693:2:
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. > es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
crypto/err/err.c:694:2:
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
694. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
crypto/err/err.c:695:2:
693. es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. > es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
crypto/err/err.c:696:2:
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. > es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/mem.c:371:1: start of procedure CRYPTO_free()
369. }
370.
371. > void CRYPTO_free(void *str)
372. {
373. if (free_debug_func != NULL)
crypto/mem.c:373:6: Taking true branch
371. void CRYPTO_free(void *str)
372. {
373. if (free_debug_func != NULL)
^
374. free_debug_func(str, 0);
375. #ifdef LEVITTE_DEBUG_MEM
crypto/mem.c:374:3: Skipping __function_pointer__(): unresolved function pointer
372. {
373. if (free_debug_func != NULL)
374. free_debug_func(str, 0);
^
375. #ifdef LEVITTE_DEBUG_MEM
376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
crypto/mem.c:378:2: Skipping __function_pointer__(): unresolved function pointer
376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
377. #endif
378. free_func(str);
^
379. if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
crypto/mem.c:379:6: Taking true branch
377. #endif
378. free_func(str);
379. if (free_debug_func != NULL)
^
380. free_debug_func(NULL, 1);
381. }
crypto/mem.c:380:3: Skipping __function_pointer__(): unresolved function pointer
378. free_func(str);
379. if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
^
381. }
382.
crypto/mem.c:379:2:
377. #endif
378. free_func(str);
379. > if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
381. }
crypto/mem.c:381:2: return from a call to CRYPTO_free
379. if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
381. }
^
382.
383. void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
crypto/err/err.c:697:2: Loop condition is false. Leaving loop
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:698:2: return from a call to ERR_put_error
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
^
699.
700. void ERR_clear_error(void)
crypto/buffer/buffer.c:181:3:
179. {
180. BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
181. > return(NULL);
182. }
183. BUF_strlcpy(ret,str,siz+1);
crypto/buffer/buffer.c:185:2: return from a call to BUF_strndup
183. BUF_strlcpy(ret,str,siz+1);
184. return(ret);
185. }
^
186.
187. void *BUF_memdup(const void *data, size_t siz)
crypto/buffer/buffer.c:169:2: return from a call to BUF_strdup
167. if (str == NULL) return(NULL);
168. return BUF_strndup(str, strlen(str));
169. }
^
170.
171. char *BUF_strndup(const char *str, size_t siz)
apps/ca.c:2883:2:
2881. tmp = BUF_strdup(str);
2882.
2883. > p = strchr(tmp, ',');
2884.
2885. rtime_str = tmp;
|
https://github.com/openssl/openssl/blob/00dd8f6d6e703dadab3c50af84ed55ffff598ddc/apps/ca.c/#L2883
|
d2a_code_trace_data_45798
|
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;
}
ssl/tls_srp.c:306: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `SRP_Calc_client_key`.
Showing all 28 steps of the trace
ssl/tls_srp.c:279:1: Parameter `s->srp_ctx.N->top`
277.
278. /* client side */
279. > int srp_generate_client_master_secret(SSL *s)
280. {
281. BIGNUM *x = NULL, *u = NULL, *K = NULL;
ssl/tls_srp.c:289:9: Call
287. * Checks if b % n == 0
288. */
289. if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0
^
290. || (u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N))
291. == NULL
crypto/srp/srp_lib.c:218:1: Parameter `N->top`
216. }
217.
218. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N)
219. {
220. BIGNUM *r;
ssl/tls_srp.c:290:21: Call
288. */
289. if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0
290. || (u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N))
^
291. == NULL
292. || s->srp_ctx.SRP_give_srp_client_pwd_callback == NULL) {
crypto/srp/srp_lib.c:52:1: Parameter `N->top`
50. }
51.
52. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
53. {
54. /* u = SHA1(PAD(A) || PAD(B) ) -- tls-srp RFC 5054 */
crypto/srp/srp_lib.c:55:12: Call
53. {
54. /* u = SHA1(PAD(A) || PAD(B) ) -- tls-srp RFC 5054 */
55. return srp_Calc_xy(A, B, N);
^
56. }
57.
crypto/srp/srp_lib.c:23:1: Parameter `N->top`
21. /* calculate = SHA1(PAD(x) || PAD(y)) */
22.
23. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N)
24. {
25. unsigned char digest[SHA_DIGEST_LENGTH];
crypto/srp/srp_lib.c:27:16: Call
25. unsigned char digest[SHA_DIGEST_LENGTH];
26. unsigned char *tmp = NULL;
27. int numN = BN_num_bytes(N);
^
28. BIGNUM *res = NULL;
29.
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:843:1: Parameter `a->top`
841. }
842.
843. > int BN_is_zero(const BIGNUM *a)
844. {
845. return a->top == 0;
ssl/tls_srp.c:306:21: Call
304. }
305. if ((x = SRP_Calc_x(s->srp_ctx.s, s->srp_ctx.login, passwd)) == NULL
306. || (K = SRP_Calc_client_key(s->srp_ctx.N, s->srp_ctx.B,
^
307. s->srp_ctx.g, x,
308. s->srp_ctx.a, u)) == NULL) {
crypto/srp/srp_lib.c:176:1: Parameter `N->top`
174. }
175.
176. > BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
177. const BIGNUM *x, const BIGNUM *a, const BIGNUM *u)
178. {
crypto/srp/srp_lib.c:191:10: Call
189. goto err;
190.
191. if (!BN_mod_exp(tmp, g, x, N, bn_ctx))
^
192. goto err;
193. if ((k = srp_Calc_k(N, g)) == NULL)
crypto/bn/bn_exp.c:89:1: Parameter `m->top`
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:134:9: Call
132.
133. #ifdef MONT_MUL_MOD
134. if (BN_is_odd(m)) {
^
135. # ifdef MONT_EXP_WORD
136. if (a->top == 1 && !a->neg
crypto/bn/bn_lib.c:858:1: Parameter `a->top`
856. }
857.
858. > int BN_is_odd(const BIGNUM *a)
859. {
860. 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:206:13: Call
204. goto err;
205. } else {
206. if (BN_RECP_CTX_set(&recp, m, ctx) <= 0)
^
207. goto err;
208. }
crypto/bn/bn_recp.c:45:1: Parameter `d->top`
43. }
44.
45. > int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx)
46. {
47. if (!BN_copy(&(recp->N), d))
crypto/bn/bn_recp.c:47:10: Call
45. int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx)
46. {
47. if (!BN_copy(&(recp->N), d))
^
48. return 0;
49. BN_zero(&(recp->Nr));
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:939:1: Parameter `*a->d`
937. }
938.
939. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
940. {
941. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `SRP_Calc_client_key`
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/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_lib.c/#L291
|
d2a_code_trace_data_45799
|
int n_ssl3_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending)
{
unsigned char *mac_sec, *seq;
const EVP_MD_CTX *hash;
unsigned char *p, rec_char;
size_t md_size;
size_t npad;
int t;
if (sending) {
mac_sec = &(ssl->s3->write_mac_secret[0]);
seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
hash = ssl->write_hash;
} else {
mac_sec = &(ssl->s3->read_mac_secret[0]);
seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);
hash = ssl->read_hash;
}
t = EVP_MD_CTX_size(hash);
if (t < 0)
return 0;
md_size = t;
npad = (48 / md_size) * md_size;
if (!sending &&
EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
ssl3_cbc_record_digest_supported(hash)) {
unsigned char header[75];
size_t j = 0;
memcpy(header + j, mac_sec, md_size);
j += md_size;
memcpy(header + j, ssl3_pad_1, npad);
j += npad;
memcpy(header + j, seq, 8);
j += 8;
header[j++] = rec->type;
header[j++] = (unsigned char)(rec->length >> 8);
header[j++] = (unsigned char)(rec->length & 0xff);
if (ssl3_cbc_digest_record(hash,
md, &md_size,
header, rec->input,
rec->length + md_size, rec->orig_len,
mac_sec, md_size, 1) <= 0)
return 0;
} else {
unsigned int md_size_u;
EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
if (md_ctx == NULL)
return 0;
rec_char = rec->type;
p = md;
s2n(rec->length, p);
if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
|| EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
|| EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0
|| EVP_DigestUpdate(md_ctx, seq, 8) <= 0
|| EVP_DigestUpdate(md_ctx, &rec_char, 1) <= 0
|| EVP_DigestUpdate(md_ctx, md, 2) <= 0
|| EVP_DigestUpdate(md_ctx, rec->input, rec->length) <= 0
|| EVP_DigestFinal_ex(md_ctx, md, NULL) <= 0
|| EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
|| EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
|| EVP_DigestUpdate(md_ctx, ssl3_pad_2, npad) <= 0
|| EVP_DigestUpdate(md_ctx, md, md_size) <= 0
|| EVP_DigestFinal_ex(md_ctx, md, &md_size_u) <= 0) {
EVP_MD_CTX_reset(md_ctx);
return 0;
}
EVP_MD_CTX_free(md_ctx);
}
ssl3_record_sequence_update(seq);
return 1;
}
ssl/record/ssl3_record.c:1253: error: MEMORY_LEAK
memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 1232, column 30 is not reachable after line 1253, column 13.
Showing all 66 steps of the trace
ssl/record/ssl3_record.c:1168:1: start of procedure n_ssl3_mac()
1166. }
1167.
1168. > int n_ssl3_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending)
1169. {
1170. unsigned char *mac_sec, *seq;
ssl/record/ssl3_record.c:1177:9: Taking true branch
1175. int t;
1176.
1177. if (sending) {
^
1178. mac_sec = &(ssl->s3->write_mac_secret[0]);
1179. seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
ssl/record/ssl3_record.c:1178:9:
1176.
1177. if (sending) {
1178. > mac_sec = &(ssl->s3->write_mac_secret[0]);
1179. seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1180. hash = ssl->write_hash;
ssl/record/ssl3_record.c:1179:9:
1177. if (sending) {
1178. mac_sec = &(ssl->s3->write_mac_secret[0]);
1179. > seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1180. hash = ssl->write_hash;
1181. } else {
ssl/record/ssl3_record.c:1180:9:
1178. mac_sec = &(ssl->s3->write_mac_secret[0]);
1179. seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1180. > hash = ssl->write_hash;
1181. } else {
1182. mac_sec = &(ssl->s3->read_mac_secret[0]);
ssl/record/ssl3_record.c:1187:5:
1185. }
1186.
1187. > t = EVP_MD_CTX_size(hash);
1188. if (t < 0)
1189. return 0;
crypto/evp/evp_lib.c:439:1: start of procedure EVP_MD_CTX_md()
437. }
438.
439. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
440. {
441. if (!ctx)
crypto/evp/evp_lib.c:441:10: Taking false branch
439. const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
440. {
441. if (!ctx)
^
442. return NULL;
443. return ctx->digest;
crypto/evp/evp_lib.c:443:5:
441. if (!ctx)
442. return NULL;
443. > return ctx->digest;
444. }
445.
crypto/evp/evp_lib.c:444:1: return from a call to EVP_MD_CTX_md
442. return NULL;
443. return ctx->digest;
444. > }
445.
446. EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)
crypto/evp/evp_lib.c:301:1: start of procedure EVP_MD_size()
299. }
300.
301. > int EVP_MD_size(const EVP_MD *md)
302. {
303. if (!md) {
crypto/evp/evp_lib.c:303:10: Taking false branch
301. int EVP_MD_size(const EVP_MD *md)
302. {
303. if (!md) {
^
304. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
305. return -1;
crypto/evp/evp_lib.c:307:5:
305. return -1;
306. }
307. > return md->md_size;
308. }
309.
crypto/evp/evp_lib.c:308:1: return from a call to EVP_MD_size
306. }
307. return md->md_size;
308. > }
309.
310. unsigned long EVP_MD_flags(const EVP_MD *md)
ssl/record/ssl3_record.c:1188:9: Taking false branch
1186.
1187. t = EVP_MD_CTX_size(hash);
1188. if (t < 0)
^
1189. return 0;
1190. md_size = t;
ssl/record/ssl3_record.c:1190:5:
1188. if (t < 0)
1189. return 0;
1190. > md_size = t;
1191. npad = (48 / md_size) * md_size;
1192.
ssl/record/ssl3_record.c:1191:5:
1189. return 0;
1190. md_size = t;
1191. > npad = (48 / md_size) * md_size;
1192.
1193. if (!sending &&
ssl/record/ssl3_record.c:1193:10: Taking false branch
1191. npad = (48 / md_size) * md_size;
1192.
1193. if (!sending &&
^
1194. EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
1195. ssl3_cbc_record_digest_supported(hash)) {
ssl/record/ssl3_record.c:1232:9:
1230. unsigned int md_size_u;
1231. /* Chop the digest off the end :-) */
1232. > EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
1233.
1234. if (md_ctx == NULL)
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:218:1: start of procedure CRYPTO_zalloc()
216. }
217.
218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
219. {
220. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:220:5:
218. void *CRYPTO_zalloc(size_t num, const char *file, int line)
219. {
220. > void *ret = CRYPTO_malloc(num, file, line);
221.
222. FAILTEST();
crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
187. #endif
188.
189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
190. {
191. void *ret = NULL;
crypto/mem.c:191:5:
189. void *CRYPTO_malloc(size_t num, const char *file, int line)
190. {
191. > void *ret = NULL;
192.
193. INCREMENT(malloc_count);
crypto/mem.c:194:9: Taking false branch
192.
193. INCREMENT(malloc_count);
194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
195. return malloc_impl(num, file, line);
196.
crypto/mem.c:197:9: Taking false branch
195. return malloc_impl(num, file, line);
196.
197. if (num == 0)
^
198. return NULL;
199.
crypto/mem.c:201:5:
199.
200. FAILTEST();
201. > allow_customize = 0;
202. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
203. if (call_malloc_debug) {
crypto/mem.c:211:5:
209. }
210. #else
211. > (void)(file); (void)(line);
212. ret = malloc(num);
213. #endif
crypto/mem.c:211:19:
209. }
210. #else
211. > (void)(file); (void)(line);
212. ret = malloc(num);
213. #endif
crypto/mem.c:212:5:
210. #else
211. (void)(file); (void)(line);
212. > ret = malloc(num);
213. #endif
214.
crypto/mem.c:215:5:
213. #endif
214.
215. > return ret;
216. }
217.
crypto/mem.c:216:1: return from a call to CRYPTO_malloc
214.
215. return ret;
216. > }
217.
218. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:223:9: Taking true branch
221.
222. FAILTEST();
223. if (ret != NULL)
^
224. memset(ret, 0, num);
225. return ret;
crypto/mem.c:224:9:
222. FAILTEST();
223. if (ret != NULL)
224. > memset(ret, 0, num);
225. return ret;
226. }
crypto/mem.c:225:5:
223. if (ret != NULL)
224. memset(ret, 0, num);
225. > return ret;
226. }
227.
crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
224. memset(ret, 0, num);
225. return ret;
226. > }
227.
228. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. > }
48.
49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
ssl/record/ssl3_record.c:1234:13: Taking false branch
1232. EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
1233.
1234. if (md_ctx == NULL)
^
1235. return 0;
1236.
ssl/record/ssl3_record.c:1237:9:
1235. return 0;
1236.
1237. > rec_char = rec->type;
1238. p = md;
1239. s2n(rec->length, p);
ssl/record/ssl3_record.c:1238:9:
1236.
1237. rec_char = rec->type;
1238. > p = md;
1239. s2n(rec->length, p);
1240. if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
ssl/record/ssl3_record.c:1239:9:
1237. rec_char = rec->type;
1238. p = md;
1239. > s2n(rec->length, p);
1240. if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
1241. || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
ssl/record/ssl3_record.c:1240:13:
1238. p = md;
1239. s2n(rec->length, p);
1240. > if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
1241. || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
1242. || EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0
crypto/evp/digest.c:204:1: start of procedure EVP_MD_CTX_copy_ex()
202. }
203.
204. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
205. {
206. unsigned char *tmp_buf;
crypto/evp/digest.c:207:10: Taking false branch
205. {
206. unsigned char *tmp_buf;
207. if ((in == NULL) || (in->digest == NULL)) {
^
208. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
209. return 0;
crypto/evp/digest.c:207:26: Taking false branch
205. {
206. unsigned char *tmp_buf;
207. if ((in == NULL) || (in->digest == NULL)) {
^
208. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
209. return 0;
crypto/evp/digest.c:213:9: Taking true branch
211. #ifndef OPENSSL_NO_ENGINE
212. /* Make sure it's safe to copy a digest context using an ENGINE */
213. if (in->engine && !ENGINE_init(in->engine)) {
^
214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
215. return 0;
crypto/evp/digest.c:213:24:
211. #ifndef OPENSSL_NO_ENGINE
212. /* Make sure it's safe to copy a digest context using an ENGINE */
213. > if (in->engine && !ENGINE_init(in->engine)) {
214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
215. return 0;
crypto/engine/eng_init.c:77:1: start of procedure ENGINE_init()
75.
76. /* The API (locked) version of "init" */
77. > int ENGINE_init(ENGINE *e)
78. {
79. int ret;
crypto/engine/eng_init.c:80:9: Taking false branch
78. {
79. int ret;
80. if (e == NULL) {
^
81. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);
82. return 0;
crypto/engine/eng_init.c:84:10:
82. return 0;
83. }
84. > if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
86. return 0;
crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
103. }
104.
105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:107:9: Taking true branch
105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
^
108. return 0;
109.
crypto/threads_pthread.c:108:9:
106. {
107. if (pthread_once(once, init) != 0)
108. > return 0;
109.
110. return 1;
crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
109.
110. return 1;
111. > }
112.
113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/engine/eng_init.c:84:10: Condition is false
82. return 0;
83. }
84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
^
85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
86. return 0;
crypto/engine/eng_init.c:84:10: Taking true branch
82. return 0;
83. }
84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
^
85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
86. return 0;
crypto/engine/eng_init.c:85:9: Skipping ERR_put_error(): empty list of specs
83. }
84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
^
86. return 0;
87. }
crypto/engine/eng_init.c:86:9:
84. if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
85. ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
86. > return 0;
87. }
88. CRYPTO_THREAD_write_lock(global_engine_lock);
crypto/engine/eng_init.c:92:1: return from a call to ENGINE_init
90. CRYPTO_THREAD_unlock(global_engine_lock);
91. return ret;
92. > }
93.
94. /* The API (locked) version of "finish" */
crypto/evp/digest.c:213:24: Taking true branch
211. #ifndef OPENSSL_NO_ENGINE
212. /* Make sure it's safe to copy a digest context using an ENGINE */
213. if (in->engine && !ENGINE_init(in->engine)) {
^
214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
215. return 0;
crypto/evp/digest.c:214:9: Skipping ERR_put_error(): empty list of specs
212. /* Make sure it's safe to copy a digest context using an ENGINE */
213. if (in->engine && !ENGINE_init(in->engine)) {
214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
^
215. return 0;
216. }
crypto/evp/digest.c:215:9:
213. if (in->engine && !ENGINE_init(in->engine)) {
214. EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
215. > return 0;
216. }
217. #endif
crypto/evp/digest.c:261:1: return from a call to EVP_MD_CTX_copy_ex
259.
260. return 1;
261. > }
262.
263. int EVP_Digest(const void *data, size_t count,
ssl/record/ssl3_record.c:1240:13: Taking true branch
1238. p = md;
1239. s2n(rec->length, p);
1240. if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
^
1241. || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
1242. || EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0
ssl/record/ssl3_record.c:1253:13: Skipping EVP_MD_CTX_reset(): empty list of specs
1251. || EVP_DigestUpdate(md_ctx, md, md_size) <= 0
1252. || EVP_DigestFinal_ex(md_ctx, md, &md_size_u) <= 0) {
1253. EVP_MD_CTX_reset(md_ctx);
^
1254. return 0;
1255. }
|
https://github.com/openssl/openssl/blob/066904cceef26bbb5c63c237d20829fb0db82ddc/ssl/record/ssl3_record.c/#L1253
|
d2a_code_trace_data_45800
|
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;
if (pkt->buf->length > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE
: pkt->buf->length * 2;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
pkt->written += len;
pkt->curr += len;
return 1;
}
ssl/t1_lib.c:1061: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 18]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 12 steps of the trace
ssl/t1_lib.c:1060:21: Call
1058. /* Sub-packet for servername list (always 1 hostname)*/
1059. || !WPACKET_start_sub_packet_u16(pkt)
1060. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
^
1061. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
1062. strlen(s->tlsext_hostname))
ssl/packet.c:238:1: Parameter `pkt->buf->length`
236. }
237.
238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
239. {
240. unsigned char *data;
ssl/t1_lib.c:1061:21: Call
1059. || !WPACKET_start_sub_packet_u16(pkt)
1060. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
1061. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname,
^
1062. strlen(s->tlsext_hostname))
1063. || !WPACKET_close(pkt)
ssl/packet.c:294:1: Parameter `pkt->written`
292. }
293.
294. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len,
295. size_t lenbytes)
296. {
ssl/packet.c:297:10: Call
295. size_t lenbytes)
296. {
297. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
298. || !WPACKET_memcpy(pkt, src, len)
299. || !WPACKET_close(pkt))
ssl/packet.c:201:1: Parameter `pkt->written`
199. }
200.
201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
202. {
203. WPACKET_SUB *sub;
ssl/packet.c:225:10: Call
223. }
224.
225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
226. return 0;
227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 18]):unsigned64 by call to `WPACKET_sub_memcpy__`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27.
|
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
|
d2a_code_trace_data_45801
|
static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]];
tc[1] = tc0_table[index_a][bS[1]];
tc[2] = tc0_table[index_a][bS[2]];
tc[3] = tc0_table[index_a][bS[3]];
h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);
} else {
h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
}
}
libavcodec/h264_loopfilter.c:275: error: Buffer Overrun L2
Offset: [3, 4] Size: 4 by call to `filter_mb_edgev`.
libavcodec/h264_loopfilter.c:250:39: Assignment
248.
249. if( IS_INTRA(mb_type) ) {
250. static const int16_t bS4[4] = {4,4,4,4};
^
251. static const int16_t bS3[4] = {3,3,3,3};
252. const int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;
libavcodec/h264_loopfilter.c:275:21: Call
273. if(chroma444){
274. if(left_type){
275. filter_mb_edgev( &img_cb[4*0], linesize, bS4, qpc0, h);
^
276. filter_mb_edgev( &img_cr[4*0], linesize, bS4, qpc0, h);
277. }
libavcodec/h264_loopfilter.c:103:1: <Offset trace>
101. };
102.
103. static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h) {
^
104. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
105. const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:103:1: Parameter `*bS`
101. };
102.
103. static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h) {
^
104. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
105. const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:73:1: <Length trace>
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:73:1: Array declaration
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:112:17: Array access: Offset: [3, 4] Size: 4 by call to `filter_mb_edgev`
110. if( bS[0] < 4 ) {
111. int8_t tc[4];
112. tc[0] = tc0_table[index_a][bS[0]];
^
113. tc[1] = tc0_table[index_a][bS[1]];
114. tc[2] = tc0_table[index_a][bS[2]];
|
https://github.com/libav/libav/blob/ecf026f1aa8ffe170b5b8c577cae56a405ebafc8/libavcodec/h264_loopfilter.c/#L112
|
d2a_code_trace_data_45802
|
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:193: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_CTX_start()` at line 189, column 5 is not reachable after line 193, 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 true 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:193:14: Skipping BN_sqr(): empty list of specs
191. goto err;
192. if (a == b) {
193. if (!BN_sqr(t, a, ctx))
^
194. goto err;
195. } else {
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/bn/bn_mod.c/#L193
|
d2a_code_trace_data_45803
|
static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
CONF *conf, char *section)
{
EVP_PKEY *pktmp;
pktmp = X509_get_pubkey(x);
EVP_PKEY_copy_parameters(pktmp,pkey);
EVP_PKEY_save_parameters(pktmp,1);
EVP_PKEY_free(pktmp);
if (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;
if (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
goto err;
if (!X509_set_pubkey(x,pkey)) goto err;
if (clrext)
{
while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
}
if (conf)
{
X509V3_CTX ctx;
X509_set_version(x,2);
X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
X509V3_set_nconf(&ctx, conf);
if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;
}
if (!X509_sign(x,pkey,digest)) goto err;
return 1;
err:
ERR_print_errors(bio_err);
return 0;
}
apps/x509.c:1245: error: NULL_DEREFERENCE
pointer `pktmp` last assigned on line 1244 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1245, column 2.
Showing all 17 steps of the trace
apps/x509.c:1238:1: start of procedure sign()
1236.
1237. /* self sign */
1238. > static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
1239. CONF *conf, char *section)
1240. {
apps/x509.c:1244:2:
1242. EVP_PKEY *pktmp;
1243.
1244. > pktmp = X509_get_pubkey(x);
1245. EVP_PKEY_copy_parameters(pktmp,pkey);
1246. EVP_PKEY_save_parameters(pktmp,1);
crypto/x509/x509_cmp.c:296:1: start of procedure X509_get_pubkey()
294. }
295.
296. > EVP_PKEY *X509_get_pubkey(X509 *x)
297. {
298. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:298:7: Taking false branch
296. EVP_PKEY *X509_get_pubkey(X509 *x)
297. {
298. if ((x == NULL) || (x->cert_info == NULL))
^
299. return(NULL);
300. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:298:22: Taking false branch
296. EVP_PKEY *X509_get_pubkey(X509 *x)
297. {
298. if ((x == NULL) || (x->cert_info == NULL))
^
299. return(NULL);
300. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:300:2:
298. if ((x == NULL) || (x->cert_info == NULL))
299. return(NULL);
300. > return(X509_PUBKEY_get(x->cert_info->key));
301. }
302.
crypto/asn1/x_pubkey.c:133:1: start of procedure X509_PUBKEY_get()
131. }
132.
133. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
134. {
135. EVP_PKEY *ret=NULL;
crypto/asn1/x_pubkey.c:135:2:
133. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
134. {
135. > EVP_PKEY *ret=NULL;
136.
137. if (key == NULL) goto error;
crypto/asn1/x_pubkey.c:137:6: Taking false branch
135. EVP_PKEY *ret=NULL;
136.
137. if (key == NULL) goto error;
^
138.
139. if (key->pkey != NULL)
crypto/asn1/x_pubkey.c:139:6: Taking false branch
137. if (key == NULL) goto error;
138.
139. if (key->pkey != NULL)
^
140. {
141. CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
crypto/asn1/x_pubkey.c:145:6: Taking true branch
143. }
144.
145. if (key->public_key == NULL) goto error;
^
146.
147. if ((ret = EVP_PKEY_new()) == NULL)
crypto/asn1/x_pubkey.c:179:2:
177. return ret;
178.
179. > error:
180. if (ret != NULL)
181. EVP_PKEY_free(ret);
crypto/asn1/x_pubkey.c:180:6: Taking false branch
178.
179. error:
180. if (ret != NULL)
^
181. EVP_PKEY_free(ret);
182. return(NULL);
crypto/asn1/x_pubkey.c:182:2:
180. if (ret != NULL)
181. EVP_PKEY_free(ret);
182. > return(NULL);
183. }
184.
crypto/asn1/x_pubkey.c:183:2: return from a call to X509_PUBKEY_get
181. EVP_PKEY_free(ret);
182. return(NULL);
183. }
^
184.
185. /* Now two pseudo ASN1 routines that take an EVP_PKEY structure
crypto/x509/x509_cmp.c:301:2: return from a call to X509_get_pubkey
299. return(NULL);
300. return(X509_PUBKEY_get(x->cert_info->key));
301. }
^
302.
303. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
apps/x509.c:1245:2:
1243.
1244. pktmp = X509_get_pubkey(x);
1245. > EVP_PKEY_copy_parameters(pktmp,pkey);
1246. EVP_PKEY_save_parameters(pktmp,1);
1247. EVP_PKEY_free(pktmp);
|
https://github.com/openssl/openssl/blob/1b31b5ad560b16e2fe1cad54a755e3e6b5e778a3/apps/x509.c/#L1245
|
d2a_code_trace_data_45804
|
static int parse_icy(HTTPContext *s, const char *tag, const char *p)
{
int len = 4 + strlen(p) + strlen(tag);
int is_first = !s->icy_metadata_headers;
int ret;
if (s->icy_metadata_headers)
len += strlen(s->icy_metadata_headers);
if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
return ret;
if (is_first)
*s->icy_metadata_headers = '\0';
av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
return 0;
}
libavformat/http.c:433: error: Null Dereference
pointer `s->icy_metadata_headers` last assigned on line 427 could be null and is dereferenced by call to `av_strlcatf()` at line 433, column 5.
libavformat/http.c:418:1: start of procedure parse_icy()
416.
417. // Concat all Icy- header lines
418. static int parse_icy(HTTPContext *s, const char *tag, const char *p)
^
419. {
420. int len = 4 + strlen(p) + strlen(tag);
libavformat/http.c:420:5:
418. static int parse_icy(HTTPContext *s, const char *tag, const char *p)
419. {
420. int len = 4 + strlen(p) + strlen(tag);
^
421. int is_first = !s->icy_metadata_headers;
422. int ret;
libavformat/http.c:421:21: Condition is true
419. {
420. int len = 4 + strlen(p) + strlen(tag);
421. int is_first = !s->icy_metadata_headers;
^
422. int ret;
423.
libavformat/http.c:421:20:
419. {
420. int len = 4 + strlen(p) + strlen(tag);
421. int is_first = !s->icy_metadata_headers;
^
422. int ret;
423.
libavformat/http.c:421:5:
419. {
420. int len = 4 + strlen(p) + strlen(tag);
421. int is_first = !s->icy_metadata_headers;
^
422. int ret;
423.
libavformat/http.c:424:9: Taking true branch
422. int ret;
423.
424. if (s->icy_metadata_headers)
^
425. len += strlen(s->icy_metadata_headers);
426.
libavformat/http.c:425:9:
423.
424. if (s->icy_metadata_headers)
425. len += strlen(s->icy_metadata_headers);
^
426.
427. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
libavformat/http.c:427:9:
425. len += strlen(s->icy_metadata_headers);
426.
427. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
^
428. return ret;
429.
libavutil/mem.c:140:1: start of procedure av_reallocp()
138. }
139.
140. int av_reallocp(void *ptr, size_t size)
^
141. {
142. void **ptrptr = ptr;
libavutil/mem.c:142:5:
140. int av_reallocp(void *ptr, size_t size)
141. {
142. void **ptrptr = ptr;
^
143. void *ret;
144.
libavutil/mem.c:145:10: Taking true branch
143. void *ret;
144.
145. if (!size) {
^
146. av_freep(ptr);
147. return 0;
libavutil/mem.c:146:9:
144.
145. if (!size) {
146. av_freep(ptr);
^
147. return 0;
148. }
libavutil/mem.c:198:1: start of procedure av_freep()
196. }
197.
198. void av_freep(void *arg)
^
199. {
200. void **ptr = (void **)arg;
libavutil/mem.c:200:5:
198. void av_freep(void *arg)
199. {
200. void **ptr = (void **)arg;
^
201. av_free(*ptr);
202. *ptr = NULL;
libavutil/mem.c:201:5:
199. {
200. void **ptr = (void **)arg;
201. av_free(*ptr);
^
202. *ptr = NULL;
203. }
libavutil/mem.c:186:1: start of procedure av_free()
184. }
185.
186. void av_free(void *ptr)
^
187. {
188. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:194:5:
192. _aligned_free(ptr);
193. #else
194. free(ptr);
^
195. #endif
196. }
libavutil/mem.c:196:1: return from a call to av_free
194. free(ptr);
195. #endif
196. }
^
197.
198. void av_freep(void *arg)
libavutil/mem.c:202:5:
200. void **ptr = (void **)arg;
201. av_free(*ptr);
202. *ptr = NULL;
^
203. }
204.
libavutil/mem.c:203:1: return from a call to av_freep
201. av_free(*ptr);
202. *ptr = NULL;
203. }
^
204.
205. void *av_mallocz(size_t size)
libavutil/mem.c:147:9:
145. if (!size) {
146. av_freep(ptr);
147. return 0;
^
148. }
149. ret = av_realloc(*ptrptr, size);
libavutil/mem.c:158:1: return from a call to av_reallocp
156. *ptrptr = ret;
157. return 0;
158. }
^
159.
160. void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
libavformat/http.c:427:9: Taking false branch
425. len += strlen(s->icy_metadata_headers);
426.
427. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
^
428. return ret;
429.
libavformat/http.c:430:9: Taking false branch
428. return ret;
429.
430. if (is_first)
^
431. *s->icy_metadata_headers = '\0';
432.
libavformat/http.c:433:5:
431. *s->icy_metadata_headers = '\0';
432.
433. av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
^
434.
435. return 0;
libavutil/avstring.c:99:1: start of procedure av_strlcatf()
97. }
98.
99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
^
100. {
101. int len = strlen(dst);
libavutil/avstring.c:101:5:
99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
100. {
101. int len = strlen(dst);
^
102. va_list vl;
103.
libavutil/avstring.c:104:5:
102. va_list vl;
103.
104. va_start(vl, fmt);
^
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
106. va_end(vl);
libavutil/avstring.c:105:33: Condition is true
103.
104. va_start(vl, fmt);
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
^
106. va_end(vl);
107.
libavutil/avstring.c:105:5:
103.
104. va_start(vl, fmt);
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
^
106. va_end(vl);
107.
libavutil/avstring.c:106:5:
104. va_start(vl, fmt);
105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
106. va_end(vl);
^
107.
108. return len;
libavutil/avstring.c:108:5:
106. va_end(vl);
107.
108. return len;
^
109. }
110.
libavutil/avstring.c:109:1: return from a call to av_strlcatf
107.
108. return len;
109. }
^
110.
111. char *av_d2str(double d)
|
https://github.com/libav/libav/blob/6a463e7fb4f028c52d2e2d054f9483f4fff492bc/libavformat/http.c/#L433
|
d2a_code_trace_data_45805
|
void CRYPTO_free(void *str, const char *file, int line)
{
if (free_impl != NULL && free_impl != &CRYPTO_free) {
free_impl(str, file, line);
return;
}
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0, file, line);
free(str);
CRYPTO_mem_debug_free(str, 1, file, line);
} else {
free(str);
}
#else
free(str);
#endif
}
ssl/t1_ext.c:183: error: USE_AFTER_FREE
call to `CRYPTO_free()` eventually accesses memory that was invalidated by call to `free()` on line 179 indirectly during the call to `CRYPTO_realloc()`.
Showing all 12 steps of the trace
ssl/t1_ext.c:152:1: invalidation part of the trace starts here
150.
151. /* Set callbacks for a custom extension. */
152. > static int custom_ext_meth_add(custom_ext_methods *exts,
153. unsigned int ext_type,
154. custom_ext_add_cb add_cb,
ssl/t1_ext.c:152:1: parameter `exts` of custom_ext_meth_add
150.
151. /* Set callbacks for a custom extension. */
152. > static int custom_ext_meth_add(custom_ext_methods *exts,
153. unsigned int ext_type,
154. custom_ext_add_cb add_cb,
ssl/t1_ext.c:179:11: when calling `CRYPTO_realloc` here
177. if (custom_ext_find(exts, ext_type))
178. return 0;
179. tmp = OPENSSL_realloc(exts->meths,
^
180. (exts->meths_count + 1) * sizeof(custom_ext_method));
181.
crypto/mem.c:107:1: parameter `str` of CRYPTO_realloc
105. }
106.
107. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
108. {
109. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
crypto/mem.c:116:9: when calling `CRYPTO_free` here
114.
115. if (num == 0) {
116. CRYPTO_free(str, file, line);
^
117. return NULL;
118. }
crypto/mem.c:163:1: parameter `str` of 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:179:5: was invalidated by call to `free()`
177. }
178. #else
179. free(str);
^
180. #endif
181. }
ssl/t1_ext.c:152:1: use-after-lifetime part of the trace starts here
150.
151. /* Set callbacks for a custom extension. */
152. > static int custom_ext_meth_add(custom_ext_methods *exts,
153. unsigned int ext_type,
154. custom_ext_add_cb add_cb,
ssl/t1_ext.c:152:1: parameter `exts` of custom_ext_meth_add
150.
151. /* Set callbacks for a custom extension. */
152. > static int custom_ext_meth_add(custom_ext_methods *exts,
153. unsigned int ext_type,
154. custom_ext_add_cb add_cb,
ssl/t1_ext.c:183:9: when calling `CRYPTO_free` here
181.
182. if (tmp == NULL) {
183. OPENSSL_free(exts->meths);
^
184. exts->meths = NULL;
185. exts->meths_count = 0;
crypto/mem.c:163:1: parameter `str` of 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:179:5: invalid access occurs here
177. }
178. #else
179. free(str);
^
180. #endif
181. }
|
https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/crypto/mem.c/#L179
|
d2a_code_trace_data_45806
|
static int http_parse_request(HTTPContext *c)
{
char *p;
enum RedirType redir_type;
char cmd[32];
char info[1024], filename[1024];
char url[1024], *q;
char protocol[32];
char msg[1024];
const char *mime_type;
FFStream *stream;
int i;
char ratebuf[32];
char *useragent = 0;
p = c->buffer;
get_word(cmd, sizeof(cmd), (const char **)&p);
av_strlcpy(c->method, cmd, sizeof(c->method));
if (!strcmp(cmd, "GET"))
c->post = 0;
else if (!strcmp(cmd, "POST"))
c->post = 1;
else
return -1;
get_word(url, sizeof(url), (const char **)&p);
av_strlcpy(c->url, url, sizeof(c->url));
get_word(protocol, sizeof(protocol), (const char **)&p);
if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1"))
return -1;
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
if (ffserver_debug)
http_log("New connection: %s %s\n", cmd, url);
p = strchr(url, '?');
if (p) {
av_strlcpy(info, p, sizeof(info));
*p = '\0';
} else
info[0] = '\0';
av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "User-Agent:", 11) == 0) {
useragent = p + 11;
if (*useragent && *useragent != '\n' && isspace(*useragent))
useragent++;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
redir_type = REDIR_NONE;
if (match_ext(filename, "asx")) {
redir_type = REDIR_ASX;
filename[strlen(filename)-1] = 'f';
} else if (match_ext(filename, "asf") &&
(!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {
redir_type = REDIR_ASF;
} else if (match_ext(filename, "rpm,ram")) {
redir_type = REDIR_RAM;
strcpy(filename + strlen(filename)-2, "m");
} else if (match_ext(filename, "rtsp")) {
redir_type = REDIR_RTSP;
compute_real_filename(filename, sizeof(filename) - 1);
} else if (match_ext(filename, "sdp")) {
redir_type = REDIR_SDP;
compute_real_filename(filename, sizeof(filename) - 1);
}
if (!strlen(filename))
av_strlcpy(filename, "index.html", sizeof(filename) - 1);
stream = first_stream;
while (stream != NULL) {
if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
break;
stream = stream->next;
}
if (stream == NULL) {
snprintf(msg, sizeof(msg), "File '%s' not found", url);
goto send_error;
}
c->stream = stream;
memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams));
memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams));
if (stream->stream_type == STREAM_TYPE_REDIRECT) {
c->http_error = 301;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 301 Moved\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Location: %s\r\n", stream->feed_filename);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Moved</title></head><body>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "You should be <a href=\"%s\">redirected</a>.\r\n", stream->feed_filename);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
if (modify_current_stream(c, ratebuf)) {
for (i = 0; i < sizeof(c->feed_streams) / sizeof(c->feed_streams[0]); i++) {
if (c->switch_feed_streams[i] >= 0)
do_switch_stream(c, i);
}
}
}
if (stream->feed_opened) {
snprintf(msg, sizeof(msg), "This feed is already being received.");
goto send_error;
}
if (c->post == 0 && stream->stream_type == STREAM_TYPE_LIVE)
current_bandwidth += stream->bandwidth;
if (c->post == 0 && max_bandwidth < current_bandwidth) {
c->http_error = 200;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 Server too busy\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Too busy</title></head><body>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<p>The server is too busy to serve your request at this time.</p>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<p>The bandwidth being served (including your stream) is %dkbit/sec, and this exceeds the limit of %dkbit/sec.</p>\r\n",
current_bandwidth, max_bandwidth);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (redir_type != REDIR_NONE) {
char *hostinfo = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "Host:", 5) == 0) {
hostinfo = p + 5;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (hostinfo) {
char *eoh;
char hostbuf[260];
while (isspace(*hostinfo))
hostinfo++;
eoh = strchr(hostinfo, '\n');
if (eoh) {
if (eoh[-1] == '\r')
eoh--;
if (eoh - hostinfo < sizeof(hostbuf) - 1) {
memcpy(hostbuf, hostinfo, eoh - hostinfo);
hostbuf[eoh - hostinfo] = 0;
c->http_error = 200;
q = c->buffer;
switch(redir_type) {
case REDIR_ASX:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASX Follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ASX Version=\"3\">\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ENTRY><REF HREF=\"http://%s/%s%s\"/></ENTRY>\r\n",
hostbuf, filename, info);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</ASX>\r\n");
break;
case REDIR_RAM:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RAM Follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: audio/x-pn-realaudio\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "# Autogenerated by ffserver\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "http://%s/%s%s\r\n",
hostbuf, filename, info);
break;
case REDIR_ASF:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASF Redirect follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "[Reference]\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Ref1=http://%s/%s%s\r\n",
hostbuf, filename, info);
break;
case REDIR_RTSP:
{
char hostname[256], *p;
av_strlcpy(hostname, hostbuf, sizeof(hostname));
p = strrchr(hostname, ':');
if (p)
*p = '\0';
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RTSP Redirect follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/x-rtsp\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "rtsp://%s:%d/%s\r\n",
hostname, ntohs(my_rtsp_addr.sin_port),
filename);
}
break;
case REDIR_SDP:
{
uint8_t *sdp_data;
int sdp_data_size, len;
struct sockaddr_in my_addr;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/sdp\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
len = sizeof(my_addr);
getsockname(c->fd, (struct sockaddr *)&my_addr, &len);
sdp_data_size = prepare_sdp_description(stream,
&sdp_data,
my_addr.sin_addr);
if (sdp_data_size > 0) {
memcpy(q, sdp_data, sdp_data_size);
q += sdp_data_size;
*q = '\0';
av_free(sdp_data);
}
}
break;
default:
abort();
break;
}
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
}
}
snprintf(msg, sizeof(msg), "ASX/RAM file not handled");
goto send_error;
}
stream->conns_served++;
if (c->post) {
if (!stream->is_feed) {
char *logline = 0;
int client_id = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "Pragma: log-line=", 17) == 0) {
logline = p;
break;
}
if (strncasecmp(p, "Pragma: client-id=", 18) == 0)
client_id = strtol(p + 18, 0, 10);
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (logline) {
char *eol = strchr(logline, '\n');
logline += 17;
if (eol) {
if (eol[-1] == '\r')
eol--;
http_log("%.*s\n", (int) (eol - logline), logline);
c->suppress_log = 1;
}
}
#ifdef DEBUG_WMP
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (client_id && extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
HTTPContext *wmpc;
for (wmpc = first_http_ctx; wmpc; wmpc = wmpc->next) {
if (wmpc->wmp_client_id == client_id)
break;
}
if (wmpc && modify_current_stream(wmpc, ratebuf))
wmpc->switch_pending = 1;
}
snprintf(msg, sizeof(msg), "POST command not handled");
c->stream = 0;
goto send_error;
}
if (http_start_receive_data(c) < 0) {
snprintf(msg, sizeof(msg), "could not open feed");
goto send_error;
}
c->http_error = 0;
c->state = HTTPSTATE_RECEIVE_DATA;
return 0;
}
#ifdef DEBUG_WMP
if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (c->stream->stream_type == STREAM_TYPE_STATUS)
goto send_stats;
if (open_input_stream(c, info) < 0) {
snprintf(msg, sizeof(msg), "Input stream corresponding to '%s' not found", url);
goto send_error;
}
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
mime_type = c->stream->fmt->mime_type;
if (!mime_type)
mime_type = "application/x-octet-stream";
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Pragma: no-cache\r\n");
if (!strcmp(c->stream->fmt->name,"asf_stream")) {
c->wmp_client_id = av_random(&random_state) & 0x7fffffff;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id);
}
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-Type: %s\r\n", mime_type);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
c->http_error = 0;
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_error:
c->http_error = 404;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 404 Not Found\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: %s\r\n", "text/html");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HTML>\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HEAD><TITLE>404 Not Found</TITLE></HEAD>\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<BODY>%s</BODY>\n", msg);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</HTML>\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_stats:
compute_stats(c);
c->http_error = 200;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
ffserver.c:1239: error: Buffer Overrun L3
Offset: [-1, +oo] Size: 1024.
ffserver.c:1174:1: <Offset trace>
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1174:1: Array declaration
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1220:5: Call
1218. info[0] = '\0';
1219.
1220. av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
^
1221.
1222. for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
libavutil/string.c:50:1: Parameter `*dst`
48. }
49.
50. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
51. {
52. size_t len = 0;
ffserver.c:1174:1: <Length trace>
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1174:1: Array declaration
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1239:9: Array access: Offset: [-1, +oo] Size: 1024
1237. if (match_ext(filename, "asx")) {
1238. redir_type = REDIR_ASX;
1239. filename[strlen(filename)-1] = 'f';
^
1240. } else if (match_ext(filename, "asf") &&
1241. (!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L1239
|
d2a_code_trace_data_45807
|
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:307: error: INTEGER_OVERFLOW_L2
(16 - [1, 56+max(1, `ctx->cipher_data->num`)]):unsigned64 by call to `Poly1305_Update`.
Showing all 6 steps of the trace
crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `ctx->cipher_data->num`
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:307:13: Call
305.
306. if (is_endian.little) {
307. Poly1305_Update(POLY1305_ctx(actx),
^
308. (unsigned char *)&actx->len, POLY1305_BLOCK_SIZE);
309. } else {
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 `ctx->num`
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:479:10: Assignment
477. size_t rem, num;
478.
479. if ((num = ctx->num)) {
^
480. rem = POLY1305_BLOCK_SIZE - num;
481. if (len >= rem) {
crypto/poly1305/poly1305.c:480:9: Binary operation: (16 - [1, 56+max(1, ctx->cipher_data->num)]):unsigned64 by call to `Poly1305_Update`
478.
479. if ((num = ctx->num)) {
480. rem = POLY1305_BLOCK_SIZE - num;
^
481. if (len >= rem) {
482. memcpy(ctx->data + num, inp, rem);
|
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L480
|
d2a_code_trace_data_45808
|
ngx_int_t
ngx_http_script_compile(ngx_http_script_compile_t *sc)
{
u_char ch;
ngx_str_t name;
ngx_uint_t i, bracket;
if (ngx_http_script_init_arrays(sc) != NGX_OK) {
return NGX_ERROR;
}
for (i = 0; i < sc->source->len; ) {
name.len = 0;
if (sc->source->data[i] == '$') {
if (++i == sc->source->len) {
goto invalid_variable;
}
#if (NGX_PCRE)
{
ngx_uint_t n;
if (sc->source->data[i] >= '1' && sc->source->data[i] <= '9') {
n = sc->source->data[i] - '0';
if (sc->captures_mask & (1 << n)) {
sc->dup_capture = 1;
}
sc->captures_mask |= 1 << n;
if (ngx_http_script_add_capture_code(sc, n) != NGX_OK) {
return NGX_ERROR;
}
i++;
continue;
}
}
#endif
if (sc->source->data[i] == '{') {
bracket = 1;
if (++i == sc->source->len) {
goto invalid_variable;
}
name.data = &sc->source->data[i];
} else {
bracket = 0;
name.data = &sc->source->data[i];
}
for ( ; i < sc->source->len; i++, name.len++) {
ch = sc->source->data[i];
if (ch == '}' && bracket) {
i++;
bracket = 0;
break;
}
if ((ch >= 'A' && ch <= 'Z')
|| (ch >= 'a' && ch <= 'z')
|| (ch >= '0' && ch <= '9')
|| ch == '_')
{
continue;
}
break;
}
if (bracket) {
ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0,
"the closing bracket in \"%V\" "
"variable is missing", &name);
return NGX_ERROR;
}
if (name.len == 0) {
goto invalid_variable;
}
sc->variables++;
if (ngx_http_script_add_var_code(sc, &name) != NGX_OK) {
return NGX_ERROR;
}
continue;
}
if (sc->source->data[i] == '?' && sc->compile_args) {
sc->args = 1;
sc->compile_args = 0;
if (ngx_http_script_add_args_code(sc) != NGX_OK) {
return NGX_ERROR;
}
i++;
continue;
}
name.data = &sc->source->data[i];
while (i < sc->source->len) {
if (sc->source->data[i] == '$') {
break;
}
if (sc->source->data[i] == '?') {
sc->args = 1;
if (sc->compile_args) {
break;
}
}
i++;
name.len++;
}
sc->size += name.len;
if (ngx_http_script_add_copy_code(sc, &name, (i == sc->source->len))
!= NGX_OK)
{
return NGX_ERROR;
}
}
return ngx_http_script_done(sc);
invalid_variable:
ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0, "invalid variable name");
return NGX_ERROR;
}
src/http/modules/ngx_http_map_module.c:466: error: Buffer Overrun L3
Offset: [2, +oo] Size: [1, +oo] by call to `ngx_http_compile_complex_value`.
src/http/modules/ngx_http_map_module.c:409:10: Assignment
407. key = 0;
408.
409. for (i = 0; i < value[1].len; i++) {
^
410. key = ngx_hash(key, value[1].data[i]);
411. }
src/http/modules/ngx_http_map_module.c:455:14: Call
453.
454. v.len = value[1].len;
455. v.data = ngx_pstrdup(ctx->keys.pool, &value[1]);
^
456. if (v.data == NULL) {
457. return NGX_CONF_ERROR;
src/core/ngx_string.c:63:9: Assignment
61. dst = ngx_pnalloc(pool, src->len);
62. if (dst == NULL) {
63. return NULL;
^
64. }
65.
src/http/modules/ngx_http_map_module.c:455:5: Assignment
453.
454. v.len = value[1].len;
455. v.data = ngx_pstrdup(ctx->keys.pool, &value[1]);
^
456. if (v.data == NULL) {
457. return NGX_CONF_ERROR;
src/http/modules/ngx_http_map_module.c:466:9: Call
464. ccv.complex_value = &cv;
465.
466. if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
^
467. return NGX_CONF_ERROR;
468. }
src/http/ngx_http_script.c:107:1: Parameter `*ccv->value->data`
105.
106.
107. ngx_int_t
^
108. ngx_http_compile_complex_value(ngx_http_compile_complex_value_t *ccv)
109. {
src/http/ngx_http_script.c:195:9: Call
193. sc.root_prefix = ccv->root_prefix;
194.
195. if (ngx_http_script_compile(&sc) != NGX_OK) {
^
196. return NGX_ERROR;
197. }
src/http/ngx_http_script.c:332:1: <Offset trace>
330.
331.
332. ngx_int_t
^
333. ngx_http_script_compile(ngx_http_script_compile_t *sc)
334. {
src/http/ngx_http_script.c:332:1: Parameter `sc->source->len`
330.
331.
332. ngx_int_t
^
333. ngx_http_script_compile(ngx_http_script_compile_t *sc)
334. {
src/http/ngx_http_script.c:332:1: <Length trace>
330.
331.
332. ngx_int_t
^
333. ngx_http_script_compile(ngx_http_script_compile_t *sc)
334. {
src/http/ngx_http_script.c:332:1: Parameter `*sc->source->data`
330.
331.
332. ngx_int_t
^
333. ngx_http_script_compile(ngx_http_script_compile_t *sc)
334. {
src/http/ngx_http_script.c:385:17: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `ngx_http_compile_complex_value`
383. }
384.
385. name.data = &sc->source->data[i];
^
386.
387. } else {
|
https://github.com/nginx/nginx/blob/cbf6ca98bc3f839ab3519ac45807c3c8ae6deb84/src/http/ngx_http_script.c/#L385
|
d2a_code_trace_data_45809
|
static int mp_decode_layer2(MPADecodeContext *s)
{
int sblimit;
const unsigned char *alloc_table;
int table, bit_alloc_bits, i, j, ch, bound, v;
unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];
unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT];
unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3], *sf;
int scale, qindex, bits, steps, k, l, m, b;
table = ff_mpa_l2_select_table(s->bit_rate / 1000, s->nb_channels,
s->sample_rate, s->lsf);
sblimit = ff_mpa_sblimit_table[table];
alloc_table = ff_mpa_alloc_tables[table];
if (s->mode == MPA_JSTEREO)
bound = (s->mode_ext + 1) * 4;
else
bound = sblimit;
dprintf(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit);
if( bound > sblimit ) bound = sblimit;
j = 0;
for(i=0;i<bound;i++) {
bit_alloc_bits = alloc_table[j];
for(ch=0;ch<s->nb_channels;ch++) {
bit_alloc[ch][i] = get_bits(&s->gb, bit_alloc_bits);
}
j += 1 << bit_alloc_bits;
}
for(i=bound;i<sblimit;i++) {
bit_alloc_bits = alloc_table[j];
v = get_bits(&s->gb, bit_alloc_bits);
bit_alloc[0][i] = v;
bit_alloc[1][i] = v;
j += 1 << bit_alloc_bits;
}
#ifdef DEBUG
{
for(ch=0;ch<s->nb_channels;ch++) {
for(i=0;i<sblimit;i++)
dprintf(s->avctx, " %d", bit_alloc[ch][i]);
dprintf(s->avctx, "\n");
}
}
#endif
for(i=0;i<sblimit;i++) {
for(ch=0;ch<s->nb_channels;ch++) {
if (bit_alloc[ch][i])
scale_code[ch][i] = get_bits(&s->gb, 2);
}
}
for(i=0;i<sblimit;i++) {
for(ch=0;ch<s->nb_channels;ch++) {
if (bit_alloc[ch][i]) {
sf = scale_factors[ch][i];
switch(scale_code[ch][i]) {
default:
case 0:
sf[0] = get_bits(&s->gb, 6);
sf[1] = get_bits(&s->gb, 6);
sf[2] = get_bits(&s->gb, 6);
break;
case 2:
sf[0] = get_bits(&s->gb, 6);
sf[1] = sf[0];
sf[2] = sf[0];
break;
case 1:
sf[0] = get_bits(&s->gb, 6);
sf[2] = get_bits(&s->gb, 6);
sf[1] = sf[0];
break;
case 3:
sf[0] = get_bits(&s->gb, 6);
sf[2] = get_bits(&s->gb, 6);
sf[1] = sf[2];
break;
}
}
}
}
#ifdef DEBUG
for(ch=0;ch<s->nb_channels;ch++) {
for(i=0;i<sblimit;i++) {
if (bit_alloc[ch][i]) {
sf = scale_factors[ch][i];
dprintf(s->avctx, " %d %d %d", sf[0], sf[1], sf[2]);
} else {
dprintf(s->avctx, " -");
}
}
dprintf(s->avctx, "\n");
}
#endif
for(k=0;k<3;k++) {
for(l=0;l<12;l+=3) {
j = 0;
for(i=0;i<bound;i++) {
bit_alloc_bits = alloc_table[j];
for(ch=0;ch<s->nb_channels;ch++) {
b = bit_alloc[ch][i];
if (b) {
scale = scale_factors[ch][i][k];
qindex = alloc_table[j+b];
bits = ff_mpa_quant_bits[qindex];
if (bits < 0) {
v = get_bits(&s->gb, -bits);
steps = ff_mpa_quant_steps[qindex];
s->sb_samples[ch][k * 12 + l + 0][i] =
l2_unscale_group(steps, v % steps, scale);
v = v / steps;
s->sb_samples[ch][k * 12 + l + 1][i] =
l2_unscale_group(steps, v % steps, scale);
v = v / steps;
s->sb_samples[ch][k * 12 + l + 2][i] =
l2_unscale_group(steps, v, scale);
} else {
for(m=0;m<3;m++) {
v = get_bits(&s->gb, bits);
v = l1_unscale(bits - 1, v, scale);
s->sb_samples[ch][k * 12 + l + m][i] = v;
}
}
} else {
s->sb_samples[ch][k * 12 + l + 0][i] = 0;
s->sb_samples[ch][k * 12 + l + 1][i] = 0;
s->sb_samples[ch][k * 12 + l + 2][i] = 0;
}
}
j += 1 << bit_alloc_bits;
}
for(i=bound;i<sblimit;i++) {
bit_alloc_bits = alloc_table[j];
b = bit_alloc[0][i];
if (b) {
int mant, scale0, scale1;
scale0 = scale_factors[0][i][k];
scale1 = scale_factors[1][i][k];
qindex = alloc_table[j+b];
bits = ff_mpa_quant_bits[qindex];
if (bits < 0) {
v = get_bits(&s->gb, -bits);
steps = ff_mpa_quant_steps[qindex];
mant = v % steps;
v = v / steps;
s->sb_samples[0][k * 12 + l + 0][i] =
l2_unscale_group(steps, mant, scale0);
s->sb_samples[1][k * 12 + l + 0][i] =
l2_unscale_group(steps, mant, scale1);
mant = v % steps;
v = v / steps;
s->sb_samples[0][k * 12 + l + 1][i] =
l2_unscale_group(steps, mant, scale0);
s->sb_samples[1][k * 12 + l + 1][i] =
l2_unscale_group(steps, mant, scale1);
s->sb_samples[0][k * 12 + l + 2][i] =
l2_unscale_group(steps, v, scale0);
s->sb_samples[1][k * 12 + l + 2][i] =
l2_unscale_group(steps, v, scale1);
} else {
for(m=0;m<3;m++) {
mant = get_bits(&s->gb, bits);
s->sb_samples[0][k * 12 + l + m][i] =
l1_unscale(bits - 1, mant, scale0);
s->sb_samples[1][k * 12 + l + m][i] =
l1_unscale(bits - 1, mant, scale1);
}
}
} else {
s->sb_samples[0][k * 12 + l + 0][i] = 0;
s->sb_samples[0][k * 12 + l + 1][i] = 0;
s->sb_samples[0][k * 12 + l + 2][i] = 0;
s->sb_samples[1][k * 12 + l + 0][i] = 0;
s->sb_samples[1][k * 12 + l + 1][i] = 0;
s->sb_samples[1][k * 12 + l + 2][i] = 0;
}
j += 1 << bit_alloc_bits;
}
for(i=sblimit;i<SBLIMIT;i++) {
for(ch=0;ch<s->nb_channels;ch++) {
s->sb_samples[ch][k * 12 + l + 0][i] = 0;
s->sb_samples[ch][k * 12 + l + 1][i] = 0;
s->sb_samples[ch][k * 12 + l + 2][i] = 0;
}
}
}
}
return 3 * 12;
}
libavcodec/mpegaudiodec.c:1324: error: Buffer Overrun L2
Offset: [0, 37] Size: 36.
libavcodec/mpegaudiodec.c:1297:9: <Offset trace>
1295.
1296. /* samples */
1297. for(k=0;k<3;k++) {
^
1298. for(l=0;l<12;l+=3) {
1299. j = 0;
libavcodec/mpegaudiodec.c:1297:9: Assignment
1295.
1296. /* samples */
1297. for(k=0;k<3;k++) {
^
1298. for(l=0;l<12;l+=3) {
1299. j = 0;
libavcodec/mpegaudiodec.c:1189:1: <Length trace>
1187. }
1188.
1189. static int mp_decode_layer2(MPADecodeContext *s)
^
1190. {
1191. int sblimit; /* number of used subbands */
libavcodec/mpegaudiodec.c:1189:1: Parameter `s->sb_samples[*][*]`
1187. }
1188.
1189. static int mp_decode_layer2(MPADecodeContext *s)
^
1190. {
1191. int sblimit; /* number of used subbands */
libavcodec/mpegaudiodec.c:1324:33: Array access: Offset: [0, 37] Size: 36
1322. v = get_bits(&s->gb, bits);
1323. v = l1_unscale(bits - 1, v, scale);
1324. s->sb_samples[ch][k * 12 + l + m][i] = v;
^
1325. }
1326. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L1324
|
d2a_code_trace_data_45810
|
static void vc1_decode_b_mb(VC1Context *v)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int cbp = 0;
int mqdiff, mquant;
int ttmb = v->ttfrm;
static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },
offset_table[6] = { 0, 1, 3, 7, 15, 31 };
int mb_has_coeffs = 0;
int index, index1;
int val, sign;
int first_block = 1;
int dst_idx, off;
int skipped, direct;
int dmv_x[2], dmv_y[2];
int bmvtype = BMV_TYPE_BACKWARD;
mquant = v->pq;
s->mb_intra = 0;
if (v->dmb_is_raw)
direct = get_bits1(gb);
else
direct = v->direct_mb_plane[mb_pos];
if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
s->dsp.clear_blocks(s->block[0]);
dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0;
for(i = 0; i < 6; i++) {
v->mb_type[0][s->block_index[i]] = 0;
s->dc_val[0][s->block_index[i]] = 0;
}
s->current_picture.qscale_table[mb_pos] = 0;
if (!direct) {
if (!skipped) {
GET_MVDATA(dmv_x[0], dmv_y[0]);
dmv_x[1] = dmv_x[0];
dmv_y[1] = dmv_y[0];
}
if(skipped || !s->mb_intra) {
bmvtype = decode012(gb);
switch(bmvtype) {
case 0:
bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
break;
case 1:
bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
break;
case 2:
bmvtype = BMV_TYPE_INTERPOLATED;
dmv_x[0] = dmv_y[0] = 0;
}
}
}
for(i = 0; i < 6; i++)
v->mb_type[0][s->block_index[i]] = s->mb_intra;
if (skipped) {
if(direct) bmvtype = BMV_TYPE_INTERPOLATED;
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return;
}
if (direct) {
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
s->mb_intra = 0;
mb_has_coeffs = 0;
s->current_picture.qscale_table[mb_pos] = mquant;
if(!v->ttmbf)
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0;
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
} else {
if(!mb_has_coeffs && !s->mb_intra) {
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return;
}
if(s->mb_intra && !mb_has_coeffs) {
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
s->ac_pred = get_bits1(gb);
cbp = 0;
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
} else {
if(bmvtype == BMV_TYPE_INTERPOLATED) {
GET_MVDATA(dmv_x[0], dmv_y[0]);
if(!mb_has_coeffs) {
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return;
}
}
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
if(!s->mb_intra) {
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
}
if(s->mb_intra)
s->ac_pred = get_bits1(gb);
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
if(!v->ttmbf && !s->mb_intra && mb_has_coeffs)
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
}
}
dst_idx = 0;
for (i=0; i<6; i++)
{
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
if(s->mb_intra) {
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || !s->first_slice_line)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
s->dsp.vc1_inv_trans_8x8(s->block[i]);
if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
} else if(val) {
vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY));
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
}
}
}
libavcodec/vc1.c:3373: error: Buffer Overrun L2
Offset: [0, 63] Size: 2.
libavcodec/vc1.c:3373:36: <Offset trace>
3371. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
3372. s->dsp.vc1_inv_trans_8x8(s->block[i]);
3373. if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
^
3374. s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
3375. } else if(val) {
libavcodec/vc1.c:3373:36: Assignment
3371. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
3372. s->dsp.vc1_inv_trans_8x8(s->block[i]);
3373. if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
^
3374. s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
3375. } else if(val) {
libavcodec/vc1.c:3370:13: <Length trace>
3368. v->c_avail = v->mb_type[0][s->block_index[i] - 1];
3369.
3370. vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
^
3371. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
3372. s->dsp.vc1_inv_trans_8x8(s->block[i]);
libavcodec/vc1.c:3370:13: Call
3368. v->c_avail = v->mb_type[0][s->block_index[i] - 1];
3369.
3370. vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
^
3371. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
3372. s->dsp.vc1_inv_trans_8x8(s->block[i]);
libavcodec/vc1.c:2693:1: Parameter `*block`
2691. * @param codingset set of VLC to decode data
2692. */
2693. static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset)
^
2694. {
2695. GetBitContext *gb = &v->s.gb;
libavcodec/vc1.c:3373:56: Array access: Offset: [0, 63] Size: 2
3371. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
3372. s->dsp.vc1_inv_trans_8x8(s->block[i]);
3373. if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
^
3374. s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
3375. } else if(val) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3373
|
d2a_code_trace_data_45811
|
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, i, type, size, pts, flags, is_audio, next, pos;
AVStream *st = NULL;
for(;;){
pos = url_ftell(s->pb);
url_fskip(s->pb, 4);
type = get_byte(s->pb);
size = get_be24(s->pb);
pts = get_be24(s->pb);
pts |= get_byte(s->pb) << 24;
if (url_feof(s->pb))
return AVERROR(EIO);
url_fskip(s->pb, 3);
flags = 0;
if(size == 0)
continue;
next= size + url_ftell(s->pb);
if (type == FLV_TAG_TYPE_AUDIO) {
is_audio=1;
flags = get_byte(s->pb);
} else if (type == FLV_TAG_TYPE_VIDEO) {
is_audio=0;
flags = get_byte(s->pb);
} else {
if (type == FLV_TAG_TYPE_META && size > 13+1+4)
flv_read_metabody(s, next);
else
av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
url_fseek(s->pb, next, SEEK_SET);
continue;
}
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->id == is_audio)
break;
}
if(i == s->nb_streams){
av_log(NULL, AV_LOG_ERROR, "invalid stream\n");
st= create_stream(s, is_audio);
}
if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio))
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
|| st->discard >= AVDISCARD_ALL
){
url_fseek(s->pb, next, SEEK_SET);
continue;
}
if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
av_add_index_entry(st, pos, pts, size, 0, AVINDEX_KEYFRAME);
break;
}
if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){
int size;
const int pos= url_ftell(s->pb);
const int fsize= url_fsize(s->pb);
url_fseek(s->pb, fsize-4, SEEK_SET);
size= get_be32(s->pb);
url_fseek(s->pb, fsize-3-size, SEEK_SET);
if(size == get_be24(s->pb) + 11){
s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000;
}
url_fseek(s->pb, pos, SEEK_SET);
}
if(is_audio){
if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
if((flags & FLV_AUDIO_CODECID_MASK) == FLV_CODECID_NELLYMOSER_8HZ_MONO)
st->codec->sample_rate= 8000;
else
st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
}
}else{
size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
}
ret= av_get_packet(s->pb, pkt, size - 1);
if (ret <= 0) {
return AVERROR(EIO);
}
pkt->size = ret;
pkt->pts = pts;
pkt->stream_index = st->index;
if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY))
pkt->flags |= PKT_FLAG_KEY;
return ret;
}
libavformat/flvdec.c:352: error: Uninitialized Value
The value read from is_audio was never initialized.
libavformat/flvdec.c:352:8:
350. }
351.
352. if(is_audio){
^
353. if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
354. st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvdec.c/#L352
|
d2a_code_trace_data_45812
|
static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
{
dynamic_data_ctx *ctx = dynamic_get_data_ctx(e);
int initialised;
if (!ctx) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_NOT_LOADED);
return 0;
}
initialised = ((ctx->dynamic_dso == NULL) ? 0 : 1);
if (initialised) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_ALREADY_LOADED);
return 0;
}
switch (cmd) {
case DYNAMIC_CMD_SO_PATH:
if (p && (strlen((const char *)p) < 1))
p = NULL;
OPENSSL_free(ctx->DYNAMIC_LIBNAME);
if (p)
ctx->DYNAMIC_LIBNAME = OPENSSL_strdup(p);
else
ctx->DYNAMIC_LIBNAME = NULL;
return (ctx->DYNAMIC_LIBNAME ? 1 : 0);
case DYNAMIC_CMD_NO_VCHECK:
ctx->no_vcheck = ((i == 0) ? 0 : 1);
return 1;
case DYNAMIC_CMD_ID:
if (p && (strlen((const char *)p) < 1))
p = NULL;
OPENSSL_free(ctx->engine_id);
if (p)
ctx->engine_id = OPENSSL_strdup(p);
else
ctx->engine_id = NULL;
return (ctx->engine_id ? 1 : 0);
case DYNAMIC_CMD_LIST_ADD:
if ((i < 0) || (i > 2)) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
return 0;
}
ctx->list_add_value = (int)i;
return 1;
case DYNAMIC_CMD_LOAD:
return dynamic_load(e, ctx);
case DYNAMIC_CMD_DIR_LOAD:
if ((i < 0) || (i > 2)) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
return 0;
}
ctx->dir_load = (int)i;
return 1;
case DYNAMIC_CMD_DIR_ADD:
if (!p || (strlen((const char *)p) < 1)) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
return 0;
}
{
char *tmp_str = OPENSSL_strdup(p);
if (!tmp_str) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ERR_R_MALLOC_FAILURE);
return 0;
}
sk_OPENSSL_STRING_insert(ctx->dirs, tmp_str, -1);
}
return 1;
default:
break;
}
ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED);
return 0;
}
crypto/engine/eng_dyn.c:400: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_strdup()` at line 395, column 29 is not reachable after line 400, column 13.
Showing all 54 steps of the trace
crypto/engine/eng_dyn.c:333:1: start of procedure dynamic_ctrl()
331. }
332.
333. > static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
334. {
335. dynamic_data_ctx *ctx = dynamic_get_data_ctx(e);
crypto/engine/eng_dyn.c:335:5: Skipping dynamic_get_data_ctx(): empty list of specs
333. static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
334. {
335. dynamic_data_ctx *ctx = dynamic_get_data_ctx(e);
^
336. int initialised;
337.
crypto/engine/eng_dyn.c:338:10: Taking false branch
336. int initialised;
337.
338. if (!ctx) {
^
339. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_NOT_LOADED);
340. return 0;
crypto/engine/eng_dyn.c:342:21: Condition is true
340. return 0;
341. }
342. initialised = ((ctx->dynamic_dso == NULL) ? 0 : 1);
^
343. /* All our control commands require the ENGINE to be uninitialised */
344. if (initialised) {
crypto/engine/eng_dyn.c:342:20:
340. return 0;
341. }
342. > initialised = ((ctx->dynamic_dso == NULL) ? 0 : 1);
343. /* All our control commands require the ENGINE to be uninitialised */
344. if (initialised) {
crypto/engine/eng_dyn.c:342:5:
340. return 0;
341. }
342. > initialised = ((ctx->dynamic_dso == NULL) ? 0 : 1);
343. /* All our control commands require the ENGINE to be uninitialised */
344. if (initialised) {
crypto/engine/eng_dyn.c:344:9: Taking false branch
342. initialised = ((ctx->dynamic_dso == NULL) ? 0 : 1);
343. /* All our control commands require the ENGINE to be uninitialised */
344. if (initialised) {
^
345. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_ALREADY_LOADED);
346. return 0;
crypto/engine/eng_dyn.c:348:5:
346. return 0;
347. }
348. > switch (cmd) {
349. case DYNAMIC_CMD_SO_PATH:
350. /* a NULL 'p' or a string of zero-length is the same thing */
crypto/engine/eng_dyn.c:349:5: Switch condition is false. Skipping switch case
347. }
348. switch (cmd) {
349. case DYNAMIC_CMD_SO_PATH:
^
350. /* a NULL 'p' or a string of zero-length is the same thing */
351. if (p && (strlen((const char *)p) < 1))
crypto/engine/eng_dyn.c:359:5: Switch condition is false. Skipping switch case
357. ctx->DYNAMIC_LIBNAME = NULL;
358. return (ctx->DYNAMIC_LIBNAME ? 1 : 0);
359. case DYNAMIC_CMD_NO_VCHECK:
^
360. ctx->no_vcheck = ((i == 0) ? 0 : 1);
361. return 1;
crypto/engine/eng_dyn.c:362:5: Switch condition is false. Skipping switch case
360. ctx->no_vcheck = ((i == 0) ? 0 : 1);
361. return 1;
362. case DYNAMIC_CMD_ID:
^
363. /* a NULL 'p' or a string of zero-length is the same thing */
364. if (p && (strlen((const char *)p) < 1))
crypto/engine/eng_dyn.c:372:5: Switch condition is false. Skipping switch case
370. ctx->engine_id = NULL;
371. return (ctx->engine_id ? 1 : 0);
372. case DYNAMIC_CMD_LIST_ADD:
^
373. if ((i < 0) || (i > 2)) {
374. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
crypto/engine/eng_dyn.c:379:5: Switch condition is false. Skipping switch case
377. ctx->list_add_value = (int)i;
378. return 1;
379. case DYNAMIC_CMD_LOAD:
^
380. return dynamic_load(e, ctx);
381. case DYNAMIC_CMD_DIR_LOAD:
crypto/engine/eng_dyn.c:381:5: Switch condition is false. Skipping switch case
379. case DYNAMIC_CMD_LOAD:
380. return dynamic_load(e, ctx);
381. case DYNAMIC_CMD_DIR_LOAD:
^
382. if ((i < 0) || (i > 2)) {
383. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
crypto/engine/eng_dyn.c:388:5: Switch condition is true. Entering switch case
386. ctx->dir_load = (int)i;
387. return 1;
388. case DYNAMIC_CMD_DIR_ADD:
^
389. /* a NULL 'p' or a string of zero-length is the same thing */
390. if (!p || (strlen((const char *)p) < 1)) {
crypto/engine/eng_dyn.c:390:14: Taking false branch
388. case DYNAMIC_CMD_DIR_ADD:
389. /* a NULL 'p' or a string of zero-length is the same thing */
390. if (!p || (strlen((const char *)p) < 1)) {
^
391. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
392. return 0;
crypto/engine/eng_dyn.c:390:20: Taking false branch
388. case DYNAMIC_CMD_DIR_ADD:
389. /* a NULL 'p' or a string of zero-length is the same thing */
390. if (!p || (strlen((const char *)p) < 1)) {
^
391. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ENGINE_R_INVALID_ARGUMENT);
392. return 0;
crypto/engine/eng_dyn.c:395:13:
393. }
394. {
395. > char *tmp_str = OPENSSL_strdup(p);
396. if (!tmp_str) {
397. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ERR_R_MALLOC_FAILURE);
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 true 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:129:9:
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
129. > strcpy(ret, str);
130. return ret;
131. }
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)
crypto/engine/eng_dyn.c:396:18: Taking false branch
394. {
395. char *tmp_str = OPENSSL_strdup(p);
396. if (!tmp_str) {
^
397. ENGINEerr(ENGINE_F_DYNAMIC_CTRL, ERR_R_MALLOC_FAILURE);
398. return 0;
crypto/engine/eng_dyn.c:400:13:
398. return 0;
399. }
400. > sk_OPENSSL_STRING_insert(ctx->dirs, tmp_str, -1);
401. }
402. return 1;
include/openssl/safestack.h:214:1: start of procedure sk_OPENSSL_STRING_insert()
212. * dealt with in the autogenerated macros below.
213. */
214. > DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
215.
216. /*
crypto/stack/stack.c:167:1: start of procedure sk_insert()
165. }
166.
167. > int sk_insert(_STACK *st, void *data, int loc)
168. {
169. char **s;
crypto/stack/stack.c:171:9: Taking false branch
169. char **s;
170.
171. if (st == NULL)
^
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
crypto/stack/stack.c:173:9: Taking true branch
171. if (st == NULL)
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
^
174. s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
crypto/stack/stack.c:174:9:
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
174. > s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
164. }
165.
166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
crypto/mem.c:168:9: Taking true branch
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
^
169. return CRYPTO_malloc(num, file, line);
170.
crypto/mem.c:169:9:
167. {
168. if (str == NULL)
169. > return CRYPTO_malloc(num, file, line);
170.
171. if (num == 0) {
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking true branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:125:9:
123.
124. if (num <= 0)
125. > return NULL;
126.
127. allow_customize = 0;
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:191:1: return from a call to CRYPTO_realloc
189. return realloc(str, num);
190.
191. > }
192.
193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
crypto/stack/stack.c:176:13: Taking true branch
174. s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
^
177. return (0);
178. st->data = s;
crypto/stack/stack.c:177:13:
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
177. > return (0);
178. st->data = s;
179. st->num_alloc *= 2;
crypto/stack/stack.c:191:1: return from a call to sk_insert
189. st->sorted = 0;
190. return (st->num);
191. > }
192.
193. void *sk_delete_ptr(_STACK *st, void *p)
include/openssl/safestack.h:214:1: return from a call to sk_OPENSSL_STRING_insert
212. * dealt with in the autogenerated macros below.
213. */
214. > DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
215.
216. /*
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/engine/eng_dyn.c/#L400
|
d2a_code_trace_data_45813
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/dsa/dsa_ossl.c:285: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 22 steps of the trace
crypto/dsa/dsa_ossl.c:266:10: Call
264. * Calculate W = inv(S) mod Q save W in u2
265. */
266. if ((BN_mod_inverse(u2, s, dsa->q, ctx)) == NULL)
^
267. goto err;
268.
crypto/bn/bn_gcd.c:129:10: Call
127. BIGNUM *rv;
128. int noinv;
129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
^
130. if (noinv)
131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);
crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth`
133. }
134.
135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
137. int *pnoinv)
crypto/bn/bn_gcd.c:154:5: Call
152. bn_check_top(n);
153.
154. BN_CTX_start(ctx);
^
155. A = BN_CTX_get(ctx);
156. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gcd.c:446:5: Call
444. if ((ret == NULL) && (in == NULL))
445. BN_free(R);
446. BN_CTX_end(ctx);
^
447. bn_check_top(ret);
448. return (ret);
crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/dsa/dsa_ossl.c:285:10: Call
283.
284. /* u2 = r * w mod q */
285. if (!BN_mod_mul(u2, r, u2, dsa->q, ctx))
^
286. goto err;
287.
crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:83:5: Call
81. bn_check_top(m);
82.
83. BN_CTX_start(ctx);
^
84. if ((t = BN_CTX_get(ctx)) == NULL)
85. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:32:5: Call
30. }
31.
32. BN_CTX_start(ctx);
^
33. rr = (a != r) ? r : BN_CTX_get(ctx);
34. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_sqr.c:99:5: Call
97. bn_check_top(rr);
98. bn_check_top(tmp);
99. BN_CTX_end(ctx);
^
100. return (ret);
101. }
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <Offset trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: <Length trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/aa951ef3d745aa0c32b984fd9be2cc21382b97f6/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_45814
|
static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MPCContext *c = avctx->priv_data;
BitstreamContext bc2, *bc = &bc2;
int i, j, k, ch, cnt, res, t;
Band *bands = c->bands;
int off;
int maxband, keyframe;
int last[2];
frame->nb_samples = MPC_FRAME_SIZE;
if ((res = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
}
keyframe = c->cur_frame == 0;
if(keyframe){
memset(c->Q, 0, sizeof(c->Q));
c->last_bits_used = 0;
}
bitstream_init(bc, buf, buf_size * 8);
bitstream_skip(bc, c->last_bits_used & 7);
if(keyframe)
maxband = mpc8_get_mod_golomb(bc, c->maxbands + 1);
else{
maxband = c->last_max_band + bitstream_read_vlc(bc, band_vlc.table, MPC8_BANDS_BITS, 2);
if(maxband > 32) maxband -= 33;
}
if(maxband > c->maxbands + 1)
return AVERROR_INVALIDDATA;
c->last_max_band = maxband;
if(maxband){
last[0] = last[1] = 0;
for(i = maxband - 1; i >= 0; i--){
for(ch = 0; ch < 2; ch++){
last[ch] = bitstream_read_vlc(bc, res_vlc[last[ch] > 2].table, MPC8_RES_BITS, 2) + last[ch];
if(last[ch] > 15) last[ch] -= 17;
bands[i].res[ch] = last[ch];
}
}
if(c->MSS){
int mask;
cnt = 0;
for(i = 0; i < maxband; i++)
if(bands[i].res[0] || bands[i].res[1])
cnt++;
t = mpc8_get_mod_golomb(bc, cnt);
mask = mpc8_get_mask(bc, cnt, t);
for(i = maxband - 1; i >= 0; i--)
if(bands[i].res[0] || bands[i].res[1]){
bands[i].msf = mask & 1;
mask >>= 1;
}
}
}
for(i = maxband; i < c->maxbands; i++)
bands[i].res[0] = bands[i].res[1] = 0;
if(keyframe){
for(i = 0; i < 32; i++)
c->oldDSCF[0][i] = c->oldDSCF[1][i] = 1;
}
for(i = 0; i < maxband; i++){
if(bands[i].res[0] || bands[i].res[1]){
cnt = !!bands[i].res[0] + !!bands[i].res[1] - 1;
if(cnt >= 0){
t = bitstream_read_vlc(bc, scfi_vlc[cnt].table, scfi_vlc[cnt].bits, 1);
if(bands[i].res[0]) bands[i].scfi[0] = t >> (2 * cnt);
if(bands[i].res[1]) bands[i].scfi[1] = t & 3;
}
}
}
for(i = 0; i < maxband; i++){
for(ch = 0; ch < 2; ch++){
if(!bands[i].res[ch]) continue;
if(c->oldDSCF[ch][i]){
bands[i].scf_idx[ch][0] = bitstream_read(bc, 7) - 6;
c->oldDSCF[ch][i] = 0;
}else{
t = bitstream_read_vlc(bc, dscf_vlc[1].table, MPC8_DSCF1_BITS, 2);
if(t == 64)
t += bitstream_read(bc, 6);
bands[i].scf_idx[ch][0] = ((bands[i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
}
for(j = 0; j < 2; j++){
if((bands[i].scfi[ch] << j) & 2)
bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];
else{
t = bitstream_read_vlc(bc, dscf_vlc[0].table, MPC8_DSCF0_BITS, 2);
if(t == 31)
t = 64 + bitstream_read(bc, 6);
bands[i].scf_idx[ch][j + 1] = ((bands[i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
}
}
}
}
for(i = 0, off = 0; i < maxband; i++, off += SAMPLES_PER_BAND){
for(ch = 0; ch < 2; ch++){
res = bands[i].res[ch];
switch(res){
case -1:
for(j = 0; j < SAMPLES_PER_BAND; j++)
c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
break;
case 0:
break;
case 1:
for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
cnt = bitstream_read_vlc(bc, q1_vlc.table, MPC8_Q1_BITS, 2);
t = mpc8_get_mask(bc, 18, cnt);
for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
c->Q[ch][off + j + k] = (t & 0x20000) ? (bitstream_read_bit(bc) << 1) - 1 : 0;
}
break;
case 2:
cnt = 6;
for(j = 0; j < SAMPLES_PER_BAND; j += 3){
t = bitstream_read_vlc(bc, q2_vlc[cnt > 3].table, MPC8_Q2_BITS, 2);
c->Q[ch][off + j + 0] = mpc8_idx50[t];
c->Q[ch][off + j + 1] = mpc8_idx51[t];
c->Q[ch][off + j + 2] = mpc8_idx52[t];
cnt = (cnt >> 1) + mpc8_huffq2[t];
}
break;
case 3:
case 4:
for(j = 0; j < SAMPLES_PER_BAND; j += 2){
t = bitstream_read_vlc(bc, q3_vlc[res - 3].table, MPC8_Q3_BITS, 2) + q3_offsets[res - 3];
c->Q[ch][off + j + 1] = t >> 4;
c->Q[ch][off + j + 0] = (t & 8) ? (t & 0xF) - 16 : (t & 0xF);
}
break;
case 5:
case 6:
case 7:
case 8:
cnt = 2 * mpc8_thres[res];
for(j = 0; j < SAMPLES_PER_BAND; j++){
t = bitstream_read_vlc(bc, quant_vlc[res - 5][cnt > mpc8_thres[res]].table, quant_vlc[res - 5][cnt > mpc8_thres[res]].bits, 2) + quant_offsets[res - 5];
c->Q[ch][off + j] = t;
cnt = (cnt >> 1) + FFABS(c->Q[ch][off + j]);
}
break;
default:
for(j = 0; j < SAMPLES_PER_BAND; j++){
c->Q[ch][off + j] = bitstream_read_vlc(bc, q9up_vlc.table, MPC8_Q9UP_BITS, 2);
if(res != 9){
c->Q[ch][off + j] <<= res - 9;
c->Q[ch][off + j] |= bitstream_read(bc, res - 9);
}
c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
}
}
}
}
ff_mpc_dequantize_and_synth(c, maxband - 1,
(int16_t **)frame->extended_data,
avctx->channels);
c->cur_frame++;
c->last_bits_used = bitstream_tell(bc);
if (bitstream_bits_left(bc) < 8)
c->last_bits_used = buf_size << 3;
if(c->cur_frame >= c->frames)
c->cur_frame = 0;
*got_frame_ptr = 1;
return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
}
libavcodec/mpc8.c:352: error: Integer Overflow L2
([0, 1020] - 510):unsigned32.
libavcodec/mpc8.c:268:38: <LHS trace>
266. maxband = mpc8_get_mod_golomb(bc, c->maxbands + 1);
267. else{
268. maxband = c->last_max_band + bitstream_read_vlc(bc, band_vlc.table, MPC8_BANDS_BITS, 2);
^
269. if(maxband > 32) maxband -= 33;
270. }
libavcodec/mpc8.c:268:38: Call
266. maxband = mpc8_get_mod_golomb(bc, c->maxbands + 1);
267. else{
268. maxband = c->last_max_band + bitstream_read_vlc(bc, band_vlc.table, MPC8_BANDS_BITS, 2);
^
269. if(maxband > 32) maxband -= 33;
270. }
libavcodec/bitstream.h:313:1: Parameter `(*table)[*]`
311. * If the VLC code is invalid and max_depth > 1, then the number of bits removed
312. * is undefined. */
313. static inline int bitstream_read_vlc(BitstreamContext *bc, VLC_TYPE (*table)[2],
^
314. int bits, int max_depth)
315. {
libavcodec/mpc8.c:352:42: Call
350. case -1:
351. for(j = 0; j < SAMPLES_PER_BAND; j++)
352. c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
^
353. break;
354. case 0:
libavutil/lfg.h:38:1: Parameter `c->state[*]`
36. * it may be good enough and faster for your specific use case.
37. */
38. static inline unsigned int av_lfg_get(AVLFG *c){
^
39. c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
40. return c->state[c->index++ & 63];
libavutil/lfg.h:40:5: Assignment
38. static inline unsigned int av_lfg_get(AVLFG *c){
39. c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
40. return c->state[c->index++ & 63];
^
41. }
42.
libavcodec/mpc8.c:352:21: Binary operation: ([0, 1020] - 510):unsigned32
350. case -1:
351. for(j = 0; j < SAMPLES_PER_BAND; j++)
352. c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
^
353. break;
354. case 0:
|
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/mpc8.c/#L352
|
d2a_code_trace_data_45815
|
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: [289+min(0, `c->synth_buf_offset[*]`), 304+max(511, `c->synth_buf_offset[*]`)] (⇐ [33+min(0, `c->synth_buf_offset[*]`), 48+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:910:9: Assignment
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);
912.
libavcodec/mpegaudiodec.c:911:9: Array access: Offset: [289+min(0, c->synth_buf_offset[*]), 304+max(511, c->synth_buf_offset[*])] (⇐ [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] + 256) Size: 2 by call to `ff_mpa_synth_filter`
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
910. p = synth_buf + 48 - j;
911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
^
912.
913. *samples = round_sample(&sum);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L911
|
d2a_code_trace_data_45816
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:1434: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_inv`.
Showing all 12 steps of the trace
test/bntest.c:1415:1: Parameter `ctx->stack.depth`
1413. }
1414.
1415. > int test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx)
1416. {
1417. BIGNUM *a, *b[2], *c, *d;
test/bntest.c:1434:13: Call
1432. BN_bntest_rand(a, 512, 0, 0);
1433. for (j = 0; j < 2; j++) {
1434. BN_GF2m_mod_inv(c, a, b[j], ctx);
^
1435. BN_GF2m_mod_mul(d, a, c, b[j], ctx);
1436. /* Test that ((1/a)*a) = 1. */
crypto/bn/bn_gf2m.c:568:5: Call
566. bn_check_top(p);
567.
568. BN_CTX_start(ctx);
^
569.
570. if ((b = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gf2m.c:724:5: Call
722. bn_correct_top(v);
723. # endif
724. BN_CTX_end(ctx);
^
725. return ret;
726. }
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <Offset trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: <Length trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_inv`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_45817
|
static void wmapro_window(WMAProDecodeCtx *s)
{
int i;
for (i = 0; i < s->channels_for_cur_subframe; i++) {
int c = s->channel_indexes_for_cur_subframe[i];
float* window;
int winlen = s->channel[c].prev_block_len;
float* start = s->channel[c].coeffs - (winlen >> 1);
if (s->subframe_len < winlen) {
start += (winlen - s->subframe_len) >> 1;
winlen = s->subframe_len;
}
window = s->windows[av_log2(winlen) - WMAPRO_BLOCK_MIN_BITS];
winlen >>= 1;
s->dsp.vector_fmul_window(start, start, start + winlen,
window, winlen);
s->channel[c].prev_block_len = s->subframe_len;
}
}
libavcodec/wmaprodec.c:1038: error: Buffer Overrun L3
Offset: [-6, +oo] Size: 7.
libavcodec/wmaprodec.c:1038:29: <Offset trace>
1036. }
1037.
1038. window = s->windows[av_log2(winlen) - WMAPRO_BLOCK_MIN_BITS];
^
1039.
1040. winlen >>= 1;
libavcodec/wmaprodec.c:1038:29: Call
1036. }
1037.
1038. window = s->windows[av_log2(winlen) - WMAPRO_BLOCK_MIN_BITS];
^
1039.
1040. winlen >>= 1;
libavutil/common.h:67:1: Global `ff_log2_tab`
65. extern const uint8_t av_reverse[256];
66.
67. static av_always_inline av_const int av_log2_c(unsigned int v)
^
68. {
69. int n = 0;
libavutil/common.h:78:5: Assignment
76. n += 8;
77. }
78. n += ff_log2_tab[v];
^
79.
80. return n;
libavutil/common.h:80:5: Assignment
78. n += ff_log2_tab[v];
79.
80. return n;
^
81. }
82.
libavcodec/wmaprodec.c:1024:1: <Length trace>
1022. *@param s codec context
1023. */
1024. static void wmapro_window(WMAProDecodeCtx *s)
^
1025. {
1026. int i;
libavcodec/wmaprodec.c:1024:1: Parameter `s->windows[*]`
1022. *@param s codec context
1023. */
1024. static void wmapro_window(WMAProDecodeCtx *s)
^
1025. {
1026. int i;
libavcodec/wmaprodec.c:1038:18: Array access: Offset: [-6, +oo] Size: 7
1036. }
1037.
1038. window = s->windows[av_log2(winlen) - WMAPRO_BLOCK_MIN_BITS];
^
1039.
1040. winlen >>= 1;
|
https://github.com/libav/libav/blob/204cb29b3c84a74cbcd059d353c70c8bdc567d98/libavcodec/wmaprodec.c/#L1038
|
d2a_code_trace_data_45818
|
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/dtls_mtu_test.c:139: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 17 steps of the trace
test/dtls_mtu_test.c:61:10: Call
59. memset(buf, 0x5a, sizeof(buf));
60.
61. if (!TEST_true(create_ssl_objects(ctx, ctx, &srvr_ssl, &clnt_ssl,
^
62. NULL, NULL)))
63. goto end;
test/ssltestlib.c:559:15: Call
557. if (*sssl != NULL)
558. serverssl = *sssl;
559. else if (!TEST_ptr(serverssl = SSL_new(serverctx)))
^
560. goto error;
561. if (*cssl != NULL)
ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items`
520. }
521.
522. > SSL *SSL_new(SSL_CTX *ctx)
523. {
524. SSL *s;
test/dtls_mtu_test.c:139:5: Call
137. rv = 2;
138. end:
139. SSL_free(clnt_ssl);
^
140. SSL_free(srvr_ssl);
141. return rv;
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_45819
|
static void run_cert(X509 *crt, const char *nameincert,
const struct set_name_fn *fn)
{
const char *const *pname = names;
while (*pname)
{
int samename = strcasecmp(nameincert, *pname) == 0;
size_t namelen = strlen(*pname);
char *name = malloc(namelen);
int match, ret;
memcpy(name, *pname, namelen);
ret = X509_check_host(crt, (const unsigned char *)name,
namelen, 0);
match = -1;
if (ret < 0)
{
fprintf(stderr, "internal error in X509_check_host");
++errors;
}
else if (fn->host)
{
if (ret == 1 && !samename)
match = 1;
if (ret == 0 && samename)
match = 0;
}
else if (ret == 1)
match = 1;
check_message(fn, "host", nameincert, match, *pname);
ret = X509_check_host(crt, (const unsigned char *)name,
namelen, X509_CHECK_FLAG_NO_WILDCARDS);
match = -1;
if (ret < 0)
{
fprintf(stderr, "internal error in X509_check_host");
++errors;
}
else if (fn->host)
{
if (ret == 1 && !samename)
match = 1;
if (ret == 0 && samename)
match = 0;
}
else if (ret == 1)
match = 1;
check_message(fn, "host-no-wildcards",
nameincert, match, *pname);
ret = X509_check_email(crt, (const unsigned char *)name,
namelen, 0);
match = -1;
if (fn->email)
{
if (ret && !samename)
match = 1;
if (!ret && samename && strchr(nameincert, '@') != NULL)
match = 0;
}
else if (ret)
match = 1;
check_message(fn, "email", nameincert, match, *pname);
++pname;
free(name);
}
}
crypto/x509v3/v3nametest.c:273: error: NULL_DEREFERENCE
pointer `name` last assigned on line 271 could be null and is dereferenced by call to `memcpy()` at line 273, column 3.
Showing all 8 steps of the trace
crypto/x509v3/v3nametest.c:263:1: start of procedure run_cert()
261. }
262.
263. > static void run_cert(X509 *crt, const char *nameincert,
264. const struct set_name_fn *fn)
265. {
crypto/x509v3/v3nametest.c:266:2:
264. const struct set_name_fn *fn)
265. {
266. > const char *const *pname = names;
267. while (*pname)
268. {
crypto/x509v3/v3nametest.c:267:9: Loop condition is true. Entering loop body
265. {
266. const char *const *pname = names;
267. while (*pname)
^
268. {
269. int samename = strcasecmp(nameincert, *pname) == 0;
crypto/x509v3/v3nametest.c:269:18: Condition is false
267. while (*pname)
268. {
269. int samename = strcasecmp(nameincert, *pname) == 0;
^
270. size_t namelen = strlen(*pname);
271. char *name = malloc(namelen);
crypto/x509v3/v3nametest.c:269:3:
267. while (*pname)
268. {
269. > int samename = strcasecmp(nameincert, *pname) == 0;
270. size_t namelen = strlen(*pname);
271. char *name = malloc(namelen);
crypto/x509v3/v3nametest.c:270:3:
268. {
269. int samename = strcasecmp(nameincert, *pname) == 0;
270. > size_t namelen = strlen(*pname);
271. char *name = malloc(namelen);
272. int match, ret;
crypto/x509v3/v3nametest.c:271:3:
269. int samename = strcasecmp(nameincert, *pname) == 0;
270. size_t namelen = strlen(*pname);
271. > char *name = malloc(namelen);
272. int match, ret;
273. memcpy(name, *pname, namelen);
crypto/x509v3/v3nametest.c:273:3:
271. char *name = malloc(namelen);
272. int match, ret;
273. > memcpy(name, *pname, namelen);
274.
275. ret = X509_check_host(crt, (const unsigned char *)name,
|
https://github.com/openssl/openssl/blob/1c16fd1f033816c98b96a41691625c0c2788e805/crypto/x509v3/v3nametest.c/#L273
|
d2a_code_trace_data_45820
|
int test_sub(BIO *bp)
{
BIGNUM *a, *b, *c;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
for (i = 0; i < num0 + num1; i++) {
if (i < num1) {
BN_bntest_rand(a, 512, 0, 0);
BN_copy(b, a);
if (BN_set_bit(a, i) == 0)
return (0);
BN_add_word(b, i);
} else {
BN_bntest_rand(b, 400 + i - num1, 0, 0);
a->neg = rand_neg();
b->neg = rand_neg();
}
BN_sub(c, a, b);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " - ");
BN_print(bp, b);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_add(c, c, b);
BN_sub(c, c, a);
if (!BN_is_zero(c)) {
fprintf(stderr, "Subtract test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(c);
return (1);
}
test/bntest.c:444: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 410, column 9 is not reachable after line 444, column 5.
Showing all 95 steps of the trace
test/bntest.c:404:1: start of procedure test_sub()
402. }
403.
404. > int test_sub(BIO *bp)
405. {
406. BIGNUM *a, *b, *c;
test/bntest.c:409:5:
407. int i;
408.
409. > a = BN_new();
410. b = BN_new();
411. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:410:5:
408.
409. a = BN_new();
410. > b = BN_new();
411. c = BN_new();
412.
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:411:5:
409. a = BN_new();
410. b = BN_new();
411. > c = BN_new();
412.
413. for (i = 0; i < num0 + num1; i++) {
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:413:10:
411. c = BN_new();
412.
413. > for (i = 0; i < num0 + num1; i++) {
414. if (i < num1) {
415. BN_bntest_rand(a, 512, 0, 0);
test/bntest.c:413:17: Loop condition is false. Leaving loop
411. c = BN_new();
412.
413. for (i = 0; i < num0 + num1; i++) {
^
414. if (i < num1) {
415. BN_bntest_rand(a, 512, 0, 0);
test/bntest.c:443:5:
441. }
442. }
443. > BN_free(a);
444. BN_free(b);
445. BN_free(c);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:444:5:
442. }
443. BN_free(a);
444. > BN_free(b);
445. BN_free(c);
446. return (1);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L444
|
d2a_code_trace_data_45821
|
static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
{
int match = !!(src->reference & parity);
if (match) {
COPY_PICTURE(dest, src);
if (parity != PICT_FRAME) {
pic_as_field(dest, parity);
dest->pic_id *= 2;
dest->pic_id += id_add;
}
}
return match;
}
libavcodec/h264_refs.c:158: error: Buffer Overrun L2
Offset: [0, 31] Size: 2 by call to `build_def_list`.
libavcodec/h264_refs.c:116:1: Parameter `h->default_ref_list[*]`
114. }
115.
116. int ff_h264_fill_default_ref_list(H264Context *h)
^
117. {
118. int i, len;
libavcodec/h264_refs.c:158:16: Call
156. }
157. } else {
158. len = build_def_list(h->default_ref_list[0], FF_ARRAY_ELEMS(h->default_ref_list[0]),
^
159. h->short_ref, h->short_ref_count, 0, h->picture_structure);
160. len += build_def_list(h->default_ref_list[0] + len,
libavcodec/h264_refs.c:70:1: Parameter `def_len`
68. }
69.
70. static int build_def_list(Picture *def, int def_len,
^
71. Picture **in, int len, int is_long, int sel)
72. {
libavcodec/h264_refs.c:83:13: Call
81. if (i[0] < len && index < def_len) {
82. in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num;
83. split_field_copy(&def[index++], in[i[0]++], sel, 1);
^
84. }
85. if (i[1] < len && index < def_len) {
libavcodec/h264_refs.c:54:1: <Length trace>
52. }
53.
54. static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
^
55. {
56. int match = !!(src->reference & parity);
libavcodec/h264_refs.c:54:1: Parameter `*dest`
52. }
53.
54. static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
^
55. {
56. int match = !!(src->reference & parity);
libavcodec/h264_refs.c:59:9: Array access: Offset: [0, 31] Size: 2 by call to `build_def_list`
57.
58. if (match) {
59. COPY_PICTURE(dest, src);
^
60. if (parity != PICT_FRAME) {
61. pic_as_field(dest, parity);
|
https://github.com/libav/libav/blob/0673ede985a6560e7efb86dab1c58fb7f95ce587/libavcodec/h264_refs.c/#L59
|
d2a_code_trace_data_45822
|
static av_cold int dvvideo_init(AVCodecContext *avctx)
{
DVVideoContext *s = avctx->priv_data;
DSPContext dsp;
static int done=0;
int i, j;
if (!done) {
VLC dv_vlc;
uint16_t new_dv_vlc_bits[NB_DV_VLC*2];
uint8_t new_dv_vlc_len[NB_DV_VLC*2];
uint8_t new_dv_vlc_run[NB_DV_VLC*2];
int16_t new_dv_vlc_level[NB_DV_VLC*2];
done = 1;
for (i=0; i<DV_ANCHOR_SIZE; i++)
dv_anchor[i] = (void*)(size_t)i;
for (i=0, j=0; i<NB_DV_VLC; i++, j++) {
new_dv_vlc_bits[j] = dv_vlc_bits[i];
new_dv_vlc_len[j] = dv_vlc_len[i];
new_dv_vlc_run[j] = dv_vlc_run[i];
new_dv_vlc_level[j] = dv_vlc_level[i];
if (dv_vlc_level[i]) {
new_dv_vlc_bits[j] <<= 1;
new_dv_vlc_len[j]++;
j++;
new_dv_vlc_bits[j] = (dv_vlc_bits[i] << 1) | 1;
new_dv_vlc_len[j] = dv_vlc_len[i] + 1;
new_dv_vlc_run[j] = dv_vlc_run[i];
new_dv_vlc_level[j] = -dv_vlc_level[i];
}
}
init_vlc(&dv_vlc, TEX_VLC_BITS, j,
new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0);
assert(dv_vlc.table_size == 1184);
for(i = 0; i < dv_vlc.table_size; i++){
int code= dv_vlc.table[i][0];
int len = dv_vlc.table[i][1];
int level, run;
if(len<0){
run= 0;
level= code;
} else {
run= new_dv_vlc_run[code] + 1;
level= new_dv_vlc_level[code];
}
dv_rl_vlc[i].len = len;
dv_rl_vlc[i].level = level;
dv_rl_vlc[i].run = run;
}
free_vlc(&dv_vlc);
for (i = 0; i < NB_DV_VLC - 1; i++) {
if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
continue;
#ifdef DV_CODEC_TINY_TARGET
if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
continue;
#endif
if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0)
continue;
dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc = dv_vlc_bits[i] <<
(!!dv_vlc_level[i]);
dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size = dv_vlc_len[i] +
(!!dv_vlc_level[i]);
}
for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
#ifdef DV_CODEC_TINY_TARGET
for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
if (dv_vlc_map[i][j].size == 0) {
dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
(dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
dv_vlc_map[0][j].size;
}
}
#else
for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) {
if (dv_vlc_map[i][j].size == 0) {
dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
(dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
dv_vlc_map[0][j].size;
}
dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc =
dv_vlc_map[i][j].vlc | 1;
dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size =
dv_vlc_map[i][j].size;
}
#endif
}
}
dsputil_init(&dsp, avctx);
s->get_pixels = dsp.get_pixels;
s->fdct[0] = dsp.fdct;
s->idct_put[0] = dsp.idct_put;
for (i=0; i<64; i++)
s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]];
s->fdct[1] = dsp.fdct248;
s->idct_put[1] = ff_simple_idct248_put;
if(avctx->lowres){
for (i=0; i<64; i++){
int j= ff_zigzag248_direct[i];
s->dv_zigzag[1][i] = dsp.idct_permutation[(j&7) + (j&8)*4 + (j&48)/2];
}
}else
memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
dv_build_unquantize_tables(s, dsp.idct_permutation);
avctx->coded_frame = &s->picture;
s->avctx= avctx;
return 0;
}
libavcodec/dv.c:165: error: Uninitialized Value
The value read from new_dv_vlc_level[_] was never initialized.
libavcodec/dv.c:165:17:
163. } else {
164. run= new_dv_vlc_run[code] + 1;
165. level= new_dv_vlc_level[code];
^
166. }
167. dv_rl_vlc[i].len = len;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dv.c/#L165
|
d2a_code_trace_data_45823
|
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/sm2crypttest.c:152: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_KEY_set_group`.
Showing all 16 steps of the trace
test/sm2crypttest.c:152:5: Call
150.
151. key = EC_KEY_new();
152. EC_KEY_set_group(key, group);
^
153. EC_KEY_set_private_key(key, priv);
154.
crypto/ec/ec_key.c:424:1: Parameter `group->mont_data->N.top`
422. }
423.
424. > int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
425. {
426. if (key->meth->set_group != NULL && key->meth->set_group(key, group) == 0)
crypto/ec/ec_key.c:429:18: Call
427. return 0;
428. EC_GROUP_free(key->group);
429. key->group = EC_GROUP_dup(group);
^
430. return (key->group == NULL) ? 0 : 1;
431. }
crypto/ec/ec_lib.c:231:1: Parameter `a->mont_data->N.top`
229. }
230.
231. > EC_GROUP *EC_GROUP_dup(const EC_GROUP *a)
232. {
233. EC_GROUP *t = NULL;
crypto/ec/ec_lib.c:241:10: Call
239. if ((t = EC_GROUP_new(a->meth)) == NULL)
240. return NULL;
241. if (!EC_GROUP_copy(t, a))
^
242. goto err;
243.
crypto/ec/ec_lib.c:130:1: Parameter `src->mont_data->N.top`
128. }
129.
130. > int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src)
131. {
132. if (dest->meth->group_copy == 0) {
crypto/ec/ec_lib.c:181:14: Call
179. return 0;
180. }
181. if (!BN_MONT_CTX_copy(dest->mont_data, src->mont_data))
^
182. return 0;
183. } else {
crypto/bn/bn_mont.c:369:1: Parameter `from->N.top`
367. }
368.
369. > BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
370. {
371. if (to == from)
crypto/bn/bn_mont.c:376:10: Call
374. if (!BN_copy(&(to->RR), &(from->RR)))
375. return NULL;
376. if (!BN_copy(&(to->N), &(from->N)))
^
377. return NULL;
378. if (!BN_copy(&(to->Ni), &(from->Ni)))
crypto/bn/bn_lib.c:285:1: <Offset trace>
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
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_lib.c:285:1: <Length trace>
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_lib.c:285:1: Parameter `*a->d`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_lib.c:291:9: Call
289. if (a == b)
290. return a;
291. if (bn_wexpand(a, b->top) == NULL)
^
292. return NULL;
293.
crypto/bn/bn_lib.c:910:1: Parameter `*a->d`
908. }
909.
910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:295:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_KEY_set_group`
293.
294. if (b->top > 0)
295. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
^
296.
297. a->top = b->top;
|
https://github.com/openssl/openssl/blob/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_lib.c/#L295
|
d2a_code_trace_data_45824
|
int tls_construct_client_verify(SSL *s)
{
unsigned char *p;
EVP_PKEY *pkey;
const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys];
EVP_MD_CTX *mctx;
unsigned u = 0;
unsigned long n = 0;
long hdatalen = 0;
void *hdata;
mctx = EVP_MD_CTX_new();
if (mctx == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE);
goto err;
}
p = ssl_handshake_start(s);
pkey = s->cert->key->privatekey;
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
if (hdatalen <= 0) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
goto err;
}
if (SSL_USE_SIGALGS(s)) {
if (!tls12_get_sigandhash(p, pkey, md)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
goto err;
}
p += 2;
n = 2;
}
#ifdef SSL_DEBUG
fprintf(stderr, "Using client alg %s\n", EVP_MD_name(md));
#endif
if (!EVP_SignInit_ex(mctx, md, NULL)
|| !EVP_SignUpdate(mctx, hdata, hdatalen)
|| (s->version == SSL3_VERSION
&& !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET,
s->session->master_key_length,
s->session->master_key))
|| !EVP_SignFinal(mctx, p + 2, &u, pkey)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_EVP_LIB);
goto err;
}
#ifndef OPENSSL_NO_GOST
{
int pktype = EVP_PKEY_id(pkey);
if (pktype == NID_id_GostR3410_2001
|| pktype == NID_id_GostR3410_2012_256
|| pktype == NID_id_GostR3410_2012_512)
BUF_reverse(p + 2, NULL, u);
}
#endif
s2n(u, p);
n += u + 2;
if (!ssl3_digest_cached_records(s, 0))
goto err;
if (!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_VERIFY, n)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
goto err;
}
EVP_MD_CTX_free(mctx);
return 1;
err:
EVP_MD_CTX_free(mctx);
return 0;
}
ssl/statem/statem_clnt.c:2690: error: MEMORY_LEAK
memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 2632, column 12 is not reachable after line 2690, column 5.
Showing all 50 steps of the trace
ssl/statem/statem_clnt.c:2621:1: start of procedure tls_construct_client_verify()
2619. }
2620.
2621. > int tls_construct_client_verify(SSL *s)
2622. {
2623. unsigned char *p;
ssl/statem/statem_clnt.c:2625:5:
2623. unsigned char *p;
2624. EVP_PKEY *pkey;
2625. > const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys];
2626. EVP_MD_CTX *mctx;
2627. unsigned u = 0;
ssl/statem/statem_clnt.c:2627:5:
2625. const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys];
2626. EVP_MD_CTX *mctx;
2627. > unsigned u = 0;
2628. unsigned long n = 0;
2629. long hdatalen = 0;
ssl/statem/statem_clnt.c:2628:5:
2626. EVP_MD_CTX *mctx;
2627. unsigned u = 0;
2628. > unsigned long n = 0;
2629. long hdatalen = 0;
2630. void *hdata;
ssl/statem/statem_clnt.c:2629:5:
2627. unsigned u = 0;
2628. unsigned long n = 0;
2629. > long hdatalen = 0;
2630. void *hdata;
2631.
ssl/statem/statem_clnt.c:2632:5:
2630. void *hdata;
2631.
2632. > mctx = EVP_MD_CTX_new();
2633. if (mctx == NULL) {
2634. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE);
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:98:1: start of procedure CRYPTO_zalloc()
96. }
97.
98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
99. {
100. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:100:5:
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
99. {
100. > void *ret = CRYPTO_malloc(num, file, line);
101.
102. if (ret != NULL)
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/mem.c:102:9: Taking true branch
100. void *ret = CRYPTO_malloc(num, file, line);
101.
102. if (ret != NULL)
^
103. memset(ret, 0, num);
104. return ret;
crypto/mem.c:103:9:
101.
102. if (ret != NULL)
103. > memset(ret, 0, num);
104. return ret;
105. }
crypto/mem.c:104:5:
102. if (ret != NULL)
103. memset(ret, 0, num);
104. > return ret;
105. }
106.
crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
103. memset(ret, 0, num);
104. return ret;
105. > }
106.
107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. > }
48.
49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
ssl/statem/statem_clnt.c:2633:9: Taking false branch
2631.
2632. mctx = EVP_MD_CTX_new();
2633. if (mctx == NULL) {
^
2634. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE);
2635. goto err;
ssl/statem/statem_clnt.c:2638:5:
2636. }
2637.
2638. > p = ssl_handshake_start(s);
2639. pkey = s->cert->key->privatekey;
2640.
ssl/statem/statem_clnt.c:2639:5:
2637.
2638. p = ssl_handshake_start(s);
2639. > pkey = s->cert->key->privatekey;
2640.
2641. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
ssl/statem/statem_clnt.c:2641:5:
2639. pkey = s->cert->key->privatekey;
2640.
2641. > hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
2642. if (hdatalen <= 0) {
2643. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
crypto/bio/bio_lib.c:327:1: start of procedure BIO_ctrl()
325. }
326.
327. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
328. {
329. long ret;
crypto/bio/bio_lib.c:332:9: Taking false branch
330. long (*cb) (BIO *, int, const char *, int, long, long);
331.
332. if (b == NULL)
^
333. return (0);
334.
crypto/bio/bio_lib.c:335:10: Taking false branch
333. return (0);
334.
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
337. return (-2);
crypto/bio/bio_lib.c:335:33: Taking true branch
333. return (0);
334.
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
337. return (-2);
crypto/bio/bio_lib.c:336:9: Skipping ERR_put_error(): empty list of specs
334.
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
^
337. return (-2);
338. }
crypto/bio/bio_lib.c:337:9:
335. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
337. > return (-2);
338. }
339.
crypto/bio/bio_lib.c:351:1: return from a call to BIO_ctrl
349. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
350. return (ret);
351. > }
352.
353. long BIO_callback_ctrl(BIO *b, int cmd,
ssl/statem/statem_clnt.c:2642:9: Taking true branch
2640.
2641. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
2642. if (hdatalen <= 0) {
^
2643. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
2644. goto err;
ssl/statem/statem_clnt.c:2643:9: Skipping ERR_put_error(): empty list of specs
2641. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
2642. if (hdatalen <= 0) {
2643. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
^
2644. goto err;
2645. }
ssl/statem/statem_clnt.c:2689:2:
2687. EVP_MD_CTX_free(mctx);
2688. return 1;
2689. > err:
2690. EVP_MD_CTX_free(mctx);
2691. return 0;
ssl/statem/statem_clnt.c:2690:5:
2688. return 1;
2689. err:
2690. > EVP_MD_CTX_free(mctx);
2691. return 0;
2692. }
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: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)
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/de451856f08364ad6c6659b6eacbe820edc2aab9/ssl/statem/statem_clnt.c/#L2690
|
d2a_code_trace_data_45825
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/dsa/dsa_ameth.c:183: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`.
Showing all 25 steps of the trace
crypto/dsa/dsa_ameth.c:183:10: Call
181.
182. BN_set_flags(dsa->priv_key, BN_FLG_CONSTTIME);
183. if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)) {
^
184. DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR);
185. goto dsaerr;
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_45826
|
ngx_pool_t *
ngx_create_pool(size_t size, ngx_log_t *log)
{
ngx_pool_t *p;
p = ngx_alloc(size, log);
if (p == NULL) {
return NULL;
}
p->d.last = (u_char *) p + sizeof(ngx_pool_t);
p->d.end = (u_char *) p + size;
p->d.next = NULL;
size = size - sizeof(ngx_pool_t);
p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
p->current = p;
p->chain = NULL;
p->large = NULL;
p->cleanup = NULL;
p->log = log;
return p;
}
src/http/ngx_http_request.c:441: error: Integer Overflow L2
([0, +oo] - 72):unsigned64 by call to `ngx_create_pool`.
src/http/ngx_http_request.c:277:9: Assignment
275. ngx_memzero(r, sizeof(ngx_http_request_t));
276.
277. r->pipeline = hc->pipeline;
^
278.
279. if (hc->nbusy) {
src/http/ngx_http_request.c:441:15: Call
439. }
440.
441. r->pool = ngx_create_pool(cscf->request_pool_size, c->log);
^
442. if (r->pool == NULL) {
443. ngx_http_close_connection(c);
src/core/ngx_palloc.c:15:1: <LHS trace>
13.
14.
15. ngx_pool_t *
^
16. ngx_create_pool(size_t size, ngx_log_t *log)
17. {
src/core/ngx_palloc.c:15:1: Parameter `size`
13.
14.
15. ngx_pool_t *
^
16. ngx_create_pool(size_t size, ngx_log_t *log)
17. {
src/core/ngx_palloc.c:29:5: Binary operation: ([0, +oo] - 72):unsigned64 by call to `ngx_create_pool`
27. p->d.next = NULL;
28.
29. size = size - sizeof(ngx_pool_t);
^
30. p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
31.
|
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_palloc.c/#L29
|
d2a_code_trace_data_45827
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ec2_smpl.c:208: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 9 steps of the trace
crypto/ec/ec2_smpl.c:174:1: Parameter `ctx->stack.depth`
172. * elliptic curve <=> b != 0 (mod p)
173. */
174. > int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
175. BN_CTX *ctx)
176. {
crypto/ec/ec2_smpl.c:208:9: Call
206. err:
207. if (ctx != NULL)
208. BN_CTX_end(ctx);
^
209. BN_CTX_free(new_ctx);
210. 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_45828
|
static int decode_element(AVCodecContext *avctx, void *data, int ch_index,
int channels)
{
ALACContext *alac = avctx->priv_data;
int has_size, bps, is_compressed, decorr_shift, decorr_left_weight, ret;
uint32_t output_samples;
int i, ch;
skip_bits(&alac->gb, 4);
skip_bits(&alac->gb, 12);
has_size = get_bits1(&alac->gb);
alac->extra_bits = get_bits(&alac->gb, 2) << 3;
bps = alac->sample_size - alac->extra_bits + channels - 1;
if (bps > 32) {
av_log(avctx, AV_LOG_ERROR, "bps is unsupported: %d\n", bps);
return AVERROR_PATCHWELCOME;
}
is_compressed = !get_bits1(&alac->gb);
if (has_size)
output_samples = get_bits_long(&alac->gb, 32);
else
output_samples = alac->max_samples_per_frame;
if (!output_samples || output_samples > alac->max_samples_per_frame) {
av_log(avctx, AV_LOG_ERROR, "invalid samples per frame: %d\n",
output_samples);
return AVERROR_INVALIDDATA;
}
if (!alac->nb_samples) {
alac->frame.nb_samples = output_samples;
if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
} else if (output_samples != alac->nb_samples) {
av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",
output_samples, alac->nb_samples);
return AVERROR_INVALIDDATA;
}
alac->nb_samples = output_samples;
if (alac->sample_size > 16) {
for (ch = 0; ch < channels; ch++)
alac->output_samples_buffer[ch] = (int32_t *)alac->frame.extended_data[ch_index + ch];
}
if (is_compressed) {
int16_t lpc_coefs[2][32];
int lpc_order[2];
int prediction_type[2];
int lpc_quant[2];
int rice_history_mult[2];
decorr_shift = get_bits(&alac->gb, 8);
decorr_left_weight = get_bits(&alac->gb, 8);
for (ch = 0; ch < channels; ch++) {
prediction_type[ch] = get_bits(&alac->gb, 4);
lpc_quant[ch] = get_bits(&alac->gb, 4);
rice_history_mult[ch] = get_bits(&alac->gb, 3);
lpc_order[ch] = get_bits(&alac->gb, 5);
for (i = 0; i < lpc_order[ch]; i++)
lpc_coefs[ch][i] = get_sbits(&alac->gb, 16);
}
if (alac->extra_bits) {
for (i = 0; i < alac->nb_samples; i++) {
for (ch = 0; ch < channels; ch++)
alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits);
}
}
for (ch = 0; ch < channels; ch++) {
rice_decompress(alac, alac->predict_error_buffer[ch],
alac->nb_samples, bps,
rice_history_mult[ch] * alac->rice_history_mult / 4);
if (prediction_type[ch] == 15) {
lpc_prediction(alac->predict_error_buffer[ch],
alac->predict_error_buffer[ch],
alac->nb_samples, bps, NULL, 31, 0);
} else if (prediction_type[ch] > 0) {
av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",
prediction_type[ch]);
}
lpc_prediction(alac->predict_error_buffer[ch],
alac->output_samples_buffer[ch], alac->nb_samples,
bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);
}
} else {
for (i = 0; i < alac->nb_samples; i++) {
for (ch = 0; ch < channels; ch++) {
alac->output_samples_buffer[ch][i] =
get_sbits_long(&alac->gb, alac->sample_size);
}
}
alac->extra_bits = 0;
decorr_shift = 0;
decorr_left_weight = 0;
}
if (channels == 2 && decorr_left_weight) {
decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,
decorr_shift, decorr_left_weight);
}
if (alac->extra_bits) {
append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,
alac->extra_bits, channels, alac->nb_samples);
}
switch(alac->sample_size) {
case 16: {
for (ch = 0; ch < channels; ch++) {
int16_t *outbuffer = (int16_t *)alac->frame.extended_data[ch_index + ch];
for (i = 0; i < alac->nb_samples; i++)
*outbuffer++ = alac->output_samples_buffer[ch][i];
}}
break;
case 24: {
for (ch = 0; ch < channels; ch++) {
for (i = 0; i < alac->nb_samples; i++)
alac->output_samples_buffer[ch][i] <<= 8;
}}
break;
}
return 0;
}
libavcodec/alac.c:384: error: Uninitialized Value
The value read from lpc_order[_] was never initialized.
libavcodec/alac.c:384:13:
382. prediction_type[ch]);
383. }
384. lpc_prediction(alac->predict_error_buffer[ch],
^
385. alac->output_samples_buffer[ch], alac->nb_samples,
386. bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);
|
https://github.com/libav/libav/blob/b70d89a033dacf53758256f875f1b23ce0ae13f1/libavcodec/alac.c/#L384
|
d2a_code_trace_data_45829
|
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` + 34]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 14 steps of the trace
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->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: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:317:1: Parameter `pkt->written`
315. }
316.
317. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len,
318. size_t lenbytes)
319. {
ssl/packet.c:320:10: Call
318. size_t lenbytes)
319. {
320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
321. || !WPACKET_memcpy(pkt, src, len)
322. || !WPACKET_close(pkt))
ssl/packet.c:224:1: Parameter `pkt->written`
222. }
223.
224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
225. {
226. WPACKET_SUB *sub;
ssl/packet.c:248:10: Call
246. }
247.
248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
249. return 0;
250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:36:1: <LHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `pkt->buf->length`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: <RHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `len`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 34]):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_45830
|
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
{
ssl_clear_hash_ctx(hash);
*hash = EVP_MD_CTX_new();
if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
EVP_MD_CTX_free(*hash);
*hash = NULL;
return NULL;
}
return *hash;
}
ssl/ssl_lib.c:3183: error: NULL_DEREFERENCE
pointer `*hash` last assigned on line 3181 could be null and is dereferenced by call to `EVP_MD_CTX_free()` at line 3183, column 9.
Showing all 26 steps of the trace
ssl/ssl_lib.c:3178:1: start of procedure ssl_replace_hash()
3176. */
3177.
3178. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3179. {
3180. ssl_clear_hash_ctx(hash);
ssl/ssl_lib.c:3180:5:
3178. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3179. {
3180. > ssl_clear_hash_ctx(hash);
3181. *hash = EVP_MD_CTX_new();
3182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
ssl/ssl_lib.c:3190:1: start of procedure ssl_clear_hash_ctx()
3188. }
3189.
3190. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
3191. {
3192.
ssl/ssl_lib.c:3193:9: Taking false branch
3191. {
3192.
3193. if (*hash)
^
3194. EVP_MD_CTX_free(*hash);
3195. *hash = NULL;
ssl/ssl_lib.c:3195:5:
3193. if (*hash)
3194. EVP_MD_CTX_free(*hash);
3195. > *hash = NULL;
3196. }
3197.
ssl/ssl_lib.c:3196:1: return from a call to ssl_clear_hash_ctx
3194. EVP_MD_CTX_free(*hash);
3195. *hash = NULL;
3196. > }
3197.
3198. /* Retrieve handshake hashes */
ssl/ssl_lib.c:3181:5:
3179. {
3180. ssl_clear_hash_ctx(hash);
3181. > *hash = EVP_MD_CTX_new();
3182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3183. EVP_MD_CTX_free(*hash);
crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new()
151. }
152.
153. > EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:155:5:
153. EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. }
157.
crypto/mem.c:312:1: start of procedure CRYPTO_zalloc()
310. }
311.
312. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
313. {
314. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:314:5:
312. void *CRYPTO_zalloc(size_t num, const char *file, int line)
313. {
314. > void *ret = CRYPTO_malloc(num, file, line);
315.
316. if (ret != NULL)
crypto/mem.c:279:1: start of procedure CRYPTO_malloc()
277. }
278.
279. > void *CRYPTO_malloc(size_t num, const char *file, int line)
280. {
281. void *ret = NULL;
crypto/mem.c:281:5:
279. void *CRYPTO_malloc(size_t num, const char *file, int line)
280. {
281. > void *ret = NULL;
282.
283. if (num <= 0)
crypto/mem.c:283:9: Taking false branch
281. void *ret = NULL;
282.
283. if (num <= 0)
^
284. return NULL;
285.
crypto/mem.c:286:9: Taking false branch
284. return NULL;
285.
286. if (allow_customize)
^
287. allow_customize = 0;
288. if (malloc_debug_func != NULL) {
crypto/mem.c:288:9: Taking false branch
286. if (allow_customize)
287. allow_customize = 0;
288. if (malloc_debug_func != NULL) {
^
289. if (allow_customize_debug)
290. allow_customize_debug = 0;
crypto/mem.c:293:5: Skipping __function_pointer__(): unresolved function pointer
291. malloc_debug_func(NULL, num, file, line, 0);
292. }
293. ret = malloc_ex_func(num, file, line);
^
294. if (malloc_debug_func != NULL)
295. malloc_debug_func(ret, num, file, line, 1);
crypto/mem.c:294:9: Taking false branch
292. }
293. ret = malloc_ex_func(num, file, line);
294. if (malloc_debug_func != NULL)
^
295. malloc_debug_func(ret, num, file, line, 1);
296.
crypto/mem.c:309:5:
307. #endif
308.
309. > return ret;
310. }
311.
crypto/mem.c:310:1: return from a call to CRYPTO_malloc
308.
309. return ret;
310. > }
311.
312. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:316:9: Taking false branch
314. void *ret = CRYPTO_malloc(num, file, line);
315.
316. if (ret != NULL)
^
317. memset(ret, 0, num);
318. return ret;
crypto/mem.c:318:5:
316. if (ret != NULL)
317. memset(ret, 0, num);
318. > return ret;
319. }
320.
crypto/mem.c:319:1: return from a call to CRYPTO_zalloc
317. memset(ret, 0, num);
318. return ret;
319. > }
320.
321. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. > }
157.
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
ssl/ssl_lib.c:3182:9: Taking true branch
3180. ssl_clear_hash_ctx(hash);
3181. *hash = EVP_MD_CTX_new();
3182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
^
3183. EVP_MD_CTX_free(*hash);
3184. *hash = NULL;
ssl/ssl_lib.c:3183:9:
3181. *hash = EVP_MD_CTX_new();
3182. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3183. > EVP_MD_CTX_free(*hash);
3184. *hash = NULL;
3185. return NULL;
|
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/ssl/ssl_lib.c/#L3183
|
d2a_code_trace_data_45831
|
static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
pkt->curr += len;
pkt->remaining -= len;
}
test/packettest.c:167: error: INTEGER_OVERFLOW_L2
([0, +oo] - 247):unsigned64 by call to `PACKET_forward`.
Showing all 14 steps of the trace
test/packettest.c:160:10: Call
158. PACKET pkt;
159.
160. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
^
161. || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))
162. || !TEST_uchar_eq(bytes[0], 2)
ssl/packet_locl.h:72:8: Parameter `pkt->remaining`
70. * is being used.
71. */
72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt,
^
73. const unsigned char *buf,
74. size_t len)
test/packettest.c:161:17: Call
159.
160. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
161. || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))
^
162. || !TEST_uchar_eq(bytes[0], 2)
163. || !TEST_uchar_eq(bytes[1], 4)
ssl/packet_locl.h:350:8: Parameter `pkt->remaining`
348. * freed
349. */
350. __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt,
^
351. const unsigned char **data,
352. size_t len)
ssl/packet_locl.h:354:10: Call
352. size_t len)
353. {
354. if (!PACKET_peek_bytes(pkt, data, len))
^
355. return 0;
356.
ssl/packet_locl.h:332:8: Parameter `len`
330. * underlying buffer gets freed
331. */
332. __owur static ossl_inline int PACKET_peek_bytes(const PACKET *pkt,
^
333. const unsigned char **data,
334. size_t len)
test/packettest.c:167:17: Call
165. || !TEST_uchar_eq(bytes[3], 8)
166. || !TEST_size_t_eq(PACKET_remaining(&pkt), BUF_LEN -4)
167. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8))
^
168. || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4))
169. || !TEST_uchar_eq(bytes[0], 0xf8)
ssl/packet_locl.h:467:8: Parameter `len`
465.
466. /* Move the current reading position forward |len| bytes */
467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
^
468. {
469. if (PACKET_remaining(pkt) < len)
ssl/packet_locl.h:472:5: Call
470. return 0;
471.
472. packet_forward(pkt, len);
^
473.
474. return 1;
ssl/packet_locl.h:33:1: <LHS trace>
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:33:1: Parameter `pkt->remaining`
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:33:1: <RHS trace>
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:33:1: Parameter `len`
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 247):unsigned64 by call to `PACKET_forward`
34. {
35. pkt->curr += len;
36. pkt->remaining -= len;
^
37. }
38.
|
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
|
d2a_code_trace_data_45832
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_gf2m.c:891: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqr_arr`.
Showing all 13 steps of the trace
crypto/bn/bn_gf2m.c:856:1: Parameter `ctx->stack.depth`
854. * Uses algorithms A.4.7 and A.4.6 from IEEE P1363.
855. */
856. > int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], BN_CTX *ctx)
857. {
858. int ret = 0, count = 0, j;
crypto/bn/bn_gf2m.c:870:2: Call
868. }
869.
870. BN_CTX_start(ctx);
^
871. a = BN_CTX_get(ctx);
872. z = 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_gf2m.c:891:9: Call
889. for (j = 1; j <= (p[0] - 1) / 2; j++)
890. {
891. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) goto err;
^
892. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) goto err;
893. if (!BN_GF2m_add(z, z, a)) goto err;
crypto/bn/bn_gf2m.c:457:1: Parameter `ctx->stack.depth`
455.
456. /* Square a, reduce the result mod p, and store it in a. r could be a. */
457. > int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx)
458. {
459. int i, ret = 0;
crypto/bn/bn_gf2m.c:463:2: Call
461.
462. bn_check_top(a);
463. BN_CTX_start(ctx);
^
464. if ((s = BN_CTX_get(ctx)) == NULL) return 0;
465. if (!bn_wexpand(s, 2 * a->top)) goto err;
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_gf2m.c:479:2: Call
477. ret = 1;
478. err:
479. BN_CTX_end(ctx);
^
480. return ret;
481. }
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_GF2m_mod_sqr_arr`
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/8211a33c7f37e58063d1294d8df294c7d9a1c1bf/crypto/bn/bn_ctx.c/#L353
|
d2a_code_trace_data_45833
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_mont.c:157: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set`.
Showing all 44 steps of the trace
crypto/ec/ecp_mont.c:135:1: Parameter `ctx->stack.depth`
133. }
134.
135. > int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
136. const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
137. {
crypto/ec/ecp_mont.c:157:10: Call
155. if (mont == NULL)
156. goto err;
157. if (!BN_MONT_CTX_set(mont, p, ctx)) {
^
158. ECerr(EC_F_EC_GFP_MONT_GROUP_SET_CURVE, ERR_R_BN_LIB);
159. goto err;
crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth`
261. }
262.
263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
264. {
265. int i, ret = 0;
crypto/bn/bn_mont.c:271:5: Call
269. return 0;
270.
271. BN_CTX_start(ctx);
^
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
273. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:272:15: Call
270.
271. BN_CTX_start(ctx);
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
^
273. goto err;
274. R = &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mont.c:351:19: Call
349. if (BN_is_one(&tmod))
350. BN_zero(Ri);
351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
^
352. goto err;
353. if (!BN_lshift(Ri, Ri, BN_BITS2))
crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth`
122. BN_CTX *ctx);
123.
124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
126. {
crypto/bn/bn_gcd.c:129:10: Call
127. BIGNUM *rv;
128. int noinv;
129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
^
130. if (noinv)
131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);
crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth`
133. }
134.
135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
137. int *pnoinv)
crypto/bn/bn_gcd.c:155:16: Call
153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
155. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
156. }
157.
crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth`
456. * not contain branches that may leak sensitive information.
457. */
458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
459. const BIGNUM *a, const BIGNUM *n,
460. BN_CTX *ctx)
crypto/bn/bn_gcd.c:469:5: Call
467. bn_check_top(n);
468.
469. BN_CTX_start(ctx);
^
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gcd.c:470:9: Call
468.
469. BN_CTX_start(ctx);
470. A = BN_CTX_get(ctx);
^
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:471:9: Call
469. BN_CTX_start(ctx);
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
^
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:472:9: Call
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
^
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:473:9: Call
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
^
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:474:9: Call
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
^
475. Y = BN_CTX_get(ctx);
476. T = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:475:9: Call
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
^
476. T = BN_CTX_get(ctx);
477. if (T == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:476:9: Call
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
476. T = BN_CTX_get(ctx);
^
477. if (T == NULL)
478. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:504:18: Call
502. bn_init(&local_B);
503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME);
504. if (!BN_nnmod(B, &local_B, A, ctx))
^
505. goto err;
506. /* Ensure local_B goes out of scope before any further use of B */
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:280:5: Call
278. bn_check_top(rm);
279.
280. BN_CTX_start(ctx);
^
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_div.c:450:5: Call
448. if (rm != NULL)
449. bn_rshift_fixed_top(rm, snum, norm_shift);
450. BN_CTX_end(ctx);
^
451. return 1;
452. err:
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set`
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_45834
|
int RAND_status(void)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->status != NULL)
return meth->status();
return 0;
}
crypto/rand/rand_lib.c:914: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 912 could be null and is dereferenced at line 914, column 9.
Showing all 6 steps of the trace
crypto/rand/rand_lib.c:910:1: start of procedure RAND_status()
908. #endif
909.
910. > int RAND_status(void)
911. {
912. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:912:5:
910. int RAND_status(void)
911. {
912. > const RAND_METHOD *meth = RAND_get_rand_method();
913.
914. if (meth->status != NULL)
crypto/rand/rand_lib.c:770:1: start of procedure RAND_get_rand_method()
768. #endif
769.
770. > const RAND_METHOD *RAND_get_rand_method(void)
771. {
772. #ifdef FIPS_MODE
crypto/rand/rand_lib.c:773:5:
771. {
772. #ifdef FIPS_MODE
773. > return NULL;
774. #else
775. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:802:1: return from a call to RAND_get_rand_method
800. return tmp_meth;
801. #endif
802. > }
803.
804. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
crypto/rand/rand_lib.c:914:9:
912. const RAND_METHOD *meth = RAND_get_rand_method();
913.
914. > if (meth->status != NULL)
915. return meth->status();
916. return 0;
|
https://github.com/openssl/openssl/blob/6b3d0423528b049d04b299a8588a32d5c1224717/crypto/rand/rand_lib.c/#L914
|
d2a_code_trace_data_45835
|
static int mpegts_write_header(AVFormatContext *s)
{
MpegTSWrite *ts = s->priv_data;
MpegTSWriteStream *ts_st;
MpegTSService *service;
AVStream *st;
int i, total_bit_rate;
const char *service_name;
ts->tsid = DEFAULT_TSID;
ts->onid = DEFAULT_ONID;
service_name = s->title;
if (service_name[0] == '\0')
service_name = DEFAULT_SERVICE_NAME;
service = mpegts_add_service(ts, DEFAULT_SID,
DEFAULT_PROVIDER_NAME, service_name);
service->pmt.write_packet = section_write_packet;
service->pmt.opaque = s;
ts->pat.pid = PAT_PID;
ts->pat.cc = 0;
ts->pat.write_packet = section_write_packet;
ts->pat.opaque = s;
ts->sdt.pid = SDT_PID;
ts->sdt.cc = 0;
ts->sdt.write_packet = section_write_packet;
ts->sdt.opaque = s;
total_bit_rate = 0;
for(i = 0;i < s->nb_streams; i++) {
st = s->streams[i];
ts_st = av_mallocz(sizeof(MpegTSWriteStream));
if (!ts_st)
goto fail;
st->priv_data = ts_st;
ts_st->service = service;
ts_st->pid = DEFAULT_START_PID + i;
ts_st->payload_pts = AV_NOPTS_VALUE;
ts_st->payload_dts = AV_NOPTS_VALUE;
if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
service->pcr_pid == 0x1fff)
service->pcr_pid = ts_st->pid;
total_bit_rate += st->codec->bit_rate;
}
if (service->pcr_pid == 0x1fff && s->nb_streams > 0) {
ts_st = s->streams[0]->priv_data;
service->pcr_pid = ts_st->pid;
}
if (total_bit_rate <= 8 * 1024)
total_bit_rate = 8 * 1024;
service->pcr_packet_freq = (total_bit_rate * PCR_RETRANS_TIME) /
(TS_PACKET_SIZE * 8 * 1000);
ts->sdt_packet_freq = (total_bit_rate * SDT_RETRANS_TIME) /
(TS_PACKET_SIZE * 8 * 1000);
ts->pat_packet_freq = (total_bit_rate * PAT_RETRANS_TIME) /
(TS_PACKET_SIZE * 8 * 1000);
#if 0
printf("%d %d %d\n",
total_bit_rate, ts->sdt_packet_freq, ts->pat_packet_freq);
#endif
mpegts_write_sdt(s);
mpegts_write_pat(s);
for(i = 0; i < ts->nb_services; i++) {
mpegts_write_pmt(s, ts->services[i]);
}
put_flush_packet(s->pb);
return 0;
fail:
for(i = 0;i < s->nb_streams; i++) {
st = s->streams[i];
av_free(st->priv_data);
}
return -1;
}
libavformat/mpegtsenc.c:405: error: Integer Overflow L1
([0, +oo] + 9223372036854775808):signed32.
libavformat/mpegtsenc.c:390:5: <LHS trace>
388.
389. /* assign pids to each stream */
390. total_bit_rate = 0;
^
391. for(i = 0;i < s->nb_streams; i++) {
392. st = s->streams[i];
libavformat/mpegtsenc.c:390:5: Assignment
388.
389. /* assign pids to each stream */
390. total_bit_rate = 0;
^
391. for(i = 0;i < s->nb_streams; i++) {
392. st = s->streams[i];
libavformat/mpegtsenc.c:400:9: <RHS trace>
398. ts_st->pid = DEFAULT_START_PID + i;
399. ts_st->payload_pts = AV_NOPTS_VALUE;
400. ts_st->payload_dts = AV_NOPTS_VALUE;
^
401. /* update PCR pid by using the first video stream */
402. if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
libavformat/mpegtsenc.c:400:9: Assignment
398. ts_st->pid = DEFAULT_START_PID + i;
399. ts_st->payload_pts = AV_NOPTS_VALUE;
400. ts_st->payload_dts = AV_NOPTS_VALUE;
^
401. /* update PCR pid by using the first video stream */
402. if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
libavformat/mpegtsenc.c:405:9: Binary operation: ([0, +oo] + 9223372036854775808):signed32
403. service->pcr_pid == 0x1fff)
404. service->pcr_pid = ts_st->pid;
405. total_bit_rate += st->codec->bit_rate;
^
406. }
407.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegtsenc.c/#L405
|
d2a_code_trace_data_45836
|
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)
{
const unsigned char *p= *pp;
unsigned long ret=0;
unsigned int i;
if (max-- < 1) return(0);
if (*p == 0x80)
{
*inf=1;
ret=0;
p++;
}
else
{
*inf=0;
i= *p&0x7f;
if (*(p++) & 0x80)
{
if (max < (int)i)
return 0;
while (i && *p == 0)
{
p++;
i--;
}
if (i > sizeof(long))
return 0;
while (i-- > 0)
{
ret<<=8L;
ret|= *(p++);
}
}
else
ret=i;
}
if (ret > LONG_MAX)
return 0;
*pp=p;
*rl=(long)ret;
return(1);
}
crypto/asn1/asn1_lib.c:183: error: INTEGER_OVERFLOW_L2
([0, min(8, `**pp`)] - 1):unsigned32.
Showing all 4 steps of the trace
crypto/asn1/asn1_lib.c:154:1: <LHS trace>
152. }
153.
154. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)
155. {
156. const unsigned char *p= *pp;
crypto/asn1/asn1_lib.c:154:1: Parameter `max`
152. }
153.
154. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)
155. {
156. const unsigned char *p= *pp;
crypto/asn1/asn1_lib.c:160:6: Assignment
158. unsigned int i;
159.
160. if (max-- < 1) return(0);
^
161. if (*p == 0x80)
162. {
crypto/asn1/asn1_lib.c:183:11: Binary operation: ([0, min(8, **pp)] - 1):unsigned32
181. if (i > sizeof(long))
182. return 0;
183. while (i-- > 0)
^
184. {
185. ret<<=8L;
|
https://github.com/openssl/openssl/blob/7ae6a4b659facfd7ad8131238aa1d349cb3fc951/crypto/asn1/asn1_lib.c/#L183
|
d2a_code_trace_data_45837
|
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/ec/ecdsa_ossl.c:131: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `ec_group_do_inverse_ord`.
Showing all 40 steps of the trace
crypto/ec/ecdsa_ossl.c:33:1: Parameter `eckey->group->order->top`
31. }
32.
33. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
34. BIGNUM **kinvp, BIGNUM **rp,
35. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:76:18: Call
74.
75. /* Preallocate space */
76. order_bits = BN_num_bits(order);
^
77. if (!BN_set_bit(k, order_bits)
78. || !BN_set_bit(r, order_bits)
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:852:1: Parameter `a->top`
850. }
851.
852. > int BN_is_zero(const BIGNUM *a)
853. {
854. return a->top == 0;
crypto/ec/ecdsa_ossl.c:94:22: Call
92. }
93. } else {
94. if (!BN_priv_rand_range(k, order)) {
^
95. ECerr(EC_F_ECDSA_SIGN_SETUP,
96. EC_R_RANDOM_NUMBER_GENERATION_FAILED);
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/ec/ecdsa_ossl.c:103:14: Call
101.
102. /* compute r the x-coordinate of generator * k */
103. if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) {
^
104. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB);
105. goto err;
crypto/ec/ec_lib.c:956:1: Parameter `group->order->top`
954. }
955.
956. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
957. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx)
958. {
crypto/ec/ec_lib.c:967:12: Call
965. scalars[0] = p_scalar;
966.
967. return EC_POINTs_mul(group, r, g_scalar,
^
968. (point != NULL
969. && 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/ecdsa_ossl.c:124:14: Call
122. }
123. #endif
124. if (!BN_nnmod(r, X, order, ctx)) {
^
125. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
126. goto err;
crypto/bn/bn_mod.c:13:1: Parameter `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:137:1: Parameter `divisor->top`
135. * If 'dv' or 'rm' is NULL, the respective value is not returned.
136. */
137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
138. BN_CTX *ctx)
139. {
crypto/ec/ecdsa_ossl.c:131:10: Call
129.
130. /* compute the inverse of k */
131. if (!ec_group_do_inverse_ord(group, k, k, ctx)) {
^
132. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
133. goto err;
crypto/ec/ec_lib.c:1101:1: Parameter `group->order->top`
1099. * other functionality.
1100. */
1101. > int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
1102. const BIGNUM *x, BN_CTX *ctx)
1103. {
crypto/ec/ec_lib.c:1107:16: Call
1105. return group->meth->field_inverse_mod_ord(group, res, x, ctx);
1106. else
1107. return ec_field_inverse_mod_ord(group, res, x, ctx);
^
1108. }
1109.
crypto/ec/ec_lib.c:1047:1: Parameter `group->order->top`
1045. }
1046.
1047. > static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r,
1048. const BIGNUM *x, BN_CTX *ctx)
1049. {
crypto/ec/ec_lib.c:1070:10: Call
1068. if (!BN_set_word(e, 2))
1069. goto err;
1070. if (!BN_sub(e, group->order, e))
^
1071. goto err;
1072. /*-
crypto/bn/bn_add.c:45:1: Parameter `a->top`
43.
44. /* signed sub of b from a. */
45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
46. {
47. int ret, r_neg, cmp_res;
crypto/ec/ec_lib.c:1076:10: Call
1074. * No need for scatter-gather or BN_FLG_CONSTTIME.
1075. */
1076. if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data))
^
1077. goto err;
1078.
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:597:1: Parameter `m->top`
595. * http://www.daemonology.net/hyperthreading-considered-harmful/)
596. */
597. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
598. const BIGNUM *m, BN_CTX *ctx,
599. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:618:10: Call
616. bn_check_top(m);
617.
618. if (!BN_is_odd(m)) {
^
619. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
620. return 0;
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:652:14: Call
650. if ((mont = BN_MONT_CTX_new()) == NULL)
651. goto err;
652. if (!BN_MONT_CTX_set(mont, m, ctx))
^
653. goto err;
654. }
crypto/bn/bn_mont.c:251:1: Parameter `mod->top`
249. }
250.
251. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
252. {
253. int i, ret = 0;
crypto/bn/bn_mont.c:256:9: Call
254. BIGNUM *Ri, *R;
255.
256. if (BN_is_zero(mod))
^
257. return 0;
258.
crypto/bn/bn_lib.c:852:1: Parameter `a->top`
850. }
851.
852. > int BN_is_zero(const BIGNUM *a)
853. {
854. return a->top == 0;
crypto/bn/bn_mont.c:263:10: Call
261. goto err;
262. R = &(mont->RR); /* grab RR as a temp */
263. if (!BN_copy(&(mont->N), mod))
^
264. goto err; /* Set N */
265. if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
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: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:291:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `ec_group_do_inverse_ord`
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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L291
|
d2a_code_trace_data_45838
|
static int mem_init(BIO *bi, unsigned long flags)
{
BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
if (bb == NULL)
return(0);
if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
return(0);
if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
return(0);
*bb->readp = *bb->buf;
bi->shutdown = 1;
bi->init = 1;
bi->num = -1;
bi->ptr = (char *)bb;
return(1);
}
crypto/bio/bss_mem.c:155: error: MEMORY_LEAK
memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 150, column 23 is not reachable after line 155, column 9.
Showing all 21 steps of the trace
crypto/bio/bss_mem.c:148:1: start of procedure mem_init()
146. }
147.
148. > static int mem_init(BIO *bi, unsigned long flags)
149. {
150. BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
crypto/bio/bss_mem.c:150:5:
148. static int mem_init(BIO *bi, unsigned long flags)
149. {
150. > BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
151.
152. if (bb == NULL)
crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
144. }
145.
146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:148:5:
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. > void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
117. }
118.
119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. void *ret = NULL;
crypto/mem.c:121:5:
119. void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. > void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:123:9: Taking false branch
121. void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
124. return malloc_impl(num, file, line);
125.
crypto/mem.c:126:9: Taking false branch
124. return malloc_impl(num, file, line);
125.
126. if (num <= 0)
^
127. return NULL;
128.
crypto/mem.c:129:5:
127. return NULL;
128.
129. > allow_customize = 0;
130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
131. if (call_malloc_debug) {
crypto/mem.c:139:5:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:139:24:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:140:5:
138. #else
139. osslargused(file); osslargused(line);
140. > ret = malloc(num);
141. #endif
142.
crypto/mem.c:143:5:
141. #endif
142.
143. > return ret;
144. }
145.
crypto/mem.c:144:1: return from a call to CRYPTO_malloc
142.
143. return ret;
144. > }
145.
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:150:9: Taking true branch
148. void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
^
151. memset(ret, 0, num);
152. return ret;
crypto/mem.c:151:9:
149.
150. if (ret != NULL)
151. > memset(ret, 0, num);
152. return ret;
153. }
crypto/mem.c:152:5:
150. if (ret != NULL)
151. memset(ret, 0, num);
152. > return ret;
153. }
154.
crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
151. memset(ret, 0, num);
152. return ret;
153. > }
154.
155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bio/bss_mem.c:152:9: Taking false branch
150. BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
151.
152. if (bb == NULL)
^
153. return(0);
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
crypto/bio/bss_mem.c:154:9: Taking true branch
152. if (bb == NULL)
153. return(0);
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
^
155. return(0);
156. if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
crypto/bio/bss_mem.c:155:9:
153. return(0);
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
155. > return(0);
156. if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
157. return(0);
|
https://github.com/openssl/openssl/blob/cb2ceb18f242bbc573c0e332f34b9ca42fc5f561/crypto/bio/bss_mem.c/#L155
|
d2a_code_trace_data_45839
|
static ngx_int_t
ngx_http_upstream_send_request_body(ngx_http_request_t *r,
ngx_http_upstream_t *u, ngx_uint_t do_write)
{
int tcp_nodelay;
ngx_int_t rc;
ngx_chain_t *out, *cl, *ln;
ngx_connection_t *c;
ngx_http_core_loc_conf_t *clcf;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http upstream send request body");
if (!r->request_body_no_buffering) {
if (!u->request_sent) {
u->request_sent = 1;
out = u->request_bufs;
} else {
out = NULL;
}
return ngx_output_chain(&u->output, out);
}
if (!u->request_sent) {
u->request_sent = 1;
out = u->request_bufs;
if (r->request_body->bufs) {
for (cl = out; cl->next; cl = out->next) { }
cl->next = r->request_body->bufs;
r->request_body->bufs = NULL;
}
c = u->peer.connection;
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->tcp_nodelay && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) {
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay");
tcp_nodelay = 1;
if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
(const void *) &tcp_nodelay, sizeof(int)) == -1)
{
ngx_connection_error(c, ngx_socket_errno,
"setsockopt(TCP_NODELAY) failed");
return NGX_ERROR;
}
c->tcp_nodelay = NGX_TCP_NODELAY_SET;
}
r->read_event_handler = ngx_http_upstream_read_request_handler;
} else {
out = NULL;
}
for ( ;; ) {
if (do_write) {
rc = ngx_output_chain(&u->output, out);
if (rc == NGX_ERROR) {
return NGX_ERROR;
}
while (out) {
ln = out;
out = out->next;
ngx_free_chain(r->pool, ln);
}
if (rc == NGX_OK && !r->reading_body) {
break;
}
}
if (r->reading_body) {
rc = ngx_http_read_unbuffered_request_body(r);
if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
return rc;
}
out = r->request_body->bufs;
r->request_body->bufs = NULL;
}
if (out == NULL) {
rc = NGX_AGAIN;
break;
}
do_write = 1;
}
if (!r->reading_body) {
if (!u->store && !r->post_action && !u->conf->ignore_client_abort) {
r->read_event_handler =
ngx_http_upstream_rd_check_broken_connection;
}
}
return rc;
}
src/http/ngx_http_upstream.c:1928: error: Uninitialized Value
The value read from rc was never initialized.
src/http/ngx_http_upstream.c:1928:5:
1926. }
1927.
1928. return rc;
^
1929. }
1930.
|
https://github.com/nginx/nginx/blob/44586bf5ee34a56f877ab04dc79fed279e1d52cb/src/http/ngx_http_upstream.c/#L1928
|
d2a_code_trace_data_45840
|
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:3762: error: Null Dereference
pointer `p` last assigned on line 3762 could be null and is dereferenced at line 3762, column 5.
ffmpeg.c:3748:1: start of procedure opt_streamid()
3746.
3747. /* arg format is "output-stream-index:streamid-value". */
3748. static int opt_streamid(const char *opt, const char *arg)
^
3749. {
3750. int idx;
ffmpeg.c:3754:5:
3752. char idx_str[16];
3753.
3754. av_strlcpy(idx_str, arg, sizeof(idx_str));
^
3755. p = strchr(idx_str, ':');
3756. 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:3755:5:
3753.
3754. av_strlcpy(idx_str, arg, sizeof(idx_str));
3755. p = strchr(idx_str, ':');
^
3756. if (!p) {
3757. fprintf(stderr,
ffmpeg.c:3756:10: Taking true branch
3754. av_strlcpy(idx_str, arg, sizeof(idx_str));
3755. p = strchr(idx_str, ':');
3756. if (!p) {
^
3757. fprintf(stderr,
3758. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
ffmpeg.c:3757:9:
3755. p = strchr(idx_str, ':');
3756. if (!p) {
3757. fprintf(stderr,
^
3758. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3759. arg, opt);
ffmpeg.c:3760:9: Skipping ffmpeg_exit(): empty list of specs
3758. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3759. arg, opt);
3760. ffmpeg_exit(1);
^
3761. }
3762. *p++ = '\0';
ffmpeg.c:3762:5:
3760. ffmpeg_exit(1);
3761. }
3762. *p++ = '\0';
^
3763. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3764. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
|
https://github.com/libav/libav/blob/6465c820da7b104150366a8cdd837c00cf364235/ffmpeg.c/#L3762
|
d2a_code_trace_data_45841
|
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:724: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 693, column 9 is not reachable after line 724, column 5.
Showing all 97 steps of the trace
test/bntest.c:688:1: start of procedure test_sqr()
686. }
687.
688. > int test_sqr(BIO *bp, BN_CTX *ctx)
689. {
690. BIGNUM *a, *c, *d, *e;
test/bntest.c:691:5:
689. {
690. BIGNUM *a, *c, *d, *e;
691. > int i, ret = 0;
692.
693. a = BN_new();
test/bntest.c:693:5:
691. int i, ret = 0;
692.
693. > a = BN_new();
694. c = BN_new();
695. 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:694:5:
692.
693. a = BN_new();
694. > c = BN_new();
695. d = BN_new();
696. 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:695:5:
693. a = BN_new();
694. c = BN_new();
695. > d = BN_new();
696. e = BN_new();
697. 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:696:5:
694. c = BN_new();
695. d = BN_new();
696. > e = BN_new();
697. if (a == NULL || c == NULL || d == NULL || e == NULL) {
698. 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:697:9: Taking false branch
695. d = BN_new();
696. e = BN_new();
697. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
698. goto err;
699. }
test/bntest.c:697:22: Taking false branch
695. d = BN_new();
696. e = BN_new();
697. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
698. goto err;
699. }
test/bntest.c:697:35: Taking false branch
695. d = BN_new();
696. e = BN_new();
697. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
698. goto err;
699. }
test/bntest.c:697:48: Taking false branch
695. d = BN_new();
696. e = BN_new();
697. if (a == NULL || c == NULL || d == NULL || e == NULL) {
^
698. goto err;
699. }
test/bntest.c:701:10:
699. }
700.
701. > for (i = 0; i < num0; i++) {
702. BN_bntest_rand(a, 40 + i * 10, 0, 0);
703. a->neg = rand_neg();
test/bntest.c:701:17: Loop condition is false. Leaving loop
699. }
700.
701. for (i = 0; i < num0; i++) {
^
702. BN_bntest_rand(a, 40 + i * 10, 0, 0);
703. a->neg = rand_neg();
test/bntest.c:724:5: Skipping BN_hex2bn(): empty list of specs
722.
723. /* Regression test for a BN_sqr overflow bug. */
724. BN_hex2bn(&a,
^
725. "80000000000000008000000000000001"
726. "FFFFFFFFFFFFFFFE0000000000000000");
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L724
|
d2a_code_trace_data_45842
|
static int fill_default_ref_list(H264Context *h){
MpegEncContext * const s = &h->s;
int i;
int smallest_poc_greater_than_current = -1;
int structure_sel;
Picture sorted_short_ref[32];
Picture field_entry_list[2][32];
Picture *frame_list[2];
if (FIELD_PICTURE) {
structure_sel = PICT_FRAME;
frame_list[0] = field_entry_list[0];
frame_list[1] = field_entry_list[1];
} else {
structure_sel = 0;
frame_list[0] = h->default_ref_list[0];
frame_list[1] = h->default_ref_list[1];
}
if(h->slice_type==FF_B_TYPE){
int list;
int len[2];
int short_len[2];
int out_i;
int limit= INT_MIN;
for(out_i=0; out_i<h->short_ref_count; out_i++){
int best_i=INT_MIN;
int best_poc=INT_MAX;
for(i=0; i<h->short_ref_count; i++){
const int poc= h->short_ref[i]->poc;
if(poc > limit && poc < best_poc){
best_poc= poc;
best_i= i;
}
}
assert(best_i != INT_MIN);
limit= best_poc;
sorted_short_ref[out_i]= *h->short_ref[best_i];
tprintf(h->s.avctx, "sorted poc: %d->%d poc:%d fn:%d\n", best_i, out_i, sorted_short_ref[out_i].poc, sorted_short_ref[out_i].frame_num);
if (-1 == smallest_poc_greater_than_current) {
if (h->short_ref[best_i]->poc >= s->current_picture_ptr->poc) {
smallest_poc_greater_than_current = out_i;
}
}
}
tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current);
for(list=0; list<2; list++){
int index = 0;
int j= -99;
int step= list ? -1 : 1;
for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) {
int sel;
while(j<0 || j>= h->short_ref_count){
if(j != -99 && step == (list ? -1 : 1))
return -1;
step = -step;
j= smallest_poc_greater_than_current + (step>>1);
}
sel = sorted_short_ref[j].reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[list][index ]= sorted_short_ref[j];
frame_list[list][index++].pic_id= sorted_short_ref[j].frame_num;
}
short_len[list] = index;
for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[ list ][index ]= *h->long_ref[i];
frame_list[ list ][index++].pic_id= i;
}
len[list] = index;
}
for(list=0; list<2; list++){
if (FIELD_PICTURE)
len[list] = split_field_ref_list(h->default_ref_list[list],
h->ref_count[list],
frame_list[list],
len[list],
s->picture_structure,
short_len[list]);
if(list && len[0] > 1 && len[0] == len[1])
for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0]; i++)
if(i == len[0]){
FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]);
break;
}
if(len[list] < h->ref_count[ list ])
memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list]));
}
}else{
int index=0;
int short_len;
for(i=0; i<h->short_ref_count; i++){
int sel;
sel = h->short_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->short_ref[i];
frame_list[0][index++].pic_id= h->short_ref[i]->frame_num;
}
short_len = index;
for(i = 0; i < 16; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->long_ref[i];
frame_list[0][index++].pic_id= i;
}
if (FIELD_PICTURE)
index = split_field_ref_list(h->default_ref_list[0],
h->ref_count[0], frame_list[0],
index, s->picture_structure,
short_len);
if(index < h->ref_count[0])
memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index));
}
#ifdef TRACE
for (i=0; i<h->ref_count[0]; i++) {
tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
}
if(h->slice_type==FF_B_TYPE){
for (i=0; i<h->ref_count[1]; i++) {
tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]);
}
}
#endif
return 0;
}
libavcodec/h264.c:2945: error: Uninitialized Value
The value read from len[_] was never initialized.
libavcodec/h264.c:2945:16:
2943. }
2944.
2945. if(len[list] < h->ref_count[ list ])
^
2946. memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list]));
2947. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2945
|
d2a_code_trace_data_45843
|
static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
*h = desc->log2_chroma_w;
*v = desc->log2_chroma_h;
}
libswscale/utils.c:800: error: Null Dereference
pointer `desc` last assigned on line 799 could be null and is dereferenced at line 800, column 10.
libswscale/utils.c:797:1: start of procedure getSubSampleFactors()
795. #endif /* HAVE_MMXEXT_INLINE */
796.
797. static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
^
798. {
799. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
libswscale/utils.c:799:5:
797. static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
798. {
799. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
^
800. *h = desc->log2_chroma_w;
801. *v = desc->log2_chroma_h;
libavutil/pixdesc.c:1894:1: start of procedure av_pix_fmt_desc_get()
1892. }
1893.
1894. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1895. {
1896. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1896:9: Taking false branch
1894. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1895. {
1896. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1897. return NULL;
1898. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1896:24: Taking true branch
1894. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1895. {
1896. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1897. return NULL;
1898. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1897:9:
1895. {
1896. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1897. return NULL;
^
1898. return &av_pix_fmt_descriptors[pix_fmt];
1899. }
libavutil/pixdesc.c:1899:1: return from a call to av_pix_fmt_desc_get
1897. return NULL;
1898. return &av_pix_fmt_descriptors[pix_fmt];
1899. }
^
1900.
1901. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libswscale/utils.c:800:5:
798. {
799. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
800. *h = desc->log2_chroma_w;
^
801. *v = desc->log2_chroma_h;
802. }
|
https://github.com/libav/libav/blob/378460fef1e563704bc5a307ba748a2b819cc09d/libswscale/utils.c/#L800
|
d2a_code_trace_data_45844
|
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
{
int16_t weight[8][64];
DCTELEM orig[8][64];
const int mb_x= s->mb_x;
const int mb_y= s->mb_y;
int i;
int skip_dct[8];
int dct_offset = s->linesize*8;
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int wrap_y, wrap_c;
for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct;
if(s->adaptive_quant){
const int last_qp= s->qscale;
const int mb_xy= mb_x + mb_y*s->mb_stride;
s->lambda= s->lambda_table[mb_xy];
update_qscale(s);
if(!(s->flags&CODEC_FLAG_QP_RD)){
s->qscale= s->current_picture_ptr->qscale_table[mb_xy];
s->dquant= s->qscale - last_qp;
if(s->out_format==FMT_H263){
s->dquant= av_clip(s->dquant, -2, 2);
if(s->codec_id==CODEC_ID_MPEG4){
if(!s->mb_intra){
if(s->pict_type == FF_B_TYPE){
if(s->dquant&1 || s->mv_dir&MV_DIRECT)
s->dquant= 0;
}
if(s->mv_type==MV_TYPE_8X8)
s->dquant=0;
}
}
}
}
ff_set_qscale(s, last_qp + s->dquant);
}else if(s->flags&CODEC_FLAG_QP_RD)
ff_set_qscale(s, s->qscale + s->dquant);
wrap_y = s->linesize;
wrap_c = s->uvlinesize;
ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16;
ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
uint8_t *ebuf= s->edge_emu_buffer + 32;
ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height);
ptr_y= ebuf;
ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cb= ebuf+18*wrap_y;
ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cr= ebuf+18*wrap_y+8;
}
if (s->mb_intra) {
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400;
if(progressive_score > 0){
interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.get_pixels(s->block[0], ptr_y , wrap_y);
s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y);
s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y);
s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
}
}
}else{
op_pixels_func (*op_pix)[4];
qpel_mc_func (*op_qpix)[16];
uint8_t *dest_y, *dest_cb, *dest_cr;
dest_y = s->dest[0];
dest_cb = s->dest[1];
dest_cr = s->dest[2];
if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
op_pix = s->dsp.put_pixels_tab;
op_qpix= s->dsp.put_qpel_pixels_tab;
}else{
op_pix = s->dsp.put_no_rnd_pixels_tab;
op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_FORWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
op_pix = s->dsp.avg_pixels_tab;
op_qpix= s->dsp.avg_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_BACKWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
}
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400;
if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400;
if(progressive_score>0){
interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y);
s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y);
s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y);
s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
}
}
if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){
if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1;
if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1;
if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
if(!s->chroma_y_shift){
if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
}
}
}
if(s->avctx->quantizer_noise_shaping){
if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y);
if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y);
if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y);
if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c);
if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c);
if(!s->chroma_y_shift){
if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
}
memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
}
assert(s->out_format!=FMT_MJPEG || s->qscale==8);
{
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
int overflow;
s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]);
}else
s->block_last_index[i]= -1;
}
if(s->avctx->quantizer_noise_shaping){
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale);
}
}
}
if(s->luma_elim_threshold && !s->mb_intra)
for(i=0; i<4; i++)
dct_single_coeff_elimination(s, i, s->luma_elim_threshold);
if(s->chroma_elim_threshold && !s->mb_intra)
for(i=4; i<mb_block_count; i++)
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
if(s->flags & CODEC_FLAG_CBP_RD){
for(i=0;i<mb_block_count;i++) {
if(s->block_last_index[i] == -1)
s->coded_score[i]= INT_MAX/256;
}
}
}
if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){
s->block_last_index[4]=
s->block_last_index[5]= 0;
s->block[4][0]=
s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
}
if(s->alternate_scan && s->dct_quantize != dct_quantize_c){
for(i=0; i<mb_block_count; i++){
int j;
if(s->block_last_index[i]>0){
for(j=63; j>0; j--){
if(s->block[i][ s->intra_scantable.permutated[j] ]) break;
}
s->block_last_index[i]= j;
}
}
}
switch(s->codec_id){
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER)
mpeg1_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MPEG4:
if (ENABLE_MPEG4_ENCODER)
mpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MSMPEG4V2:
case CODEC_ID_MSMPEG4V3:
case CODEC_ID_WMV1:
if (ENABLE_MSMPEG4_ENCODER)
msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_WMV2:
if (ENABLE_WMV2_ENCODER)
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H261:
if (ENABLE_H261_ENCODER)
ff_h261_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_FLV1:
case CODEC_ID_RV10:
case CODEC_ID_RV20:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER ||
ENABLE_FLV_ENCODER || ENABLE_RV10_ENCODER || ENABLE_RV20_ENCODER)
h263_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MJPEG:
if (ENABLE_MJPEG_ENCODER)
ff_mjpeg_encode_mb(s, s->block);
break;
default:
assert(0);
}
}
libavcodec/mpegvideo_enc.c:1645: error: Uninitialized Value
The value read from skip_dct[_] was never initialized.
libavcodec/mpegvideo_enc.c:1645:17:
1643. if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c);
1644. if(!s->chroma_y_shift){ /* 422 */
1645. if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
^
1646. if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
1647. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1645
|
d2a_code_trace_data_45845
|
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:774: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 772 could be null and is dereferenced at line 774, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:770:1: start of procedure RAND_seed()
768. #endif
769.
770. > void RAND_seed(const void *buf, int num)
771. {
772. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:772:5:
770. void RAND_seed(const void *buf, int num)
771. {
772. > const RAND_METHOD *meth = RAND_get_rand_method();
773.
774. if (meth->seed != NULL)
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:774:9:
772. const RAND_METHOD *meth = RAND_get_rand_method();
773.
774. > if (meth->seed != NULL)
775. meth->seed(buf, num);
776. }
|
https://github.com/openssl/openssl/blob/92ebf6c4c21ff4b41ba1fd69af74b2039e138114/crypto/rand/rand_lib.c/#L774
|
d2a_code_trace_data_45846
|
int test_gf2m_mod_mul(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b[2], *c, *d, *e, *f, *g, *h;
int i, j, ret = 0;
int p0[] = { 163, 7, 6, 3, 0, -1 };
int p1[] = { 193, 15, 0, -1 };
a = BN_new();
b[0] = BN_new();
b[1] = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
f = BN_new();
g = BN_new();
h = BN_new();
BN_GF2m_arr2poly(p0, b[0]);
BN_GF2m_arr2poly(p1, b[1]);
for (i = 0; i < num0; i++) {
BN_bntest_rand(a, 1024, 0, 0);
BN_bntest_rand(c, 1024, 0, 0);
BN_bntest_rand(d, 1024, 0, 0);
for (j = 0; j < 2; j++) {
BN_GF2m_mod_mul(e, a, c, b[j], ctx);
BN_GF2m_add(f, a, d);
BN_GF2m_mod_mul(g, f, c, b[j], ctx);
BN_GF2m_mod_mul(h, d, c, b[j], ctx);
BN_GF2m_add(f, e, g);
BN_GF2m_add(f, f, h);
if (!BN_is_zero(f)) {
fprintf(stderr,
"GF(2^m) modular multiplication test failed!\n");
goto err;
}
}
}
ret = 1;
err:
BN_free(a);
BN_free(b[0]);
BN_free(b[1]);
BN_free(c);
BN_free(d);
BN_free(e);
BN_free(f);
BN_free(g);
BN_free(h);
return ret;
}
test/bntest.c:1341: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1307, column 9 is not reachable after line 1341, column 5.
Showing all 221 steps of the trace
test/bntest.c:1300:1: start of procedure test_gf2m_mod_mul()
1298. }
1299.
1300. > int test_gf2m_mod_mul(BIO *bp, BN_CTX *ctx)
1301. {
1302. BIGNUM *a, *b[2], *c, *d, *e, *f, *g, *h;
test/bntest.c:1303:5:
1301. {
1302. BIGNUM *a, *b[2], *c, *d, *e, *f, *g, *h;
1303. > int i, j, ret = 0;
1304. int p0[] = { 163, 7, 6, 3, 0, -1 };
1305. int p1[] = { 193, 15, 0, -1 };
test/bntest.c:1304:5:
1302. BIGNUM *a, *b[2], *c, *d, *e, *f, *g, *h;
1303. int i, j, ret = 0;
1304. > int p0[] = { 163, 7, 6, 3, 0, -1 };
1305. int p1[] = { 193, 15, 0, -1 };
1306.
test/bntest.c:1305:5:
1303. int i, j, ret = 0;
1304. int p0[] = { 163, 7, 6, 3, 0, -1 };
1305. > int p1[] = { 193, 15, 0, -1 };
1306.
1307. a = BN_new();
test/bntest.c:1307:5:
1305. int p1[] = { 193, 15, 0, -1 };
1306.
1307. > a = BN_new();
1308. b[0] = BN_new();
1309. b[1] = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1308:5:
1306.
1307. a = BN_new();
1308. > b[0] = BN_new();
1309. b[1] = BN_new();
1310. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1309:5:
1307. a = BN_new();
1308. b[0] = BN_new();
1309. > b[1] = BN_new();
1310. c = BN_new();
1311. 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:1310:5:
1308. b[0] = BN_new();
1309. b[1] = BN_new();
1310. > c = BN_new();
1311. d = BN_new();
1312. 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:1311:5:
1309. b[1] = BN_new();
1310. c = BN_new();
1311. > d = BN_new();
1312. e = BN_new();
1313. f = 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:1312:5:
1310. c = BN_new();
1311. d = BN_new();
1312. > e = BN_new();
1313. f = BN_new();
1314. g = 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:1313:5:
1311. d = BN_new();
1312. e = BN_new();
1313. > f = BN_new();
1314. g = BN_new();
1315. h = 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:1314:5:
1312. e = BN_new();
1313. f = BN_new();
1314. > g = BN_new();
1315. h = BN_new();
1316.
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:1315:5:
1313. f = BN_new();
1314. g = BN_new();
1315. > h = BN_new();
1316.
1317. BN_GF2m_arr2poly(p0, b[0]);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1317:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1315. h = BN_new();
1316.
1317. BN_GF2m_arr2poly(p0, b[0]);
^
1318. BN_GF2m_arr2poly(p1, b[1]);
1319.
test/bntest.c:1318:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1316.
1317. BN_GF2m_arr2poly(p0, b[0]);
1318. BN_GF2m_arr2poly(p1, b[1]);
^
1319.
1320. for (i = 0; i < num0; i++) {
test/bntest.c:1320:10:
1318. BN_GF2m_arr2poly(p1, b[1]);
1319.
1320. > for (i = 0; i < num0; i++) {
1321. BN_bntest_rand(a, 1024, 0, 0);
1322. BN_bntest_rand(c, 1024, 0, 0);
test/bntest.c:1320:17: Loop condition is false. Leaving loop
1318. BN_GF2m_arr2poly(p1, b[1]);
1319.
1320. for (i = 0; i < num0; i++) {
^
1321. BN_bntest_rand(a, 1024, 0, 0);
1322. BN_bntest_rand(c, 1024, 0, 0);
test/bntest.c:1339:5:
1337. }
1338. }
1339. > ret = 1;
1340. err:
1341. BN_free(a);
test/bntest.c:1340:2:
1338. }
1339. ret = 1;
1340. > err:
1341. BN_free(a);
1342. BN_free(b[0]);
test/bntest.c:1341:5:
1339. ret = 1;
1340. err:
1341. > BN_free(a);
1342. BN_free(b[0]);
1343. BN_free(b[1]);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1341
|
d2a_code_trace_data_45847
|
static ngx_chain_t *
ngx_chain_to_iovec(ngx_iovec_t *vec, ngx_chain_t *cl)
{
size_t total, size;
u_char *prev;
ngx_uint_t n;
struct iovec *iov;
iov = NULL;
prev = NULL;
total = 0;
n = 0;
for ( ; cl; cl = cl->next) {
size = cl->buf->last - cl->buf->pos;
if (prev == cl->buf->pos) {
iov->iov_len += size;
} else {
if (n == vec->nalloc) {
break;
}
iov = &vec->iovs[n++];
iov->iov_base = (void *) cl->buf->pos;
iov->iov_len = size;
}
prev = cl->buf->pos + size;
total += size;
}
vec->count = n;
vec->size = total;
return cl;
}
src/os/unix/ngx_files.c:362: error: Null Dereference
pointer `iov` last assigned on line 353 could be null and is dereferenced at line 362, column 13.
src/os/unix/ngx_files.c:345:1: start of procedure ngx_chain_to_iovec()
343.
344.
345. static ngx_chain_t *
^
346. ngx_chain_to_iovec(ngx_iovec_t *vec, ngx_chain_t *cl)
347. {
src/os/unix/ngx_files.c:353:5:
351. struct iovec *iov;
352.
353. iov = NULL;
^
354. prev = NULL;
355. total = 0;
src/os/unix/ngx_files.c:354:5:
352.
353. iov = NULL;
354. prev = NULL;
^
355. total = 0;
356. n = 0;
src/os/unix/ngx_files.c:355:5:
353. iov = NULL;
354. prev = NULL;
355. total = 0;
^
356. n = 0;
357.
src/os/unix/ngx_files.c:356:5:
354. prev = NULL;
355. total = 0;
356. n = 0;
^
357.
358. for ( /* void */ ; cl; cl = cl->next) {
src/os/unix/ngx_files.c:358:24: Loop condition is true. Entering loop body
356. n = 0;
357.
358. for ( /* void */ ; cl; cl = cl->next) {
^
359. size = cl->buf->last - cl->buf->pos;
360.
src/os/unix/ngx_files.c:359:9:
357.
358. for ( /* void */ ; cl; cl = cl->next) {
359. size = cl->buf->last - cl->buf->pos;
^
360.
361. if (prev == cl->buf->pos) {
src/os/unix/ngx_files.c:361:13: Taking true branch
359. size = cl->buf->last - cl->buf->pos;
360.
361. if (prev == cl->buf->pos) {
^
362. iov->iov_len += size;
363.
src/os/unix/ngx_files.c:362:13:
360.
361. if (prev == cl->buf->pos) {
362. iov->iov_len += size;
^
363.
364. } else {
|
https://github.com/nginx/nginx/blob/9f0253e1e2dcfad7d81f49877228b864c617c9fa/src/os/unix/ngx_files.c/#L362
|
d2a_code_trace_data_45848
|
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
{
const X509_NAME_ENTRY *ne;
int i;
int n, lold, l, l1, l2, num, j, type;
const char *s;
char *p;
unsigned char *q;
BUF_MEM *b = NULL;
static const char hex[17] = "0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
unsigned char ebcdic_buf[1024];
#endif
if (buf == NULL) {
if ((b = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(b, 200))
goto err;
b->data[0] = '\0';
len = 200;
} else if (len == 0) {
return NULL;
}
if (a == NULL) {
if (b) {
buf = b->data;
OPENSSL_free(b);
}
strncpy(buf, "NO X509_NAME", len);
buf[len - 1] = '\0';
return buf;
}
len--;
l = 0;
for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
ne = sk_X509_NAME_ENTRY_value(a->entries, i);
n = OBJ_obj2nid(ne->object);
if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
s = tmp_buf;
}
l1 = strlen(s);
type = ne->value->type;
num = ne->value->length;
if (num > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
q = ne->value->data;
#ifdef CHARSET_EBCDIC
if (type == V_ASN1_GENERALSTRING ||
type == V_ASN1_VISIBLESTRING ||
type == V_ASN1_PRINTABLESTRING ||
type == V_ASN1_TELETEXSTRING ||
type == V_ASN1_IA5STRING) {
if (num > (int)sizeof(ebcdic_buf))
num = sizeof(ebcdic_buf);
ascii2ebcdic(ebcdic_buf, q, num);
q = ebcdic_buf;
}
#endif
if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
for (j = 0; j < num; j++)
if (q[j] != 0)
gs_doit[j & 3] = 1;
if (gs_doit[0] | gs_doit[1] | gs_doit[2])
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
else {
gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
gs_doit[3] = 1;
}
} else
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
for (l2 = j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
l2++;
#ifndef CHARSET_EBCDIC
if ((q[j] < ' ') || (q[j] > '~'))
l2 += 3;
#else
if ((os_toascii[q[j]] < os_toascii[' ']) ||
(os_toascii[q[j]] > os_toascii['~']))
l2 += 3;
#endif
}
lold = l;
l += 1 + l1 + 1 + l2;
if (l > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
if (b != NULL) {
if (!BUF_MEM_grow(b, l + 1))
goto err;
p = &(b->data[lold]);
} else if (l > len) {
break;
} else
p = &(buf[lold]);
*(p++) = '/';
memcpy(p, s, (unsigned int)l1);
p += l1;
*(p++) = '=';
#ifndef CHARSET_EBCDIC
q = ne->value->data;
#endif
for (j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
#ifndef CHARSET_EBCDIC
n = q[j];
if ((n < ' ') || (n > '~')) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = n;
#else
n = os_toascii[q[j]];
if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = q[j];
#endif
}
*p = '\0';
}
if (b != NULL) {
p = b->data;
OPENSSL_free(b);
} else
p = buf;
if (i == 0)
*p = '\0';
return (p);
err:
X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
end:
BUF_MEM_free(b);
return (NULL);
}
apps/ca.c:2033: error: BUFFER_OVERRUN_L3
Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`.
Showing all 6 steps of the trace
apps/ca.c:2033:20: Call
2031. for (i = 0; i < DB_NUMBER; i++)
2032. row[i] = NULL;
2033. row[DB_name] = X509_NAME_oneline(X509_get_subject_name(x509), NULL, 0);
^
2034. bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509), NULL);
2035. if (!bn)
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:56:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`
54. OPENSSL_free(b);
55. }
56. strncpy(buf, "NO X509_NAME", len);
^
57. buf[len - 1] = '\0';
58. return buf;
|
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L56
|
d2a_code_trace_data_45849
|
DH *ssl_get_auto_dh(SSL *s)
{
int dh_secbits = 80;
if (s->cert->dh_tmp_auto == 2)
return DH_get_1024_160();
if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
if (s->s3->tmp.new_cipher->strength_bits == 256)
dh_secbits = 128;
else
dh_secbits = 80;
} else {
CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
}
if (dh_secbits >= 128) {
DH *dhp = DH_new();
if (dhp == NULL)
return NULL;
dhp->g = BN_new();
if (dhp->g != NULL)
BN_set_word(dhp->g, 2);
if (dh_secbits >= 192)
dhp->p = get_rfc3526_prime_8192(NULL);
else
dhp->p = get_rfc3526_prime_3072(NULL);
if (dhp->p == NULL || dhp->g == NULL) {
DH_free(dhp);
return NULL;
}
return dhp;
}
if (dh_secbits >= 112)
return DH_get_2048_224();
return DH_get_1024_160();
}
ssl/t1_lib.c:4013: error: NULL_DEREFERENCE
pointer `cpk` last assigned on line 4012 could be null and is dereferenced at line 4013, column 45.
Showing all 30 steps of the trace
ssl/t1_lib.c:4001:1: start of procedure ssl_get_auto_dh()
3999.
4000. #ifndef OPENSSL_NO_DH
4001. > DH *ssl_get_auto_dh(SSL *s)
4002. {
4003. int dh_secbits = 80;
ssl/t1_lib.c:4003:5:
4001. DH *ssl_get_auto_dh(SSL *s)
4002. {
4003. > int dh_secbits = 80;
4004. if (s->cert->dh_tmp_auto == 2)
4005. return DH_get_1024_160();
ssl/t1_lib.c:4004:9: Taking false branch
4002. {
4003. int dh_secbits = 80;
4004. if (s->cert->dh_tmp_auto == 2)
^
4005. return DH_get_1024_160();
4006. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
ssl/t1_lib.c:4006:9: Taking false branch
4004. if (s->cert->dh_tmp_auto == 2)
4005. return DH_get_1024_160();
4006. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
^
4007. if (s->s3->tmp.new_cipher->strength_bits == 256)
4008. dh_secbits = 128;
ssl/t1_lib.c:4012:9:
4010. dh_secbits = 80;
4011. } else {
4012. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4013. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4014. }
ssl/ssl_lib.c:2641:1: start of procedure ssl_get_server_send_pkey()
2639. }
2640.
2641. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
2642. {
2643. CERT *c;
ssl/ssl_lib.c:2646:5:
2644. int i;
2645.
2646. > c = s->cert;
2647. if (!s->s3 || !s->s3->tmp.new_cipher)
2648. return NULL;
ssl/ssl_lib.c:2647:10: Taking false branch
2645.
2646. c = s->cert;
2647. if (!s->s3 || !s->s3->tmp.new_cipher)
^
2648. return NULL;
2649. ssl_set_masks(s, s->s3->tmp.new_cipher);
ssl/ssl_lib.c:2647:20: Taking false branch
2645.
2646. c = s->cert;
2647. if (!s->s3 || !s->s3->tmp.new_cipher)
^
2648. return NULL;
2649. ssl_set_masks(s, s->s3->tmp.new_cipher);
ssl/ssl_lib.c:2649:5: Skipping ssl_set_masks(): empty list of specs
2647. if (!s->s3 || !s->s3->tmp.new_cipher)
2648. return NULL;
2649. ssl_set_masks(s, s->s3->tmp.new_cipher);
^
2650.
2651. #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL
ssl/ssl_lib.c:2660:5:
2658. #endif
2659.
2660. > i = ssl_get_server_cert_index(s);
2661.
2662. /* This may or may not be an error. */
ssl/ssl_lib.c:2620:1: start of procedure ssl_get_server_cert_index()
2618. #endif
2619.
2620. > static int ssl_get_server_cert_index(const SSL *s)
2621. {
2622. int idx;
ssl/ssl_lib.c:2623:5:
2621. {
2622. int idx;
2623. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
2624. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
2625. idx = SSL_PKEY_RSA_SIGN;
ssl/ssl_ciph.c:1924:1: start of procedure ssl_cipher_get_cert_index()
1922.
1923. /* For a cipher return the index corresponding to the certificate type */
1924. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
1925. {
1926. uint32_t alg_a;
ssl/ssl_ciph.c:1928:5:
1926. uint32_t alg_a;
1927.
1928. > alg_a = c->algorithm_auth;
1929.
1930. if (alg_a & SSL_aECDSA)
ssl/ssl_ciph.c:1930:9: Taking false branch
1928. alg_a = c->algorithm_auth;
1929.
1930. if (alg_a & SSL_aECDSA)
^
1931. return SSL_PKEY_ECC;
1932. else if (alg_a & SSL_aDSS)
ssl/ssl_ciph.c:1932:14: Taking false branch
1930. if (alg_a & SSL_aECDSA)
1931. return SSL_PKEY_ECC;
1932. else if (alg_a & SSL_aDSS)
^
1933. return SSL_PKEY_DSA_SIGN;
1934. else if (alg_a & SSL_aRSA)
ssl/ssl_ciph.c:1934:14: Taking true branch
1932. else if (alg_a & SSL_aDSS)
1933. return SSL_PKEY_DSA_SIGN;
1934. else if (alg_a & SSL_aRSA)
^
1935. return SSL_PKEY_RSA_ENC;
1936. else if (alg_a & SSL_aGOST12)
ssl/ssl_ciph.c:1935:9:
1933. return SSL_PKEY_DSA_SIGN;
1934. else if (alg_a & SSL_aRSA)
1935. > return SSL_PKEY_RSA_ENC;
1936. else if (alg_a & SSL_aGOST12)
1937. return SSL_PKEY_GOST_EC;
ssl/ssl_ciph.c:1942:1: return from a call to ssl_cipher_get_cert_index
1940.
1941. return -1;
1942. > }
1943.
1944. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)
ssl/ssl_lib.c:2624:9: Taking true branch
2622. int idx;
2623. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
2624. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
^
2625. idx = SSL_PKEY_RSA_SIGN;
2626. if (idx == SSL_PKEY_GOST_EC) {
ssl/ssl_lib.c:2624:37: Taking false branch
2622. int idx;
2623. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
2624. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
^
2625. idx = SSL_PKEY_RSA_SIGN;
2626. if (idx == SSL_PKEY_GOST_EC) {
ssl/ssl_lib.c:2626:9: Taking false branch
2624. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
2625. idx = SSL_PKEY_RSA_SIGN;
2626. if (idx == SSL_PKEY_GOST_EC) {
^
2627. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
2628. idx = SSL_PKEY_GOST12_512;
ssl/ssl_lib.c:2636:9: Taking false branch
2634. idx = -1;
2635. }
2636. if (idx == -1)
^
2637. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
2638. return idx;
ssl/ssl_lib.c:2638:5:
2636. if (idx == -1)
2637. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
2638. > return idx;
2639. }
2640.
ssl/ssl_lib.c:2639:1: return from a call to ssl_get_server_cert_index
2637. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
2638. return idx;
2639. > }
2640.
2641. CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
ssl/ssl_lib.c:2663:9: Taking true branch
2661.
2662. /* This may or may not be an error. */
2663. if (i < 0)
^
2664. return NULL;
2665.
ssl/ssl_lib.c:2664:9:
2662. /* This may or may not be an error. */
2663. if (i < 0)
2664. > return NULL;
2665.
2666. /* May be NULL. */
ssl/ssl_lib.c:2668:1: return from a call to ssl_get_server_send_pkey
2666. /* May be NULL. */
2667. return &c->pkeys[i];
2668. > }
2669.
2670. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,
ssl/t1_lib.c:4013:9:
4011. } else {
4012. CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4013. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4014. }
4015.
|
https://github.com/openssl/openssl/blob/35b1a433ed893f29adff490ad06160eaa86c2416/ssl/t1_lib.c/#L4013
|
d2a_code_trace_data_45850
|
static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
{
int a0, a1, a2, a3, b0, b1, b2, b3;
#if HAVE_FAST_64BIT
#define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
if (((AV_RN64A(row) & ~ROW0_MASK) | AV_RN64A(row+4)) == 0) {
uint64_t temp;
if (DC_SHIFT - extra_shift > 0) {
temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
} else {
temp = (row[0] >> (extra_shift - DC_SHIFT)) & 0xffff;
}
temp += temp * (1 << 16);
temp += temp * ((uint64_t) 1 << 32);
AV_WN64A(row, temp);
AV_WN64A(row + 4, temp);
return;
}
#else
if (!(AV_RN32A(row+2) |
AV_RN32A(row+4) |
AV_RN32A(row+6) |
row[1])) {
uint32_t temp;
if (DC_SHIFT - extra_shift > 0) {
temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
} else {
temp = (row[0] >> (extra_shift - DC_SHIFT)) & 0xffff;
}
temp += temp * (1 << 16);
AV_WN32A(row, temp);
AV_WN32A(row+2, temp);
AV_WN32A(row+4, temp);
AV_WN32A(row+6, temp);
return;
}
#endif
a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
a1 = a0;
a2 = a0;
a3 = a0;
a0 += W2 * row[2];
a1 += W6 * row[2];
a2 -= W6 * row[2];
a3 -= W2 * row[2];
b0 = MUL(W1, row[1]);
MAC(b0, W3, row[3]);
b1 = MUL(W3, row[1]);
MAC(b1, -W7, row[3]);
b2 = MUL(W5, row[1]);
MAC(b2, -W1, row[3]);
b3 = MUL(W7, row[1]);
MAC(b3, -W5, row[3]);
if (AV_RN64A(row + 4)) {
a0 += W4*row[4] + W6*row[6];
a1 += - W4*row[4] - W2*row[6];
a2 += - W4*row[4] + W2*row[6];
a3 += W4*row[4] - W6*row[6];
MAC(b0, W5, row[5]);
MAC(b0, W7, row[7]);
MAC(b1, -W1, row[5]);
MAC(b1, -W5, row[7]);
MAC(b2, W7, row[5]);
MAC(b2, W3, row[7]);
MAC(b3, W3, row[5]);
MAC(b3, -W1, row[7]);
}
row[0] = (a0 + b0) >> (ROW_SHIFT + extra_shift);
row[7] = (a0 - b0) >> (ROW_SHIFT + extra_shift);
row[1] = (a1 + b1) >> (ROW_SHIFT + extra_shift);
row[6] = (a1 - b1) >> (ROW_SHIFT + extra_shift);
row[2] = (a2 + b2) >> (ROW_SHIFT + extra_shift);
row[5] = (a2 - b2) >> (ROW_SHIFT + extra_shift);
row[3] = (a3 + b3) >> (ROW_SHIFT + extra_shift);
row[4] = (a3 - b3) >> (ROW_SHIFT + extra_shift);
}
libavcodec/wmv2.c:97: error: Buffer Overrun L1
Offset: [12, 36] (⇐ [5, 29] + 7) Size: 6 by call to `wmv2_add_block`.
libavcodec/wmv2.c:97:5: Call
95.
96. wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4);
97. wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5);
^
98. }
99.
libavcodec/wmv2.c:57:1: Parameter `n`
55. }
56.
57. static void wmv2_add_block(Wmv2Context *w, int16_t *block1,
^
58. uint8_t *dst, int stride, int n)
59. {
libavcodec/wmv2.c:69:13: Call
67. case 1:
68. ff_simple_idct84_add(dst, stride, block1);
69. ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
^
70. s->bdsp.clear_block(w->abt_block2[n]);
71. break;
libavcodec/simple_idct.c:176:1: Parameter `*block`
174. }
175.
176. void ff_simple_idct84_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
^
177. {
178. int i;
libavcodec/simple_idct.c:182:9: Call
180. /* IDCT8 on each line */
181. for(i=0; i<4; i++) {
182. idctRowCondDC_8(block + i*8, 0);
^
183. }
184.
libavcodec/simple_idct_template.c:88:1: <Length trace>
86. #endif
87.
88. static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
^
89. {
90. int a0, a1, a2, a3, b0, b1, b2, b3;
libavcodec/simple_idct_template.c:88:1: Parameter `*row`
86. #endif
87.
88. static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
^
89. {
90. int a0, a1, a2, a3, b0, b1, b2, b3;
libavcodec/simple_idct_template.c:153:9: Array access: Offset: [12, 36] (⇐ [5, 29] + 7) Size: 6 by call to `wmv2_add_block`
151.
152. MAC(b0, W5, row[5]);
153. MAC(b0, W7, row[7]);
^
154.
155. MAC(b1, -W1, row[5]);
|
https://github.com/libav/libav/blob/2ec9fa5ec60dcd10e1cb10d8b4e4437e634ea428/libavcodec/simple_idct_template.c/#L153
|
d2a_code_trace_data_45851
|
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:1955: error: INTEGER_OVERFLOW_L2
([0, 17728] - [256, 17984]):unsigned64 by call to `dtls1_process_record`.
Showing all 10 steps of the trace
ssl/record/ssl3_record.c:1776:1: Parameter `s->session->ext.max_fragment_len_mode`
1774. */
1775. /* used only by dtls1_read_bytes */
1776. > int dtls1_get_record(SSL *s)
1777. {
1778. int ssl_major, ssl_minor;
ssl/record/ssl3_record.c:1955:10: Call
1953. }
1954.
1955. if (!dtls1_process_record(s, bitmap)) {
^
1956. if (ossl_statem_in_error(s)) {
1957. /* dtls1_process_record() called SSLfatal */
ssl/record/ssl3_record.c:1553:1: Parameter `s->rlayer.rrec.length`
1551. }
1552.
1553. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap)
1554. {
1555. int i;
ssl/record/ssl3_record.c:1593:5: Assignment
1591. /* decrypt in place in 'rr->input' */
1592. rr->data = rr->input;
1593. rr->orig_len = rr->length;
^
1594.
1595. if (SSL_READ_ETM(s) && s->read_hash) {
ssl/record/ssl3_record.c:1689:18: Call
1687. */
1688. mac = mac_tmp;
1689. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) {
^
1690. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DTLS1_PROCESS_RECORD,
1691. ERR_R_INTERNAL_ERROR);
ssl/record/ssl3_record.c:1478:1: <LHS trace>
1476. #define CBC_MAC_ROTATE_IN_PLACE
1477.
1478. > int ssl3_cbc_copy_mac(unsigned char *out,
1479. const SSL3_RECORD *rec, size_t md_size)
1480. {
ssl/record/ssl3_record.c:1478:1: Parameter `md_size`
1476. #define CBC_MAC_ROTATE_IN_PLACE
1477.
1478. > int ssl3_cbc_copy_mac(unsigned char *out,
1479. const SSL3_RECORD *rec, size_t md_size)
1480. {
ssl/record/ssl3_record.c:1478:1: <RHS trace>
1476. #define CBC_MAC_ROTATE_IN_PLACE
1477.
1478. > int ssl3_cbc_copy_mac(unsigned char *out,
1479. const SSL3_RECORD *rec, size_t md_size)
1480. {
ssl/record/ssl3_record.c:1478:1: Parameter `md_size`
1476. #define CBC_MAC_ROTATE_IN_PLACE
1477.
1478. > int ssl3_cbc_copy_mac(unsigned char *out,
1479. const SSL3_RECORD *rec, size_t md_size)
1480. {
ssl/record/ssl3_record.c:1512:9: Binary operation: ([0, 17728] - [256, 17984]):unsigned64 by call to `dtls1_process_record`
1510. /* This information is public so it's safe to branch based on it. */
1511. if (rec->orig_len > md_size + 255 + 1)
1512. scan_start = rec->orig_len - (md_size + 255 + 1);
^
1513.
1514. in_mac = 0;
|
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/ssl3_record.c/#L1512
|
d2a_code_trace_data_45852
|
static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
{
const dav_walk_params *params = fsctx->params;
apr_pool_t *pool = params->pool;
apr_status_t status;
dav_error *err = NULL;
int isdir = fsctx->res1.collection;
apr_finfo_t dirent;
apr_dir_t *dirp;
err = (*params->func)(&fsctx->wres,
isdir
? DAV_CALLTYPE_COLLECTION
: DAV_CALLTYPE_MEMBER);
if (err != NULL) {
return err;
}
if (depth == 0 || !isdir) {
return NULL;
}
dav_check_bufsize(pool, &fsctx->path1, DAV_BUFFER_PAD);
fsctx->path1.buf[fsctx->path1.cur_len++] = '/';
fsctx->path1.buf[fsctx->path1.cur_len] = '\0';
if (fsctx->path2.buf != NULL) {
dav_check_bufsize(pool, &fsctx->path2, DAV_BUFFER_PAD);
fsctx->path2.buf[fsctx->path2.cur_len++] = '/';
fsctx->path2.buf[fsctx->path2.cur_len] = '\0';
}
fsctx->res1.exists = 1;
fsctx->res1.collection = 0;
fsctx->res2.collection = 0;
if ((status = apr_dir_open(&dirp, fsctx->path1.buf, pool)) != APR_SUCCESS) {
return dav_new_error(pool, HTTP_NOT_FOUND, 0, status, NULL);
}
while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) {
apr_size_t len;
len = strlen(dirent.name);
if (dirent.name[0] == '.'
&& (len == 1 || (dirent.name[1] == '.' && len == 2))) {
continue;
}
if (params->walk_type & DAV_WALKTYPE_AUTH) {
if (!strcmp(dirent.name, DAV_FS_STATE_DIR) ||
!strncmp(dirent.name, DAV_FS_TMP_PREFIX,
strlen(DAV_FS_TMP_PREFIX))) {
continue;
}
}
if (!(params->walk_type & DAV_WALKTYPE_HIDDEN)
&& (!strcmp(dirent.name, DAV_FS_STATE_DIR) ||
!strncmp(dirent.name, DAV_FS_TMP_PREFIX,
strlen(DAV_FS_TMP_PREFIX)))) {
continue;
}
dav_buffer_place_mem(pool, &fsctx->path1, dirent.name, len + 1, 0);
status = apr_stat(&fsctx->info1.finfo, fsctx->path1.buf,
DAV_FINFO_MASK, pool);
if (status != APR_SUCCESS && status != APR_INCOMPLETE) {
err = dav_new_error(pool, HTTP_NOT_FOUND, 0, status, NULL);
break;
}
dav_buffer_place_mem(pool, &fsctx->uri_buf, dirent.name, len + 1, 1);
if (fsctx->path2.buf != NULL) {
dav_buffer_place_mem(pool, &fsctx->path2, dirent.name, len + 1, 0);
}
fsctx->info1.pathname = fsctx->path1.buf;
fsctx->info2.pathname = fsctx->path2.buf;
fsctx->res1.uri = fsctx->uri_buf.buf;
if (fsctx->info1.finfo.filetype == APR_REG) {
if ((err = (*params->func)(&fsctx->wres,
DAV_CALLTYPE_MEMBER)) != NULL) {
break;
}
}
else if (fsctx->info1.finfo.filetype == APR_DIR) {
apr_size_t save_path_len = fsctx->path1.cur_len;
apr_size_t save_uri_len = fsctx->uri_buf.cur_len;
apr_size_t save_path2_len = fsctx->path2.cur_len;
fsctx->path1.cur_len += len;
fsctx->path2.cur_len += len;
fsctx->uri_buf.cur_len += len + 1;
fsctx->uri_buf.buf[fsctx->uri_buf.cur_len - 1] = '/';
fsctx->uri_buf.buf[fsctx->uri_buf.cur_len] = '\0';
fsctx->res1.collection = 1;
fsctx->res2.collection = 1;
if ((err = dav_fs_walker(fsctx, depth - 1)) != NULL) {
break;
}
fsctx->path1.cur_len = save_path_len;
fsctx->path2.cur_len = save_path2_len;
fsctx->uri_buf.cur_len = save_uri_len;
fsctx->res1.collection = 0;
fsctx->res2.collection = 0;
}
}
apr_dir_close(dirp);
if (err != NULL)
return err;
if (params->walk_type & DAV_WALKTYPE_LOCKNULL) {
apr_size_t offset = 0;
fsctx->path1.buf[fsctx->path1.cur_len - 1] = '\0';
fsctx->res1.collection = 1;
if ((err = dav_fs_get_locknull_members(&fsctx->res1,
&fsctx->locknull_buf)) != NULL) {
return err;
}
fsctx->path1.buf[fsctx->path1.cur_len - 1] = '/';
fsctx->res1.exists = 0;
fsctx->res1.collection = 0;
memset(&fsctx->info1.finfo, 0, sizeof(fsctx->info1.finfo));
while (offset < fsctx->locknull_buf.cur_len) {
apr_size_t len = strlen(fsctx->locknull_buf.buf + offset);
dav_lock *locks = NULL;
dav_buffer_place_mem(pool, &fsctx->path1,
fsctx->locknull_buf.buf + offset, len + 1, 0);
dav_buffer_place_mem(pool, &fsctx->uri_buf,
fsctx->locknull_buf.buf + offset, len + 1, 0);
if (fsctx->path2.buf != NULL) {
dav_buffer_place_mem(pool, &fsctx->path2,
fsctx->locknull_buf.buf + offset,
len + 1, 0);
}
fsctx->info1.pathname = fsctx->path1.buf;
fsctx->info2.pathname = fsctx->path2.buf;
fsctx->res1.uri = fsctx->uri_buf.buf;
if ((err = dav_lock_query(params->lockdb, &fsctx->res1,
&locks)) != NULL) {
return err;
}
if (locks != NULL &&
(err = (*params->func)(&fsctx->wres,
DAV_CALLTYPE_LOCKNULL)) != NULL) {
return err;
}
offset += len + 1;
}
fsctx->res1.exists = 1;
}
if (params->walk_type & DAV_WALKTYPE_POSTFIX) {
fsctx->path1.buf[--fsctx->path1.cur_len] = '\0';
fsctx->uri_buf.buf[--fsctx->uri_buf.cur_len] = '\0';
if (fsctx->path2.buf != NULL) {
fsctx->path2.buf[--fsctx->path2.cur_len] = '\0';
}
fsctx->res1.collection = 1;
return (*params->func)(&fsctx->wres, DAV_CALLTYPE_POSTFIX);
}
return NULL;
}
modules/dav/fs/repos.c:1843: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `dav_fs_walker`.
modules/dav/fs/repos.c:1769:37: Assignment
1767. dav_response **response)
1768. {
1769. dav_fs_walker_context fsctx = { 0 };
^
1770. dav_error *err;
1771. dav_fs_copymove_walk_ctx cm_ctx = { 0 };
modules/dav/fs/repos.c:1843:11: Call
1841.
1842. /* always return the error, and any/all multistatus responses */
1843. err = dav_fs_walker(&fsctx, depth);
^
1844. *response = fsctx.wres.response;
1845. return err;
modules/dav/fs/repos.c:1488:1: <LHS trace>
1486. /* Walk recursively down through directories, *
1487. * including lock-null resources as we go. */
1488. static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
^
1489. {
1490. const dav_walk_params *params = fsctx->params;
modules/dav/fs/repos.c:1488:1: Parameter `fsctx->path2.cur_len`
1486. /* Walk recursively down through directories, *
1487. * including lock-null resources as we go. */
1488. static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
^
1489. {
1490. const dav_walk_params *params = fsctx->params;
modules/dav/fs/repos.c:1752:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `dav_fs_walker`
1750. fsctx->uri_buf.buf[--fsctx->uri_buf.cur_len] = '\0';
1751. if (fsctx->path2.buf != NULL) {
1752. fsctx->path2.buf[--fsctx->path2.cur_len] = '\0';
^
1753. }
1754.
|
https://github.com/apache/httpd/blob/8b2ec33ac5d314be345814db08e194ffeda6beb0/modules/dav/fs/repos.c/#L1752
|
d2a_code_trace_data_45853
|
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/ec/ecdsa_ossl.c:277: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `ecdsa_sign_setup`.
Showing all 44 steps of the trace
crypto/ec/ecdsa_ossl.c:211:1: Parameter `eckey->group->order->top`
209. }
210.
211. > ECDSA_SIG *ossl_ecdsa_sign_sig(const unsigned char *dgst, int dgst_len,
212. const BIGNUM *in_kinv, const BIGNUM *in_r,
213. EC_KEY *eckey)
crypto/ec/ecdsa_ossl.c:260:9: Call
258. goto err;
259. }
260. i = BN_num_bits(order);
^
261. /*
262. * Need to truncate digest if it is too long: first truncate whole bytes.
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:842:1: Parameter `a->top`
840. }
841.
842. > int BN_is_zero(const BIGNUM *a)
843. {
844. return a->top == 0;
crypto/ec/ecdsa_ossl.c:277:18: Call
275. do {
276. if (in_kinv == NULL || in_r == NULL) {
277. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) {
^
278. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB);
279. goto err;
crypto/ec/ecdsa_ossl.c:34:1: Parameter `eckey->group->order->top`
32. }
33.
34. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
35. BIGNUM **kinvp, BIGNUM **rp,
36. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:82:18: Call
80.
81. /* Preallocate space */
82. order_bits = BN_num_bits(order);
^
83. if (!BN_set_bit(k, order_bits)
84. || !BN_set_bit(r, order_bits)
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:842:1: Parameter `a->top`
840. }
841.
842. > int BN_is_zero(const BIGNUM *a)
843. {
844. return a->top == 0;
crypto/ec/ecdsa_ossl.c:100:22: Call
98. }
99. } else {
100. if (!BN_priv_rand_range(k, order)) {
^
101. ECerr(EC_F_ECDSA_SIGN_SETUP,
102. EC_R_RANDOM_NUMBER_GENERATION_FAILED);
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/ec/ecdsa_ossl.c:120:14: Call
118. * conditional copy.
119. */
120. if (!BN_add(r, k, order)
^
121. || !BN_add(X, r, order)
122. || !BN_copy(k, BN_num_bits(r) > order_bits ? r : X))
crypto/bn/bn_add.c:14:1: Parameter `b->top`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/ec/ecdsa_ossl.c:121:17: Call
119. */
120. if (!BN_add(r, k, order)
121. || !BN_add(X, r, order)
^
122. || !BN_copy(k, BN_num_bits(r) > order_bits ? r : X))
123. goto err;
crypto/bn/bn_add.c:14:1: Parameter `b->top`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/ec/ecdsa_ossl.c:126:14: Call
124.
125. /* compute r the x-coordinate of generator * k */
126. if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) {
^
127. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB);
128. goto err;
crypto/ec/ec_lib.c:922:1: Parameter `group->order->top`
920. }
921.
922. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
923. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx)
924. {
crypto/ec/ec_lib.c:933:12: Call
931. scalars[0] = p_scalar;
932.
933. return EC_POINTs_mul(group, r, g_scalar,
^
934. (point != NULL
935. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:911:1: Parameter `group->order->top`
909. */
910.
911. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
912. size_t num, const EC_POINT *points[],
913. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:917:16: Call
915. if (group->meth->mul == 0)
916. /* use default */
917. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
918.
919. return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
crypto/ec/ec_mult.c:341:1: Parameter `group->order->top`
339. * in the addition if scalar != NULL
340. */
341. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
342. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
343. BN_CTX *ctx)
crypto/ec/ec_mult.c:392:16: Call
390. * constant time version.
391. */
392. return ec_mul_consttime(group, r, scalar, NULL, ctx);
^
393. }
394. 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:145:18: Call
143. goto err;
144.
145. order_bits = BN_num_bits(group->order);
^
146.
147. 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:842:1: Parameter `a->top`
840. }
841.
842. > int BN_is_zero(const BIGNUM *a)
843. {
844. return a->top == 0;
crypto/ec/ec_mult.c:188:14: Call
186. * constant-timeness
187. */
188. if (!BN_nnmod(k, k, group->order, ctx))
^
189. goto err;
190. }
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:938:1: Parameter `*a->d`
936. }
937.
938. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
939. {
940. 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 `ecdsa_sign_setup`
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/7fcdbd839c629f5419a49bf8da28c968c8140c3d/crypto/bn/bn_shift.c/#L112
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.