Ticket #13428: 20190319-avformat-memset.patch

File 20190319-avformat-memset.patch, 865 bytes (added by Klaas de Waal, 5 years ago)

Clear padding memory at end of video data before probing video format.

  • mythtv/libs/libmythtv/avformatdecoder.cpp

    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index ef3878b630..6e27b07042 100644
    a b bool AvFormatDecoder::CanHandle(char testbuf[kDecoderProbeBufferSize], 
    958958        score--;
    959959    }
    960960
     961    memset(probe.buf + probe.buf_size, 0, AVPROBE_PADDING_SIZE);
     962
    961963    if (av_probe_input_format2(&probe, true, &score))
    962964        return true;
    963965    return false;
    int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    10581060    else
    10591061        probe.buf_size = kDecoderProbeBufferSize - AVPROBE_PADDING_SIZE;
    10601062
     1063    memset(probe.buf + probe.buf_size, 0, AVPROBE_PADDING_SIZE);
     1064
    10611065    LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "OpenFile -- begin");
    10621066
    10631067    fmt = av_probe_input_format(&probe, true);