On Wed, 21 Sep 2011, Ronald S. Bultje wrote:

On Wed, Sep 21, 2011 at 1:17 PM, Alex Converse <[email protected]> wrote:
On Wed, Sep 21, 2011 at 10:36 AM, Kostya Shishkov
<[email protected]> wrote:
On Wed, Sep 21, 2011 at 02:07:13PM +0200, Tomas Härdin wrote:
On Wed, 2011-09-21 at 13:09 +0200, Diego Biurrun wrote:
From: Maxim Poliakovski <[email protected]>
+static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
+                               const int data_size, AVCodecContext *avctx)
+{
...
+
+    ctx->qmat_changed = 0;
+    ptr   = buf + 20;
+    flags = buf[19];
+    if (flags & 2) {
+        if (memcmp(ctx->qmat_luma, ptr, 64)) {
+            memcpy(ctx->qmat_luma, ptr, 64);
+            ctx->qmat_changed = 1;
+        }

Won't this read past the end of the buffer if 28 <= data_size < 28+64 or
thereabouts?

+        ptr += 64;
+    } else {
+        memset(ctx->qmat_luma, 4, 64);
+        ctx->qmat_changed = 1;
+    }
+
+    if (flags & 1) {
+        if (memcmp(ctx->qmat_chroma, ptr, 64)) {
+            memcpy(ctx->qmat_chroma, ptr, 64);
+            ctx->qmat_changed = 1;
+        }

Ditto here.

Added checks here plus some small improvements.


+static void decode_slice_plane(ProresContext *ctx, const uint8_t *buf,
+                               int data_size, uint16_t *out_ptr,
+                               int linesize, int mbs_per_slice,
+                               int blocks_per_mb, int plane_size_factor,
+                               const int16_t *qmat)
+{
+    GetBitContext gb;
+    DECLARE_ALIGNED(16, DCTELEM, blocks[8 * 4 * 64]);

LOCAL_ALIGNED?

Other than that I think this looks pretty reasonable and we should
commit what we have and continue to improve it with additional
patches.

+1. Go for it.

Pushed.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to