Ticket #902: 0001-fraps-fix-crash-when-multiple-versions-are-found-in-.patch

File 0001-fraps-fix-crash-when-multiple-versions-are-found-in-.patch, 1.3 KB (added by oanastratulat, 5 years ago)

Patch for the ticket

  • libavcodec/fraps.c

    From a6e1c28b9f170d73e1ccdb4416c4a86c23e18e77 Mon Sep 17 00:00:00 2001
    From: Oana Stratulat <oanaandreeastratulat@gmail.com>
    Date: Mon, 9 Jan 2012 01:34:53 +0200
    Subject: [PATCH] fraps: fix crash when multiple versions are found in file
    
    ---
     libavcodec/fraps.c |    8 ++++++++
     1 files changed, 8 insertions(+), 0 deletions(-)
    
    diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
    index de98da7..74eb106 100644
    a b typedef struct FrapsContext{ 
    4848    uint8_t *tmpbuf; 
    4949    int tmpbuf_size; 
    5050    DSPContext dsp; 
     51    int version; 
    5152} FrapsContext; 
    5253 
    5354 
    static av_cold int decode_init(AVCodecContext *avctx) 
    6566 
    6667    s->avctx = avctx; 
    6768    s->tmpbuf = NULL; 
     69    s->version = -1; 
    6870 
    6971    dsputil_init(&s->dsp, avctx); 
    7072 
    static int decode_frame(AVCodecContext *avctx, 
    143145 
    144146    header = AV_RL32(buf); 
    145147    version = header & 0xff; 
     148    if (version != s->version && s->version > -1) { 
     149        av_log(avctx, AV_LOG_INFO, "Multiple versions encountered in file\n"); 
     150        if (s->frame.data[0]) 
     151            avctx->release_buffer(avctx, &s->frame); 
     152    } 
     153    s->version = version; 
    146154    header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ 
    147155 
    148156    if (version > 5) {