Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
168aff53
Commit
168aff53
authored
May 15, 2002
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- check size to avoid realloc(0)
parent
dcd1ba26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
55 deletions
+134
-55
src/input/input_dec.c
src/input/input_dec.c
+19
-7
src/input/input_programs.c
src/input/input_programs.c
+115
-48
No files found.
src/input/input_dec.c
View file @
168aff53
...
...
@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.3
4 2002/05/14 21:23:44 massiot
Exp $
* $Id: input_dec.c,v 1.3
5 2002/05/15 15:46:34 asmax
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -224,17 +224,29 @@ static decoder_config_t * CreateDecoderConfig( input_thread_t * p_input,
/* Select a new ES */
p_input
->
stream
.
i_selected_es_number
++
;
p_input
->
stream
.
pp_selected_es
=
realloc
(
p_input
->
stream
.
pp_selected_es
,
p_input
->
stream
.
i_selected_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_selected_es
==
NULL
)
if
(
p_input
->
stream
.
i_selected_es_number
>
0
)
{
intf_ErrMsg
(
"Unable to realloc memory"
);
p_input
->
stream
.
pp_selected_es
=
realloc
(
p_input
->
stream
.
pp_selected_es
,
p_input
->
stream
.
i_selected_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_selected_es
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory"
);
free
(
p_config
->
p_decoder_fifo
);
free
(
p_config
);
return
NULL
;
}
}
else
{
intf_ErrMsg
(
"realloc(0) (p_input->stream.i_selected_es_number "
"corrupted?)"
);
free
(
p_config
->
p_decoder_fifo
);
free
(
p_config
);
return
NULL
;
}
p_input
->
stream
.
pp_selected_es
[
p_input
->
stream
.
i_selected_es_number
-
1
]
=
p_es
;
...
...
src/input/input_programs.c
View file @
168aff53
...
...
@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_programs.c,v 1.8
5 2002/05/13 21:55:30 fenrir
Exp $
* $Id: input_programs.c,v 1.8
6 2002/05/15 15:46:34 asmax
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -142,15 +142,22 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
/* Add an entry to the list of program associated with the stream */
p_input
->
stream
.
i_pgrm_number
++
;
p_input
->
stream
.
pp_programs
=
realloc
(
p_input
->
stream
.
pp_programs
,
p_input
->
stream
.
i_pgrm_number
*
sizeof
(
pgrm_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_programs
==
NULL
)
if
(
p_input
->
stream
.
i_pgrm_number
>
0
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddProgram"
);
p_input
->
stream
.
pp_programs
=
realloc
(
p_input
->
stream
.
pp_programs
,
p_input
->
stream
.
i_pgrm_number
*
sizeof
(
pgrm_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_programs
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddProgram"
);
return
(
NULL
);
}
}
else
{
intf_ErrMsg
(
"realloc(0) (p_input->stream.i_pgrm_number corrupted ?)"
);
return
(
NULL
);
}
/* Allocate the structure to store this description */
p_input
->
stream
.
pp_programs
[
i_pgrm_index
]
=
malloc
(
sizeof
(
pgrm_descriptor_t
)
);
...
...
@@ -229,14 +236,21 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
p_input
->
stream
.
pp_programs
[
i_pgrm_index
]
=
p_input
->
stream
.
pp_programs
[
p_input
->
stream
.
i_pgrm_number
];
p_input
->
stream
.
pp_programs
=
realloc
(
p_input
->
stream
.
pp_programs
,
p_input
->
stream
.
i_pgrm_number
*
sizeof
(
pgrm_descriptor_t
*
)
);
if
(
p_input
->
stream
.
i_pgrm_number
>
0
)
{
p_input
->
stream
.
pp_programs
=
realloc
(
p_input
->
stream
.
pp_programs
,
p_input
->
stream
.
i_pgrm_number
*
sizeof
(
pgrm_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_programs
==
NULL
)
{
intf_ErrMsg
(
"input error: unable to realloc program list"
" in input_DelProgram"
);
}
if
(
p_input
->
stream
.
i_pgrm_number
&&
p_input
->
stream
.
pp_programs
==
NULL
)
}
else
{
intf_ErrMsg
(
"input error: unable to realloc program list"
" in input_DelProgram"
);
free
(
p_input
->
stream
.
pp_programs
);
}
/* Free the description of this program */
...
...
@@ -255,12 +269,20 @@ input_area_t * input_AddArea( input_thread_t * p_input )
/* Add an entry to the list of program associated with the stream */
p_input
->
stream
.
i_area_nb
++
;
p_input
->
stream
.
pp_areas
=
realloc
(
p_input
->
stream
.
pp_areas
,
p_input
->
stream
.
i_area_nb
if
(
p_input
->
stream
.
i_area_nb
>
0
)
{
p_input
->
stream
.
pp_areas
=
realloc
(
p_input
->
stream
.
pp_areas
,
p_input
->
stream
.
i_area_nb
*
sizeof
(
input_area_t
*
)
);
if
(
p_input
->
stream
.
pp_areas
==
NULL
)
if
(
p_input
->
stream
.
pp_areas
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddArea"
);
return
(
NULL
);
}
}
else
{
intf_ErrMsg
(
"
Unable to realloc memory in input_AddArea"
);
intf_ErrMsg
(
"
realloc(0) (p_input->stream.i_area_nb corrupted ?)"
);
return
(
NULL
);
}
...
...
@@ -408,14 +430,21 @@ void input_DelArea( input_thread_t * p_input, input_area_t * p_area )
p_input
->
stream
.
pp_areas
[
i_area_index
]
=
p_input
->
stream
.
pp_areas
[
p_input
->
stream
.
i_area_nb
];
p_input
->
stream
.
pp_areas
=
realloc
(
p_input
->
stream
.
pp_areas
,
p_input
->
stream
.
i_area_nb
if
(
p_input
->
stream
.
i_area_nb
>
0
)
{
p_input
->
stream
.
pp_areas
=
realloc
(
p_input
->
stream
.
pp_areas
,
p_input
->
stream
.
i_area_nb
*
sizeof
(
input_area_t
*
)
);
if
(
p_input
->
stream
.
i_area_nb
&&
p_input
->
stream
.
pp_areas
==
NULL
)
if
(
p_input
->
stream
.
pp_areas
==
NULL
)
{
intf_ErrMsg
(
"input error: unable to realloc area list"
" in input_DelArea"
);
}
}
else
{
intf_ErrMsg
(
"input error: unable to realloc area list"
" in input_DelArea"
);
free
(
p_input
->
stream
.
pp_areas
);
}
/* Free the description of this area */
...
...
@@ -461,12 +490,20 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
return
(
NULL
);
}
p_input
->
stream
.
i_es_number
++
;
p_input
->
stream
.
pp_es
=
realloc
(
p_input
->
stream
.
pp_es
,
p_input
->
stream
.
i_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_es
==
NULL
)
if
(
p_input
->
stream
.
i_es_number
>
0
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddES"
);
p_input
->
stream
.
pp_es
=
realloc
(
p_input
->
stream
.
pp_es
,
p_input
->
stream
.
i_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_es
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddES"
);
return
(
NULL
);
}
}
else
{
intf_ErrMsg
(
"realloc(0) (p_input->stream.pp_es_number corrupted ?)"
);
return
(
NULL
);
}
p_input
->
stream
.
pp_es
[
p_input
->
stream
.
i_es_number
-
1
]
=
p_es
;
...
...
@@ -499,12 +536,20 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
if
(
p_pgrm
)
{
p_pgrm
->
i_es_number
++
;
p_pgrm
->
pp_es
=
realloc
(
p_pgrm
->
pp_es
,
p_pgrm
->
i_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_pgrm
->
pp_es
==
NULL
)
if
(
p_pgrm
->
i_es_number
>
0
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddES"
);
p_pgrm
->
pp_es
=
realloc
(
p_pgrm
->
pp_es
,
p_pgrm
->
i_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_pgrm
->
pp_es
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_AddES"
);
return
(
NULL
);
}
}
else
{
intf_ErrMsg
(
"realloc(0) (p_pgrm->i_es_number corrupted ?)"
);
return
(
NULL
);
}
p_pgrm
->
pp_es
[
p_pgrm
->
i_es_number
-
1
]
=
p_es
;
...
...
@@ -545,12 +590,20 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
{
p_pgrm
->
i_es_number
--
;
p_pgrm
->
pp_es
[
i_index
]
=
p_pgrm
->
pp_es
[
p_pgrm
->
i_es_number
];
p_pgrm
->
pp_es
=
realloc
(
p_pgrm
->
pp_es
,
p_pgrm
->
i_es_number
*
sizeof
(
es_descriptor_t
*
));
if
(
p_pgrm
->
i_es_number
&&
p_pgrm
->
pp_es
==
NULL
)
if
(
p_pgrm
->
i_es_number
>
0
)
{
p_pgrm
->
pp_es
=
realloc
(
p_pgrm
->
pp_es
,
p_pgrm
->
i_es_number
*
sizeof
(
es_descriptor_t
*
));
if
(
p_pgrm
->
pp_es
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in "
"input_DelES"
);
}
}
else
{
intf_ErrMsg
(
"Unable to realloc memory in input_DelES"
);
free
(
p_pgrm
->
pp_es
);
}
break
;
}
...
...
@@ -576,12 +629,19 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
p_input
->
stream
.
i_es_number
--
;
p_input
->
stream
.
pp_es
[
i_es_index
]
=
p_input
->
stream
.
pp_es
[
p_input
->
stream
.
i_es_number
];
p_input
->
stream
.
pp_es
=
realloc
(
p_input
->
stream
.
pp_es
,
p_input
->
stream
.
i_es_number
*
sizeof
(
es_descriptor_t
*
));
if
(
p_input
->
stream
.
i_es_number
&&
p_input
->
stream
.
pp_es
==
NULL
)
if
(
p_input
->
stream
.
i_es_number
>
0
)
{
p_input
->
stream
.
pp_es
=
realloc
(
p_input
->
stream
.
pp_es
,
p_input
->
stream
.
i_es_number
*
sizeof
(
es_descriptor_t
*
));
if
(
p_input
->
stream
.
pp_es
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_DelES"
);
}
}
else
{
intf_ErrMsg
(
"Unable to realloc memory in input_DelES"
);
free
(
p_input
->
stream
.
pp_es
);
}
}
...
...
@@ -696,15 +756,22 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es )
p_input
->
stream
.
pp_selected_es
[
i_index
]
=
p_input
->
stream
.
pp_selected_es
[
p_input
->
stream
.
i_selected_es_number
];
p_input
->
stream
.
pp_selected_es
=
realloc
(
if
(
p_input
->
stream
.
i_selected_es_number
>
0
)
{
p_input
->
stream
.
pp_selected_es
=
realloc
(
p_input
->
stream
.
pp_selected_es
,
p_input
->
stream
.
i_selected_es_number
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_selected_es
==
NULL
)
*
sizeof
(
es_descriptor_t
*
)
);
if
(
p_input
->
stream
.
pp_selected_es
==
NULL
)
{
intf_ErrMsg
(
"Unable to realloc memory in input_UnselectES"
);
return
(
-
1
);
}
}
else
{
intf_WarnMsg
(
4
,
"input: no more selected ES in input_UnselectES"
);
return
(
1
);
free
(
p_input
->
stream
.
pp_selected_es
);
intf_WarnMsg
(
4
,
"input: no more selected ES in input_UnselectES"
);
return
(
1
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment