Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4749e074
Commit
4749e074
authored
Sep 24, 2011
by
Laurent Aimar
Committed by
Michael Niedermayer
Sep 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix out of bound reads in rle_unpack() of vmd video decoder.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e07377e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
vmdav.c
libavcodec/vmdav.c
+15
-8
No files found.
libavcodec/vmdav.c
View file @
4749e074
...
...
@@ -153,32 +153,39 @@ static void lz_unpack(const unsigned char *src, int src_len,
}
}
static
int
rle_unpack
(
const
unsigned
char
*
src
,
unsigned
char
*
des
t
,
int
src_len
,
int
dest_len
)
static
int
rle_unpack
(
const
unsigned
char
*
src
,
int
src_len
,
int
src_coun
t
,
unsigned
char
*
dest
,
int
dest_len
)
{
const
unsigned
char
*
ps
;
const
unsigned
char
*
ps_end
;
unsigned
char
*
pd
;
int
i
,
l
;
unsigned
char
*
dest_end
=
dest
+
dest_len
;
ps
=
src
;
ps_end
=
src
+
src_len
;
pd
=
dest
;
if
(
src_len
&
1
)
if
(
src_count
&
1
)
{
if
(
ps_end
-
ps
<
1
)
return
0
;
*
pd
++
=
*
ps
++
;
}
src_
len
>>=
1
;
src_
count
>>=
1
;
i
=
0
;
do
{
if
(
ps_end
-
ps
<
1
)
break
;
l
=
*
ps
++
;
if
(
l
&
0x80
)
{
l
=
(
l
&
0x7F
)
*
2
;
if
(
pd
+
l
>
dest_end
)
if
(
pd
+
l
>
dest_end
||
ps_end
-
ps
<
l
)
return
ps
-
src
;
memcpy
(
pd
,
ps
,
l
);
ps
+=
l
;
pd
+=
l
;
}
else
{
if
(
pd
+
i
>
dest_end
)
if
(
pd
+
i
>
dest_end
||
ps_end
-
ps
<
2
)
return
ps
-
src
;
for
(
i
=
0
;
i
<
l
;
i
++
)
{
*
pd
++
=
ps
[
0
];
...
...
@@ -187,7 +194,7 @@ static int rle_unpack(const unsigned char *src, unsigned char *dest,
ps
+=
2
;
}
i
+=
l
;
}
while
(
i
<
src_
len
);
}
while
(
i
<
src_
count
);
return
ps
-
src
;
}
...
...
@@ -330,7 +337,7 @@ static void vmd_decode(VmdVideoContext *s)
if
(
pb_end
-
pb
<
1
)
return
;
if
(
*
pb
++
==
0xFF
)
len
=
rle_unpack
(
pb
,
&
dp
[
ofs
],
len
,
frame_width
-
ofs
);
len
=
rle_unpack
(
pb
,
pb_end
-
pb
,
len
,
&
dp
[
ofs
]
,
frame_width
-
ofs
);
else
{
if
(
pb_end
-
pb
<
len
)
return
;
...
...
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