mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-23 23:21:06 +01:00
fftools/ffmpeg: avoid possible invalid reads with short -tag values
Fixes #10319 and #10309.
(cherry picked from commit 89c9a3ac35)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
2c11164707
commit
8f61cbf1b9
2 changed files with 11 additions and 4 deletions
|
|
@ -628,8 +628,12 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
|
|||
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
|
||||
if (codec_tag) {
|
||||
uint32_t tag = strtol(codec_tag, &next, 0);
|
||||
if (*next)
|
||||
tag = AV_RL32(codec_tag);
|
||||
if (*next) {
|
||||
uint8_t buf[4] = { 0 };
|
||||
memcpy(buf, codec_tag, FFMIN(sizeof(buf), strlen(codec_tag)));
|
||||
tag = AV_RL32(buf);
|
||||
}
|
||||
|
||||
st->codecpar->codec_tag = tag;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -606,8 +606,11 @@ static OutputStream *new_output_stream(Muxer *mux, const OptionsContext *o,
|
|||
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
|
||||
if (codec_tag) {
|
||||
uint32_t tag = strtol(codec_tag, &next, 0);
|
||||
if (*next)
|
||||
tag = AV_RL32(codec_tag);
|
||||
if (*next) {
|
||||
uint8_t buf[4] = { 0 };
|
||||
memcpy(buf, codec_tag, FFMIN(sizeof(buf), strlen(codec_tag)));
|
||||
tag = AV_RL32(buf);
|
||||
}
|
||||
ost->st->codecpar->codec_tag = tag;
|
||||
if (ost->enc_ctx)
|
||||
ost->enc_ctx->codec_tag = tag;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue