• wm4's avatar
    avcodec/dvdsubdec: fix accessing dangling pointers · 3b4e9ddd
    wm4 authored
    dvdsub_decode() can call append_to_cached_buf() 2 times, the second time
    with ctx->buf as argument. If the second append_to_cached_buf() reallocs
    ctx->buf, the argument will be a pointer to the previous, freed block.
    This can cause invalid reads at least with some fuzzed files - and
    possibly with valid files.
    
    Since packets can apparently not be larger than 64K (even if packets are
    combined), just use a fixed size buffer. It will be allocated as part of
    the DVDSubContext, and although some memory is "wasted", it's relatively
    minimal by modern standards and should be acceptable.
    Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
    (cherry picked from commit 81657771)
    Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
    3b4e9ddd
dvdsubdec.c 20 KB