Ticket #5795: patchinvalidpbm.diff

File patchinvalidpbm.diff, 994 bytes (added by cehoyos, 3 years ago)
  • libavcodec/pnmdec.c

    diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
    index d4261a4..b2f1b44 100644
    a b static int pnm_decode_frame(AVCodecContext *avctx, void *data, 
    124124    do_read:
    125125        ptr      = p->data[0];
    126126        linesize = p->linesize[0];
    127         if (s->bytestream + n * avctx->height > s->bytestream_end)
     127        if (0&&s->bytestream + n * avctx->height > s->bytestream_end)
    128128            return AVERROR_INVALIDDATA;
    129129        if(s->type < 4 || (is_mono && s->type==7)){
    130130            for (i=0; i<avctx->height; i++) {
    static int pnm_decode_frame(AVCodecContext *avctx, void *data, 
    160160        }else{
    161161        for (i = 0; i < avctx->height; i++) {
    162162            if (!upgrade)
     163                if (s->bytestream + n <= s->bytestream_end)
    163164                samplecpy(ptr, s->bytestream, n, s->maxval);
    164165            else if (upgrade == 1) {
    165166                unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval;