Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
067432c1
Commit
067432c1
authored
Feb 14, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loco: check that there is data left after decoding a plane.
CC:libav-stable@libav.org
parent
de6dfa2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
loco.c
libavcodec/loco.c
+30
-0
No files found.
libavcodec/loco.c
View file @
067432c1
...
@@ -190,43 +190,70 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -190,43 +190,70 @@ static int decode_frame(AVCodecContext *avctx,
case
LOCO_CYUY2
:
case
LOCO_YUY2
:
case
LOCO_UYVY
:
case
LOCO_CYUY2
:
case
LOCO_YUY2
:
case
LOCO_UYVY
:
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
],
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
],
avctx
->
width
,
avctx
->
height
,
p
->
linesize
[
0
],
buf
,
buf_size
,
1
);
p
->
linesize
[
0
],
buf
,
buf_size
,
1
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
1
],
avctx
->
width
/
2
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
1
],
avctx
->
width
/
2
,
avctx
->
height
,
p
->
linesize
[
1
],
buf
,
buf_size
,
1
);
p
->
linesize
[
1
],
buf
,
buf_size
,
1
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
2
],
avctx
->
width
/
2
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
2
],
avctx
->
width
/
2
,
avctx
->
height
,
p
->
linesize
[
2
],
buf
,
buf_size
,
1
);
p
->
linesize
[
2
],
buf
,
buf_size
,
1
);
break
;
break
;
case
LOCO_CYV12
:
case
LOCO_YV12
:
case
LOCO_CYV12
:
case
LOCO_YV12
:
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
],
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
],
avctx
->
width
,
avctx
->
height
,
p
->
linesize
[
0
],
buf
,
buf_size
,
1
);
p
->
linesize
[
0
],
buf
,
buf_size
,
1
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
2
],
avctx
->
width
/
2
,
avctx
->
height
/
2
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
2
],
avctx
->
width
/
2
,
avctx
->
height
/
2
,
p
->
linesize
[
2
],
buf
,
buf_size
,
1
);
p
->
linesize
[
2
],
buf
,
buf_size
,
1
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
1
],
avctx
->
width
/
2
,
avctx
->
height
/
2
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
1
],
avctx
->
width
/
2
,
avctx
->
height
/
2
,
p
->
linesize
[
1
],
buf
,
buf_size
,
1
);
p
->
linesize
[
1
],
buf
,
buf_size
,
1
);
break
;
break
;
case
LOCO_CRGB
:
case
LOCO_RGB
:
case
LOCO_CRGB
:
case
LOCO_RGB
:
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
avctx
->
height
-
1
),
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
avctx
->
height
-
1
),
avctx
->
width
,
avctx
->
height
,
-
p
->
linesize
[
0
],
buf
,
buf_size
,
3
);
-
p
->
linesize
[
0
],
buf
,
buf_size
,
3
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
avctx
->
height
-
1
)
+
1
,
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
avctx
->
height
-
1
)
+
1
,
avctx
->
width
,
avctx
->
height
,
-
p
->
linesize
[
0
],
buf
,
buf_size
,
3
);
-
p
->
linesize
[
0
],
buf
,
buf_size
,
3
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
avctx
->
height
-
1
)
+
2
,
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
avctx
->
height
-
1
)
+
2
,
avctx
->
width
,
avctx
->
height
,
-
p
->
linesize
[
0
],
buf
,
buf_size
,
3
);
-
p
->
linesize
[
0
],
buf
,
buf_size
,
3
);
break
;
break
;
case
LOCO_RGBA
:
case
LOCO_RGBA
:
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
],
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
],
avctx
->
width
,
avctx
->
height
,
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
1
,
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
1
,
avctx
->
width
,
avctx
->
height
,
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
2
,
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
2
,
avctx
->
width
,
avctx
->
height
,
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
if
(
decoded
>=
buf_size
)
goto
buf_too_small
;
buf
+=
decoded
;
buf_size
-=
decoded
;
buf
+=
decoded
;
buf_size
-=
decoded
;
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
3
,
avctx
->
width
,
avctx
->
height
,
decoded
=
loco_decode_plane
(
l
,
p
->
data
[
0
]
+
3
,
avctx
->
width
,
avctx
->
height
,
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
p
->
linesize
[
0
],
buf
,
buf_size
,
4
);
break
;
break
;
...
@@ -236,6 +263,9 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -236,6 +263,9 @@ static int decode_frame(AVCodecContext *avctx,
*
(
AVFrame
*
)
data
=
l
->
pic
;
*
(
AVFrame
*
)
data
=
l
->
pic
;
return
buf_size
;
return
buf_size
;
buf_too_small:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Input data too small.
\n
"
);
return
AVERROR
(
EINVAL
);
}
}
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
...
...
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