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
0ce0cc9f
Commit
0ce0cc9f
authored
Dec 07, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect against vobsub lines overflow
(probably impossible in practice as memory would run out first)
parent
3fc2289a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
26 deletions
+15
-26
modules/demux/vobsub.c
modules/demux/vobsub.c
+15
-26
No files found.
modules/demux/vobsub.c
View file @
0ce0cc9f
...
...
@@ -34,6 +34,7 @@
#include <errno.h>
#include <sys/types.h>
#include <limits.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
...
...
@@ -417,47 +418,35 @@ static int Demux( demux_t *p_demux )
static
int
TextLoad
(
text_t
*
txt
,
stream_t
*
s
)
{
int
i_line_max
;
/* init txt */
i_line_max
=
500
;
txt
->
i_line_count
=
0
;
txt
->
i_line
=
0
;
txt
->
line
=
calloc
(
i_line_max
,
sizeof
(
char
*
)
);
if
(
!
txt
->
line
)
return
VLC_EGENERIC
;
char
**
lines
=
NULL
;
size_t
n
=
0
;
/* load the complete file */
for
(
;;
)
{
char
*
psz
=
stream_ReadLine
(
s
);
char
**
ppsz_new
;
if
(
psz
==
NULL
)
if
(
psz
==
NULL
||
(
n
>=
INT_MAX
/
sizeof
(
char
*
))
)
break
;
txt
->
line
[
txt
->
i_line_count
++
]
=
psz
;
if
(
txt
->
i_line_count
>=
i_line_max
)
ppsz_new
=
realloc
(
lines
,
(
n
+
1
)
*
sizeof
(
char
*
)
)
;
if
(
ppsz_new
==
NULL
)
{
char
**
ppsz_old
=
txt
->
line
;
i_line_max
+=
100
;
txt
->
line
=
realloc
(
txt
->
line
,
i_line_max
*
sizeof
(
char
*
)
);
if
(
!
txt
->
line
)
{
free
(
ppsz_old
);
break
;
}
free
(
psz
);
break
;
}
lines
=
ppsz_new
;
lines
[
n
++
]
=
psz
;
}
if
(
txt
->
i_line_count
<=
0
)
{
free
(
txt
->
line
);
return
VLC_EGENERIC
;
}
txt
->
i_line_count
=
0
;
txt
->
i_line
=
n
;
txt
->
line
=
lines
;
return
VLC_SUCCESS
;
}
static
void
TextUnload
(
text_t
*
txt
)
{
int
i
;
...
...
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