Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1032)

Unified Diff: core/fxcodec/codec/fx_codec_jpx_opj.cpp

Issue 2351623002: Avoid nullptr access in sycc422_to_rgb and sycc420_to_rgb (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/codec/fx_codec_jpx_opj.cpp
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
index a1c38d06e93629b1ce277e966a2bc0329987e71e..e64fa471cd20df7361c3c8252dde1d23b6cb3b64 100644
--- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -247,6 +247,9 @@ static void sycc422_to_rgb(opj_image_t* img) {
const int* y = img->comps[0].data;
const int* cb = img->comps[1].data;
const int* cr = img->comps[2].data;
+ if (!y || !cb || !cr)
+ return;
+
int *d0, *d1, *d2, *r, *g, *b;
d0 = r = FX_Alloc(int, max_size.ValueOrDie());
d1 = g = FX_Alloc(int, max_size.ValueOrDie());
@@ -324,6 +327,9 @@ void sycc420_to_rgb(opj_image_t* img) {
const int* y = img->comps[0].data;
const int* cb = img->comps[1].data;
const int* cr = img->comps[2].data;
+ if (!y || !cb || !cr)
+ return;
+
const int* ny = nullptr;
int* nr = nullptr;
int* ng = nullptr;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698