Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
e81f6fca
Commit
e81f6fca
authored
Jun 28, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed segfault when parsing wav file to check for dts/a52.
parent
a11cc336
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
modules/demux/a52.c
modules/demux/a52.c
+12
-9
modules/demux/dts.c
modules/demux/dts.c
+18
-16
No files found.
modules/demux/a52.c
View file @
e81f6fca
...
...
@@ -74,9 +74,9 @@ static int CheckSync( const uint8_t *p_peek, bool *p_big_endian );
#define PCM_FRAME_SIZE (1536 * 4)
#define A52_PACKET_SIZE (4 * PCM_FRAME_SIZE)
#define A52_PROBE_SIZE (512*1024)
#define A52_MAX_HEADER_SIZE 10
/*****************************************************************************
* Open: initializes ES structures
*****************************************************************************/
...
...
@@ -89,24 +89,27 @@ static int Open( vlc_object_t * p_this )
bool
b_big_endian
=
0
;
/* Arbitrary initialisation */
/* Check if we are dealing with a WAV file */
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
12
)
==
12
&&
!
memcmp
(
p_peek
,
"RIFF"
,
4
)
&&
!
memcmp
(
p_peek
+
8
,
"WAVE"
,
4
)
)
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
12
+
8
)
==
12
+
8
&&
!
memcmp
(
p_peek
,
"RIFF"
,
4
)
&&
!
memcmp
(
&
p_peek
[
8
]
,
"WAVE"
,
4
)
)
{
int
i_size
;
/* Skip the wave header */
i_peek
=
12
+
8
;
while
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
==
i_peek
&&
memcmp
(
p_peek
+
i_peek
-
8
,
"data"
,
4
)
)
while
(
memcmp
(
p_peek
+
i_peek
-
8
,
"data"
,
4
)
)
{
i_peek
+=
GetDWLE
(
p_peek
+
i_peek
-
4
)
+
8
;
uint32_t
i_len
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_len
>
A52_PROBE_SIZE
||
i_peek
+
i_len
>
A52_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_len
+
8
;
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
!=
i_peek
)
return
VLC_EGENERIC
;
}
/* TODO: should check wave format and sample_rate */
/* Some A52 wav files don't begin with a sync code so we do a more
* extensive search */
i_size
=
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
+
A52_PACKET_SIZE
*
2
);
i
nt
i
_size
=
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
+
A52_PACKET_SIZE
*
2
);
i_size
-=
(
PCM_FRAME_SIZE
+
A52_MAX_HEADER_SIZE
);
while
(
i_peek
<
i_size
)
...
...
modules/demux/dts.c
View file @
e81f6fca
...
...
@@ -85,49 +85,51 @@ static int Open( vlc_object_t * p_this )
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
20
)
==
20
&&
!
memcmp
(
p_peek
,
"RIFF"
,
4
)
&&
!
memcmp
(
&
p_peek
[
8
],
"WAVE"
,
4
)
)
{
int
i_size
;
/* Find the wave format header */
i_peek
=
20
;
i_peek
=
12
+
8
;
while
(
memcmp
(
p_peek
+
i_peek
-
8
,
"fmt "
,
4
)
)
{
i_size
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_
size
+
i_peek
>
DTS_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_size
+
8
;
uint32_t
i_len
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_
len
>
DTS_PROBE_SIZE
||
i_peek
+
i_len
>
DTS_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_len
+
8
;
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
!=
i_peek
)
return
VLC_EGENERIC
;
}
/* Sanity check the wave format header */
i_size
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_size
+
i_peek
>
DTS_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_size
+
8
;
uint32_t
i_len
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_len
>
DTS_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_len
+
8
;
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
!=
i_peek
)
return
VLC_EGENERIC
;
if
(
GetWLE
(
p_peek
+
i_peek
-
i_
size
-
8
/* wFormatTag */
)
!=
if
(
GetWLE
(
p_peek
+
i_peek
-
i_
len
-
8
/* wFormatTag */
)
!=
1
/* WAVE_FORMAT_PCM */
)
return
VLC_EGENERIC
;
if
(
GetWLE
(
p_peek
+
i_peek
-
i_
size
-
6
/* nChannels */
)
!=
2
)
if
(
GetWLE
(
p_peek
+
i_peek
-
i_
len
-
6
/* nChannels */
)
!=
2
)
return
VLC_EGENERIC
;
if
(
GetDWLE
(
p_peek
+
i_peek
-
i_
size
-
4
/* nSamplesPerSec */
)
!=
if
(
GetDWLE
(
p_peek
+
i_peek
-
i_
len
-
4
/* nSamplesPerSec */
)
!=
44100
)
return
VLC_EGENERIC
;
/* Skip the wave header */
while
(
memcmp
(
p_peek
+
i_peek
-
8
,
"data"
,
4
)
)
{
i_size
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_
size
+
i_peek
>
DTS_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_size
+
8
;
uint32_t
i_len
=
GetDWLE
(
p_peek
+
i_peek
-
4
);
if
(
i_
len
>
DTS_PROBE_SIZE
||
i_peek
+
i_len
>
DTS_PROBE_SIZE
)
return
VLC_EGENERIC
;
i_peek
+=
i_len
+
8
;
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_peek
)
!=
i_peek
)
return
VLC_EGENERIC
;
}
/* Some DTS wav files don't begin with a sync code so we do a more
* extensive search */
i_size
=
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
DTS_PROBE_SIZE
);
i
nt
i
_size
=
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
DTS_PROBE_SIZE
);
i_size
-=
DTS_MAX_HEADER_SIZE
;
while
(
i_peek
<
i_size
)
...
...
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