mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/matroskaenc: Don't waste bytes on SimpleTags length fields
Also check the (user-provided) tags for being overlong; the earlier code had an implicit unchecked size_t->int conversion. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
b845fff57d
commit
0148e85c3c
@ -1754,10 +1754,11 @@ static int mkv_write_tracks(AVFormatContext *s)
|
||||
|
||||
static int mkv_write_simpletag(AVIOContext *pb, const AVDictionaryEntry *t)
|
||||
{
|
||||
EBML_WRITER(4);
|
||||
uint8_t *key = av_strdup(t->key);
|
||||
uint8_t *p = key;
|
||||
const uint8_t *lang = NULL;
|
||||
ebml_master tag;
|
||||
int ret;
|
||||
|
||||
if (!key)
|
||||
return AVERROR(ENOMEM);
|
||||
@ -1775,15 +1776,15 @@ static int mkv_write_simpletag(AVIOContext *pb, const AVDictionaryEntry *t)
|
||||
p++;
|
||||
}
|
||||
|
||||
tag = start_ebml_master(pb, MATROSKA_ID_SIMPLETAG, 0);
|
||||
put_ebml_string(pb, MATROSKA_ID_TAGNAME, key);
|
||||
ebml_writer_open_master(&writer, MATROSKA_ID_SIMPLETAG);
|
||||
ebml_writer_add_string(&writer, MATROSKA_ID_TAGNAME, key);
|
||||
if (lang)
|
||||
put_ebml_string(pb, MATROSKA_ID_TAGLANG, lang);
|
||||
put_ebml_string(pb, MATROSKA_ID_TAGSTRING, t->value);
|
||||
end_ebml_master(pb, tag);
|
||||
ebml_writer_add_string(&writer, MATROSKA_ID_TAGLANG, lang);
|
||||
ebml_writer_add_string(&writer, MATROSKA_ID_TAGSTRING, t->value);
|
||||
ret = ebml_writer_write(&writer, pb);
|
||||
|
||||
av_freep(&key);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mkv_write_tag_targets(MatroskaMuxContext *mkv, AVIOContext **pb,
|
||||
|
@ -1,5 +1,5 @@
|
||||
3fa1f47c5c3d22b5c33156ff14928d6c *tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
72758 tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
058e95f1effefe3842b6174bba2693fc *tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
72707 tests/data/fate/matroska-dovi-write-config7.matroska
|
||||
#extradata 0: 116, 0x2b8d1669
|
||||
#extradata 1: 116, 0x2b8d1669
|
||||
#tb 0: 1/1000
|
||||
|
@ -1,5 +1,5 @@
|
||||
c2b76d47a9f0e9626a4999bd395cae08 *tests/data/fate/matroska-flac-extradata-update.matroska
|
||||
2029 tests/data/fate/matroska-flac-extradata-update.matroska
|
||||
56ff5763fd81ad3bc02c22402cd685e2 *tests/data/fate/matroska-flac-extradata-update.matroska
|
||||
2008 tests/data/fate/matroska-flac-extradata-update.matroska
|
||||
#extradata 0: 34, 0x7acb09e7
|
||||
#extradata 1: 34, 0x7acb09e7
|
||||
#extradata 2: 34, 0x443402dd
|
||||
|
@ -1,5 +1,5 @@
|
||||
36fda8942bfed91fed04c5ba63dc8b1a *tests/data/fate/matroska-h264-remux.matroska
|
||||
2036089 tests/data/fate/matroska-h264-remux.matroska
|
||||
ae0ccd32cc0d3bfc1eaa15c7fc985dfb *tests/data/fate/matroska-h264-remux.matroska
|
||||
2036075 tests/data/fate/matroska-h264-remux.matroska
|
||||
#tb 0: 1/25
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
|
@ -1,5 +1,5 @@
|
||||
542ababe5c088ab925ee49373d8b8a85 *tests/data/fate/matroska-mastering-display-metadata.matroska
|
||||
1669695 tests/data/fate/matroska-mastering-display-metadata.matroska
|
||||
64403411e52d7ba9081ab5692e422737 *tests/data/fate/matroska-mastering-display-metadata.matroska
|
||||
1669597 tests/data/fate/matroska-mastering-display-metadata.matroska
|
||||
#extradata 0: 4, 0x040901a3
|
||||
#extradata 3: 200, 0x506463a8
|
||||
#tb 0: 1/1000
|
||||
|
@ -1,5 +1,5 @@
|
||||
ce15d8b7577933a057c413af505500df *tests/data/fate/matroska-move-cues-to-front.matroska
|
||||
23210310 tests/data/fate/matroska-move-cues-to-front.matroska
|
||||
62064edeb4a621fd0097f04c410c165c *tests/data/fate/matroska-move-cues-to-front.matroska
|
||||
23210303 tests/data/fate/matroska-move-cues-to-front.matroska
|
||||
#tb 0: 1/1000
|
||||
#media_type 0: audio
|
||||
#codec_id 0: pcm_s24be
|
||||
|
@ -1,5 +1,5 @@
|
||||
a741bd63da27d6b8ce3a21009267703d *tests/data/fate/matroska-qt-mode.matroska
|
||||
1884278 tests/data/fate/matroska-qt-mode.matroska
|
||||
1e525172caec2bf4e191a68c97bbbc51 *tests/data/fate/matroska-qt-mode.matroska
|
||||
1884243 tests/data/fate/matroska-qt-mode.matroska
|
||||
#extradata 0: 90, 0x817d0185
|
||||
#tb 0: 1/1000
|
||||
#media_type 0: video
|
||||
|
@ -1,5 +1,5 @@
|
||||
d06be833da8e8d9d00bf334e0dfe8a58 *tests/data/fate/matroska-vp8-alpha-remux.matroska
|
||||
237192 tests/data/fate/matroska-vp8-alpha-remux.matroska
|
||||
e3912762161bb6e7f9607c085b371676 *tests/data/fate/matroska-vp8-alpha-remux.matroska
|
||||
237185 tests/data/fate/matroska-vp8-alpha-remux.matroska
|
||||
#tb 0: 1/1000
|
||||
#media_type 0: video
|
||||
#codec_id 0: vp8
|
||||
|
@ -1,5 +1,5 @@
|
||||
ba78b3e846d57002711bc481fa806717 *tests/data/fate/matroska-zero-length-block.matroska
|
||||
643 tests/data/fate/matroska-zero-length-block.matroska
|
||||
f37ba7e8a30eaa33c1fd0ef77447fb41 *tests/data/fate/matroska-zero-length-block.matroska
|
||||
636 tests/data/fate/matroska-zero-length-block.matroska
|
||||
#tb 0: 1/1000
|
||||
#media_type 0: subtitle
|
||||
#codec_id 0: subrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
6244b8750d4155d3c9357bab26396ef9 *tests/data/fate/rgb24-mkv.matroska
|
||||
58245 tests/data/fate/rgb24-mkv.matroska
|
||||
2c7192d8b62c6a11e311a09ab3bef3b8 *tests/data/fate/rgb24-mkv.matroska
|
||||
58224 tests/data/fate/rgb24-mkv.matroska
|
||||
#tb 0: 1/10
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
|
@ -1,5 +1,5 @@
|
||||
c39ad75ef516d1d2e1332d960ad1057b *tests/data/fate/webm-dash-chapters.webm
|
||||
111239 tests/data/fate/webm-dash-chapters.webm
|
||||
d3a67db17fdca71b9f8cf57c341a031b *tests/data/fate/webm-dash-chapters.webm
|
||||
111218 tests/data/fate/webm-dash-chapters.webm
|
||||
#extradata 0: 3469, 0xc6769ddc
|
||||
#tb 0: 1/1000
|
||||
#media_type 0: audio
|
||||
|
@ -1,3 +1,3 @@
|
||||
52d2c70afe0f9ac510819f723b5ceb3b *tests/data/lavf/lavf.mka
|
||||
43583 tests/data/lavf/lavf.mka
|
||||
036f852ae7ae18cf38ddc99ea39032fb *tests/data/lavf/lavf.mka
|
||||
43576 tests/data/lavf/lavf.mka
|
||||
tests/data/lavf/lavf.mka CRC=0x3a1da17e
|
||||
|
@ -1,3 +1,3 @@
|
||||
c1af29ab33c9477049672b62da221552 *tests/data/lavf/lavf.mkv
|
||||
320438 tests/data/lavf/lavf.mkv
|
||||
3e37e53471f20f2b7169afd75cba70d2 *tests/data/lavf/lavf.mkv
|
||||
320424 tests/data/lavf/lavf.mkv
|
||||
tests/data/lavf/lavf.mkv CRC=0xec6c3c68
|
||||
|
@ -1,3 +1,3 @@
|
||||
a669ae1a502ff0c487eee99753e7bef0 *tests/data/lavf/lavf.mkv_attachment
|
||||
472593 tests/data/lavf/lavf.mkv_attachment
|
||||
6a77b40186840d596bd584182ac3a283 *tests/data/lavf/lavf.mkv_attachment
|
||||
472579 tests/data/lavf/lavf.mkv_attachment
|
||||
tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
|
||||
|
@ -1,48 +1,48 @@
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 686 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 672 size: 208
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292318 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292304 size: 27834
|
||||
ret: 0 st: 0 flags:0 ts: 0.788000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292318 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292304 size: 27834
|
||||
ret: 0 st: 0 flags:1 ts:-0.317000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
ret:-1 st: 1 flags:0 ts: 2.577000
|
||||
ret: 0 st: 1 flags:1 ts: 1.471000
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320159 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320145 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.365002
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146870 size: 27925
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146856 size: 27925
|
||||
ret: 0 st:-1 flags:1 ts:-0.740831
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
ret:-1 st: 0 flags:0 ts: 2.153000
|
||||
ret: 0 st: 0 flags:1 ts: 1.048000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292318 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292304 size: 27834
|
||||
ret: 0 st: 1 flags:0 ts:-0.058000
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 686 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 672 size: 208
|
||||
ret: 0 st: 1 flags:1 ts: 2.836000
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320159 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320145 size: 209
|
||||
ret:-1 st:-1 flags:0 ts: 1.730004
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146870 size: 27925
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146856 size: 27925
|
||||
ret: 0 st: 0 flags:0 ts:-0.482000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
ret: 0 st: 0 flags:1 ts: 2.413000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292318 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292304 size: 27834
|
||||
ret:-1 st: 1 flags:0 ts: 1.307000
|
||||
ret: 0 st: 1 flags:1 ts: 0.201000
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 686 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 672 size: 208
|
||||
ret: 0 st:-1 flags:0 ts:-0.904994
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
ret: 0 st:-1 flags:1 ts: 1.989173
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292318 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292304 size: 27834
|
||||
ret: 0 st: 0 flags:0 ts: 0.883000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292318 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292304 size: 27834
|
||||
ret: 0 st: 0 flags:1 ts:-0.222000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
ret:-1 st: 1 flags:0 ts: 2.672000
|
||||
ret: 0 st: 1 flags:1 ts: 1.566000
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320159 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320145 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146870 size: 27925
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146856 size: 27925
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 902 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 888 size: 27837
|
||||
|
Loading…
Reference in New Issue
Block a user