~ubuntu-branches/ubuntu/trusty/libav/trusty-security

« back to all changes in this revision

Viewing changes to libavcodec/cdgraphics.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-08-09 19:50:43 UTC
  • mfrom: (1.2.23)
  • Revision ID: package-import@ubuntu.com-20140809195043-fuzr0ogwx6egylcj
Tags: 6:9.16-0ubuntu0.14.04.1
* New upstream release 9.14:
  - vp3: Copy all 3 frames for thread updates (CVE-2011-3934)
  - mpegts: Do not try to write a PMT larger than SECTION_SIZE (CVE-2014-2263)
  - mpegts: Define the section length with a constant
  - error_concealment: avoid using the picture if not fully setup (CVE-2013-0860)
  - svq1: do not modify the input packet
  - cdgraphics: do not return 0 from the decode function
  - cdgraphics: switch to bytestream2 (CVE-2013-3674)
  - huffyuvdec: check width size for yuv422p (CVE-2013-0848)
  - mmvideo: check horizontal coordinate too (CVE-2013-3672)
  - wmalosslessdec: fix mclms_coeffs* array size (CVE-2014-2098)
  - lavc: Check the image size before calling get_buffer (CVE-2011-3935)
  - huffyuv: Check and propagate function return values (CVE-2013-0868)
  - h264: prevent theoretical infinite loop in SEI parsing (CVE-2011-3946)
  - h264_sei: check SEI size
  - pgssubdec: Check RLE size before copying (CVE-2013-0852)
  - fate: Add dependencies for dct/fft/mdct/rdft tests
  - video4linux2: Avoid a floating point exception
  - vf_select: Drop a debug av_log with an unchecked double to enum conversion
  - eamad: use the bytestream2 API instead of AV_RL (CVE-2013-0851)
  

Show diffs side-by-side

added added

removed removed

Lines of Context:
269
269
static int cdg_decode_frame(AVCodecContext *avctx,
270
270
                            void *data, int *got_frame, AVPacket *avpkt)
271
271
{
272
 
    const uint8_t *buf = avpkt->data;
 
272
    GetByteContext gb;
273
273
    int buf_size       = avpkt->size;
274
274
    int ret;
275
275
    uint8_t command, inst;
277
277
    AVFrame new_frame;
278
278
    CDGraphicsContext *cc = avctx->priv_data;
279
279
 
280
 
    if (buf_size < CDG_MINIMUM_PKT_SIZE) {
281
 
        av_log(avctx, AV_LOG_ERROR, "buffer too small for decoder\n");
282
 
        return AVERROR(EINVAL);
283
 
    }
 
280
    bytestream2_init(&gb, avpkt->data, avpkt->size);
 
281
 
284
282
 
285
283
    ret = avctx->reget_buffer(avctx, &cc->frame);
286
284
    if (ret) {
288
286
        return ret;
289
287
    }
290
288
 
291
 
    command = bytestream_get_byte(&buf);
292
 
    inst    = bytestream_get_byte(&buf);
 
289
    command = bytestream2_get_byte(&gb);
 
290
    inst    = bytestream2_get_byte(&gb);
293
291
    inst    &= CDG_MASK;
294
 
    buf += 2;  /// skipping 2 unneeded bytes
295
 
    bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
 
292
    bytestream2_skip(&gb, 2);
 
293
    bytestream2_get_buffer(&gb, cdg_data, sizeof(cdg_data));
296
294
 
297
295
    if ((command & CDG_MASK) == CDG_COMMAND) {
298
296
        switch (inst) {
351
349
        *got_frame = 1;
352
350
    } else {
353
351
        *got_frame = 0;
354
 
        buf_size   = 0;
355
352
    }
356
353
 
357
354
    *(AVFrame *) data = cc->frame;
358
 
    return buf_size;
 
355
    return avpkt->size;
359
356
}
360
357
 
361
358
static av_cold int cdg_decode_end(AVCodecContext *avctx)