Opened 5 years ago

Closed 5 years ago

#2364 closed defect (invalid)

matroska_read_header() leaks memory on failure

Reported by: wolenetz Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mkv leak
Cc: dalecurtis, rbultje Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

matroska_read_header() leaks memory in two places on failure:

57 bytes in 1 blocks are definitely lost in loss record 4 of 12

at 0x4C2B292: posix_memalign (vg_replace_malloc.c:878)
by 0x61D350: av_malloc (mem.c:93)
by 0x61D467: av_mallocz (mem.c:203)
by 0x53AACC: ff_fast_malloc (utils.c:87)
by 0x53AD89: av_fast_padded_malloc (utils.c:107)
by 0x452A92: ebml_read_binary (matroskadec.c:786)
by 0x453BBE: ebml_parse_elem (matroskadec.c:963)
by 0x453D6B: ebml_parse_id (matroskadec.c:874)
by 0x4538F3: ebml_parse (matroskadec.c:887)
by 0x4539A9: ebml_parse_nest (matroskadec.c:910)
by 0x453BA2: ebml_parse_elem (matroskadec.c:968)
by 0x453D6B: ebml_parse_id (matroskadec.c:874)
by 0x4538F3: ebml_parse (matroskadec.c:887)
by 0x4539A9: ebml_parse_nest (matroskadec.c:910)
by 0x453BA2: ebml_parse_elem (matroskadec.c:968)
by 0x453D6B: ebml_parse_id (matroskadec.c:874)
by 0x4538F3: ebml_parse (matroskadec.c:887)
by 0x45465C: matroska_read_header (matroskadec.c:1514)
by 0x46ED6E: avformat_open_input (utils.c:626)
by 0x42CB26: open_input_file (ffmpeg_opt.c:769)
by 0x42A33D: open_files.isra.1 (ffmpeg_opt.c:2304)
by 0x42EA75: ffmpeg_parse_options (ffmpeg_opt.c:2341)
by 0x4272E5: main (ffmpeg.c:3299)

and:

969 (704 direct, 265 indirect) bytes in 2 blocks are definitely lost in loss record 10 of 12

at 0x4C2EEE2: realloc (vg_replace_malloc.c:661)
by 0x61D395: av_realloc (mem.c:160)
by 0x453B04: ebml_parse_elem (matroskadec.c:937)
by 0x453D6B: ebml_parse_id (matroskadec.c:874)
by 0x4538F3: ebml_parse (matroskadec.c:887)
by 0x4539A9: ebml_parse_nest (matroskadec.c:910)
by 0x453BA2: ebml_parse_elem (matroskadec.c:968)
by 0x453D6B: ebml_parse_id (matroskadec.c:874)
by 0x4538F3: ebml_parse (matroskadec.c:887)
by 0x4539A9: ebml_parse_nest (matroskadec.c:910)
by 0x453BA2: ebml_parse_elem (matroskadec.c:968)
by 0x453D6B: ebml_parse_id (matroskadec.c:874)
by 0x4538F3: ebml_parse (matroskadec.c:887)
by 0x45465C: matroska_read_header (matroskadec.c:1514)
by 0x46ED6E: avformat_open_input (utils.c:626)
by 0x42CB26: open_input_file (ffmpeg_opt.c:769)
by 0x42A33D: open_files.isra.1 (ffmpeg_opt.c:2304)
by 0x42EA75: ffmpeg_parse_options (ffmpeg_opt.c:2341)
by 0x4272E5: main (ffmpeg.c:3299)


Found via valgrind + the attached case.

Attachments (1)

110849.mkv (1.0 MB) - added by wolenetz 5 years ago.

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by wolenetz

comment:1 Changed 5 years ago by cehoyos

  • Keywords mkv added; matroska removed

Please provide the command line that produces the memleak together with the complete, uncut console output. (I cannot reproduce the problem here.)

comment:2 Changed 5 years ago by wolenetz

I had a repro, but it is apparently introduced in my local merge and does not repro when I take a fresh clone of ffmpeg. This likely is not a current bug in ffmpeg.

comment:3 Changed 5 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

Thank you for the clarification!

Note: See TracTickets for help on using tickets.