shithub: libvpx

Download patch

ref: 8628898acf6637fdc59e3d15f60030ac759481e4
parent: 6c323e359a413018d48c29720aef5654721e14c0
author: James Zern <jzern@google.com>
date: Thu Feb 11 13:09:33 EST 2016

vp10_receive_raw_frame: add missing setjmp

allocations done within this function are protected with
vpx_internal_error; adding the setjmp fixes a crash in
vp10_lookahead_push() under low memory conditions.

Change-Id: I5515017cd71b218840c506791b3a517da7ffc93e

--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -3808,13 +3808,22 @@
 int vp10_receive_raw_frame(VP10_COMP *cpi, unsigned int frame_flags,
                           YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                           int64_t end_time) {
-  VP10_COMMON *cm = &cpi->common;
+  VP10_COMMON *volatile const cm = &cpi->common;
   struct vpx_usec_timer timer;
-  int res = 0;
+  volatile int res = 0;
   const int subsampling_x = sd->subsampling_x;
   const int subsampling_y = sd->subsampling_y;
 #if CONFIG_VP9_HIGHBITDEPTH
-  const int use_highbitdepth = sd->flags & YV12_FLAG_HIGHBITDEPTH;
+  const int use_highbitdepth = (sd->flags & YV12_FLAG_HIGHBITDEPTH) != 0;
+#endif
+
+  if (setjmp(cm->error.jmp)) {
+    cm->error.setjmp = 0;
+    return -1;
+  }
+  cm->error.setjmp = 1;
+
+#if CONFIG_VP9_HIGHBITDEPTH
   check_initial_width(cpi, use_highbitdepth, subsampling_x, subsampling_y);
 #else
   check_initial_width(cpi, subsampling_x, subsampling_y);
@@ -3847,6 +3856,7 @@
     res = -1;
   }
 
+  cm->error.setjmp = 0;
   return res;
 }