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
1c618323
Commit
1c618323
authored
Dec 17, 2014
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msmpeg4: check memory allocations and propagate errors
Bug-Id: CID 1257781
parent
ed97963b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
mpegvideo.h
libavcodec/mpegvideo.h
+1
-1
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+2
-1
msmpeg4enc.c
libavcodec/msmpeg4enc.c
+14
-5
No files found.
libavcodec/mpegvideo.h
View file @
1c618323
...
@@ -854,7 +854,7 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s,
...
@@ -854,7 +854,7 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s,
int
ff_msmpeg4_decode_picture_header
(
MpegEncContext
*
s
);
int
ff_msmpeg4_decode_picture_header
(
MpegEncContext
*
s
);
int
ff_msmpeg4_decode_ext_header
(
MpegEncContext
*
s
,
int
buf_size
);
int
ff_msmpeg4_decode_ext_header
(
MpegEncContext
*
s
,
int
buf_size
);
int
ff_msmpeg4_decode_init
(
AVCodecContext
*
avctx
);
int
ff_msmpeg4_decode_init
(
AVCodecContext
*
avctx
);
void
ff_msmpeg4_encode_init
(
MpegEncContext
*
s
);
int
ff_msmpeg4_encode_init
(
MpegEncContext
*
s
);
int
ff_wmv2_decode_picture_header
(
MpegEncContext
*
s
);
int
ff_wmv2_decode_picture_header
(
MpegEncContext
*
s
);
int
ff_wmv2_decode_secondary_picture_header
(
MpegEncContext
*
s
);
int
ff_wmv2_decode_secondary_picture_header
(
MpegEncContext
*
s
);
void
ff_wmv2_add_mb
(
MpegEncContext
*
s
,
int16_t
block
[
6
][
64
],
uint8_t
*
dest_y
,
uint8_t
*
dest_cb
,
uint8_t
*
dest_cr
);
void
ff_wmv2_add_mb
(
MpegEncContext
*
s
,
int16_t
block
[
6
][
64
],
uint8_t
*
dest_y
,
uint8_t
*
dest_cb
,
uint8_t
*
dest_cr
);
...
...
libavcodec/mpegvideo_enc.c
View file @
1c618323
...
@@ -760,7 +760,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
...
@@ -760,7 +760,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
if
(
CONFIG_H263_ENCODER
&&
s
->
out_format
==
FMT_H263
)
if
(
CONFIG_H263_ENCODER
&&
s
->
out_format
==
FMT_H263
)
ff_h263_encode_init
(
s
);
ff_h263_encode_init
(
s
);
if
(
CONFIG_MSMPEG4_ENCODER
&&
s
->
msmpeg4_version
)
if
(
CONFIG_MSMPEG4_ENCODER
&&
s
->
msmpeg4_version
)
ff_msmpeg4_encode_init
(
s
);
if
((
ret
=
ff_msmpeg4_encode_init
(
s
))
<
0
)
return
ret
;
if
((
CONFIG_MPEG1VIDEO_ENCODER
||
CONFIG_MPEG2VIDEO_ENCODER
)
if
((
CONFIG_MPEG1VIDEO_ENCODER
||
CONFIG_MPEG2VIDEO_ENCODER
)
&&
s
->
out_format
==
FMT_MPEG1
)
&&
s
->
out_format
==
FMT_MPEG1
)
ff_mpeg1_encode_init
(
s
);
ff_mpeg1_encode_init
(
s
);
...
...
libavcodec/msmpeg4enc.c
View file @
1c618323
...
@@ -46,11 +46,14 @@
...
@@ -46,11 +46,14 @@
static
uint8_t
rl_length
[
NB_RL_TABLES
][
MAX_LEVEL
+
1
][
MAX_RUN
+
1
][
2
];
static
uint8_t
rl_length
[
NB_RL_TABLES
][
MAX_LEVEL
+
1
][
MAX_RUN
+
1
][
2
];
/* build the table which associate a (x,y) motion vector to a vlc */
/* build the table which associate a (x,y) motion vector to a vlc */
static
av_cold
void
init_mv_table
(
MVTable
*
tab
)
static
av_cold
int
init_mv_table
(
MVTable
*
tab
)
{
{
int
i
,
x
,
y
;
int
i
,
x
,
y
;
tab
->
table_mv_index
=
av_malloc
(
sizeof
(
uint16_t
)
*
4096
);
tab
->
table_mv_index
=
av_malloc
(
sizeof
(
uint16_t
)
*
4096
);
if
(
!
tab
->
table_mv_index
)
return
AVERROR
(
ENOMEM
);
/* mark all entries as not used */
/* mark all entries as not used */
for
(
i
=
0
;
i
<
4096
;
i
++
)
for
(
i
=
0
;
i
<
4096
;
i
++
)
tab
->
table_mv_index
[
i
]
=
tab
->
n
;
tab
->
table_mv_index
[
i
]
=
tab
->
n
;
...
@@ -60,6 +63,8 @@ static av_cold void init_mv_table(MVTable *tab)
...
@@ -60,6 +63,8 @@ static av_cold void init_mv_table(MVTable *tab)
y
=
tab
->
table_mvy
[
i
];
y
=
tab
->
table_mvy
[
i
];
tab
->
table_mv_index
[(
x
<<
6
)
|
y
]
=
i
;
tab
->
table_mv_index
[(
x
<<
6
)
|
y
]
=
i
;
}
}
return
0
;
}
}
void
ff_msmpeg4_code012
(
PutBitContext
*
pb
,
int
n
)
void
ff_msmpeg4_code012
(
PutBitContext
*
pb
,
int
n
)
...
@@ -113,10 +118,10 @@ static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run,
...
@@ -113,10 +118,10 @@ static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run,
return
size
;
return
size
;
}
}
av_cold
void
ff_msmpeg4_encode_init
(
MpegEncContext
*
s
)
av_cold
int
ff_msmpeg4_encode_init
(
MpegEncContext
*
s
)
{
{
static
int
init_done
=
0
;
static
int
init_done
=
0
;
int
i
;
int
i
,
ret
;
ff_msmpeg4_common_init
(
s
);
ff_msmpeg4_common_init
(
s
);
if
(
s
->
msmpeg4_version
>=
4
){
if
(
s
->
msmpeg4_version
>=
4
){
...
@@ -127,8 +132,10 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
...
@@ -127,8 +132,10 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
if
(
!
init_done
)
{
if
(
!
init_done
)
{
/* init various encoding tables */
/* init various encoding tables */
init_done
=
1
;
init_done
=
1
;
init_mv_table
(
&
ff_mv_tables
[
0
]);
if
((
ret
=
init_mv_table
(
&
ff_mv_tables
[
0
]))
<
0
)
init_mv_table
(
&
ff_mv_tables
[
1
]);
return
ret
;
if
((
ret
=
init_mv_table
(
&
ff_mv_tables
[
1
]))
<
0
)
return
ret
;
for
(
i
=
0
;
i
<
NB_RL_TABLES
;
i
++
)
for
(
i
=
0
;
i
<
NB_RL_TABLES
;
i
++
)
ff_init_rl
(
&
ff_rl_table
[
i
],
ff_static_rl_table_store
[
i
]);
ff_init_rl
(
&
ff_rl_table
[
i
],
ff_static_rl_table_store
[
i
]);
...
@@ -145,6 +152,8 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
...
@@ -145,6 +152,8 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
}
}
}
}
}
}
return
0
;
}
}
static
void
find_best_tables
(
MpegEncContext
*
s
)
static
void
find_best_tables
(
MpegEncContext
*
s
)
...
...
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