Fix crash in Vine
bug 9272491
Legacy YUV formats could trigger null pointer using YUV intrinsic.
Change-Id: I2eca7254a22c757c50e302a190e9aa5c05437534
diff --git a/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp b/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
index 3d989bd..939fbd5 100644
--- a/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
+++ b/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
@@ -132,6 +132,13 @@
const size_t strideUV = cp->alloc->mHal.drvState.lod[1].stride;
const uchar *uv = pinUV + ((p->y >> 1) * strideUV);
+ if (pinUV == NULL) {
+ // Legacy yuv support didn't fill in uv
+ uv = ((uint8_t *)cp->alloc->mHal.drvState.lod[0].mallocPtr) +
+ (cp->alloc->mHal.drvState.lod[0].stride *
+ cp->alloc->mHal.drvState.lod[0].dimY);
+ }
+
if(x2 > x1) {
#if defined(ARCH_ARM_HAVE_NEON)
int32_t len = (x2 - x1 - 1) >> 3;