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
96fadfb1
Commit
96fadfb1
authored
Jun 01, 2012
by
Kostya Shishkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bmv: add stricter checks for invalid decoded length
This makes decoder handle random data passed as BMV frame data.
parent
cf3a1948
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
bmv.c
libavcodec/bmv.c
+7
-3
No files found.
libavcodec/bmv.c
View file @
96fadfb1
...
...
@@ -52,7 +52,7 @@ typedef struct BMVDecContext {
static
int
decode_bmv_frame
(
const
uint8_t
*
source
,
int
src_len
,
uint8_t
*
frame
,
int
frame_off
)
{
int
val
,
saved_val
=
0
;
unsigned
val
,
saved_val
=
0
;
int
tmplen
=
src_len
;
const
uint8_t
*
src
,
*
source_end
=
source
+
src_len
;
uint8_t
*
frame_end
=
frame
+
SCREEN_WIDE
*
SCREEN_HIGH
;
...
...
@@ -140,7 +140,9 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
case
1
:
if
(
forward
)
{
if
(
dst
-
frame
+
SCREEN_WIDE
<
frame_off
||
frame_end
-
dst
<
frame_off
+
len
)
dst
-
frame
+
SCREEN_WIDE
+
frame_off
<
0
||
frame_end
-
dst
<
frame_off
+
len
||
frame_end
-
dst
<
len
)
return
-
1
;
for
(
i
=
0
;
i
<
len
;
i
++
)
dst
[
i
]
=
dst
[
frame_off
+
i
];
...
...
@@ -148,7 +150,9 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
}
else
{
dst
-=
len
;
if
(
dst
-
frame
+
SCREEN_WIDE
<
frame_off
||
frame_end
-
dst
<
frame_off
+
len
)
dst
-
frame
+
SCREEN_WIDE
+
frame_off
<
0
||
frame_end
-
dst
<
frame_off
+
len
||
frame_end
-
dst
<
len
)
return
-
1
;
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
dst
[
i
]
=
dst
[
frame_off
+
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