summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Novosad <junov@chromium.org>2022-06-07 13:57:35 +0000
committerMichael BrĂ¼ning <michael.bruning@qt.io>2022-06-16 19:53:04 +0000
commita51ce88a013b388254f51a55639678d1f332ffb1 (patch)
treef5e79a4ad9d3bafd797f7cf541ecb0d48aa124d1
parent60882e1d01a545f2fe9f99b667fd76677d6b88f5 (diff)
downloadqtwebengine-chromium-a51ce88a013b388254f51a55639678d1f332ffb1.tar.gz
[Backport] CVE-2022-2010: Out of bounds read in compositing
Manual backport of patch originally reviewed on https://chromium-review.googlesource.com/c/chromium/src/+/3669596: PaintOpReader: Harden PaintImage deserialization This fix prevents the deserialization of PaintImage pixel data from reading data out of bounds when the block of serialized pixel data isn't large enough to cover the expected amount of data, given the size and format of the image. Bug: 1325298 Change-Id: Icbeb405d2031d7d8ce4537836d7996ce7885f6d1 Commit-Queue: Justin Novosad <junov@chromium.org> Reviewed-by: Jonathan Ross <jonross@chromium.org> Cr-Commit-Position: refs/heads/main@{#1007804} Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--chromium/cc/paint/paint_op_reader.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/chromium/cc/paint/paint_op_reader.cc b/chromium/cc/paint/paint_op_reader.cc
index 812e348a401..95088915eaf 100644
--- a/chromium/cc/paint/paint_op_reader.cc
+++ b/chromium/cc/paint/paint_op_reader.cc
@@ -318,6 +318,10 @@ void PaintOpReader::Read(PaintImage* image) {
SkImageInfo image_info =
SkImageInfo::Make(width, height, color_type, kPremul_SkAlphaType);
+ if (pixel_size < image_info.computeMinByteSize()) {
+ SetInvalid();
+ return;
+ }
const volatile void* pixel_data = ExtractReadableMemory(pixel_size);
if (!valid_)
return;