shithub: libopusenc

Download patch

ref: b03c6c73cc3033b99f9fe5091cb63c4adf23741b
parent: a558fe08e1db6647d9f42b6eedcee3fb57c66af1
author: Mark Harris <mark.hsj@gmail.com>
date: Wed Sep 12 19:52:21 EDT 2018

Don't overrun buffer on oom if assertions disabled

--- a/src/ogg_packer.c
+++ b/src/ogg_packer.c
@@ -325,12 +325,9 @@
       /* Making sure we don't need to do that too often. */
       newsize = 1 + oggp->pages_size*3/2;
       newbuf = realloc(oggp->pages, newsize*sizeof(oggp_page));
-      if (newbuf != NULL) {
-        oggp->pages = newbuf;
-        oggp->pages_size = newsize;
-      } else {
-        assert(0);
-      }
+      assert(newbuf != NULL);
+      oggp->pages = newbuf;
+      oggp->pages_size = newsize;
     }
     p = &oggp->pages[oggp->pages_fill++];
     p->granulepos = oggp->curr_granule;