Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Speex
Commits
566a73a6
Commit
566a73a6
authored
Aug 12, 2014
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speexenc: don't read past the end of WAV data
Fixes
https://trac.xiph.org/ticket/2036
Reported by justcar
parent
1f61ae81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
src/speexenc.c
src/speexenc.c
+19
-3
No files found.
src/speexenc.c
View file @
566a73a6
...
...
@@ -89,24 +89,40 @@ static int read_samples(FILE *fin,int frame_size, int bits, int channels, int ls
int
i
;
short
*
s
;
int
nb_read
;
size_t
to_read
;
if
(
size
&&
*
size
<=
0
)
{
return
0
;
}
to_read
=
bits
/
8
*
channels
*
frame_size
;
/*Read input audio*/
if
(
size
)
*
size
-=
bits
/
8
*
channels
*
frame_size
;
{
if
(
*
size
>=
to_read
)
{
*
size
-=
to_read
;
}
else
{
to_read
=
*
size
;
*
size
=
0
;
}
}
if
(
buff
)
{
for
(
i
=
0
;
i
<
12
;
i
++
)
in
[
i
]
=
buff
[
i
];
nb_read
=
fread
(
in
+
12
,
1
,
bits
/
8
*
channels
*
frame_size
-
12
,
fin
)
+
12
;
nb_read
=
fread
(
in
+
12
,
1
,
to_read
-
12
,
fin
)
+
12
;
if
(
size
)
*
size
+=
12
;
}
else
{
nb_read
=
fread
(
in
,
1
,
bits
/
8
*
channels
*
frame_size
,
fin
);
nb_read
=
fread
(
in
,
1
,
to_read
,
fin
);
}
nb_read
/=
bits
/
8
*
channels
;
/*fprintf (stderr, "%d\n", nb_read);*/
...
...
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