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
8099187e
Commit
8099187e
authored
May 03, 2012
by
Kostya Shishkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dfa: add some checks to ensure that decoder won't write past frame end
parent
96f7590e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
dfa.c
libavcodec/dfa.c
+7
-1
No files found.
libavcodec/dfa.c
View file @
8099187e
...
...
@@ -164,6 +164,8 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height
}
else
if
(
bitbuf
&
(
mask
<<
1
))
{
frame
+=
bytestream2_get_le16
(
gb
)
*
2
;
}
else
{
if
(
frame_end
-
frame
<
width
+
2
)
return
AVERROR_INVALIDDATA
;
frame
[
0
]
=
frame
[
1
]
=
frame
[
width
]
=
frame
[
width
+
1
]
=
bytestream2_get_byte
(
gb
);
frame
+=
2
;
...
...
@@ -224,6 +226,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height
const
uint8_t
*
frame_end
=
frame
+
width
*
height
;
uint8_t
*
line_ptr
;
int
count
,
i
,
v
,
lines
,
segments
;
int
y
=
0
;
lines
=
bytestream2_get_le16
(
gb
);
if
(
lines
>
height
)
...
...
@@ -234,10 +237,12 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height
return
-
1
;
segments
=
bytestream2_get_le16u
(
gb
);
while
((
segments
&
0xC000
)
==
0xC000
)
{
unsigned
skip_lines
=
-
(
int16_t
)
segments
;
unsigned
delta
=
-
((
int16_t
)
segments
*
width
);
if
(
frame_end
-
frame
<=
delta
)
if
(
frame_end
-
frame
<=
delta
||
y
+
lines
+
skip_lines
>
height
)
return
-
1
;
frame
+=
delta
;
y
+=
skip_lines
;
segments
=
bytestream2_get_le16
(
gb
);
}
if
(
segments
&
0x8000
)
{
...
...
@@ -246,6 +251,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height
}
line_ptr
=
frame
;
frame
+=
width
;
y
++
;
while
(
segments
--
)
{
if
(
frame
-
line_ptr
<=
bytestream2_peek_byte
(
gb
))
return
-
1
;
...
...
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