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

Unified Diff: content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc

Issue 1706023003: Moving the validation of bitstream_buffer into VDA implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review Created 4 years, 10 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
Index: content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
diff --git a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
index 8efb362180dce6690939cd39fd2e8ee4c50b9664..d294ae591954025cc7fd0ac133cd673a0273e239 100644
--- a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
+++ b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
@@ -289,6 +289,15 @@ void VaapiJpegDecodeAccelerator::Decode(
DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id()
<< " size: " << bitstream_buffer.size();
+
+ if (bitstream_buffer.id() < 0) {
+ LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id();
+ if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle()))
+ base::SharedMemory::CloseHandle(bitstream_buffer.handle());
+ NotifyErrorFromDecoderThread(bitstream_buffer.id(), INVALID_ARGUMENT);
+ return;
+ }
+
scoped_ptr<base::SharedMemory> shm(
new base::SharedMemory(bitstream_buffer.handle(), true));

Powered by Google App Engine
This is Rietveld 408576698