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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile cleanup and fix Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 4083 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 const char* reason = "framebuffer incomplete"; 4094 const char* reason = "framebuffer incomplete";
4095 WebGLFramebuffer* framebuffer = getReadFramebufferBinding(); 4095 WebGLFramebuffer* framebuffer = getReadFramebufferBinding();
4096 if (framebuffer && 4096 if (framebuffer &&
4097 framebuffer->checkDepthStencilStatus(&reason) != 4097 framebuffer->checkDepthStencilStatus(&reason) !=
4098 GL_FRAMEBUFFER_COMPLETE) { 4098 GL_FRAMEBUFFER_COMPLETE) {
4099 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason); 4099 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason);
4100 return; 4100 return;
4101 } 4101 }
4102 if (!validateReadPixelsFuncParameters( 4102 if (!validateReadPixelsFuncParameters(
4103 width, height, format, type, pixels, 4103 width, height, format, type, pixels,
4104 static_cast<long long>(pixels->byteLength() - 4104 static_cast<long long>(
4105 offsetInBytes.ValueOrDie()))) { 4105 (pixels->byteLength() - offsetInBytes).ValueOrDie()))) {
4106 return; 4106 return;
4107 } 4107 }
4108 clearIfComposited(); 4108 clearIfComposited();
4109 uint8_t* data = 4109 uint8_t* data =
4110 static_cast<uint8_t*>(pixels->baseAddress()) + offsetInBytes.ValueOrDie(); 4110 static_cast<uint8_t*>(pixels->baseAddress()) + offsetInBytes.ValueOrDie();
4111 { 4111 {
4112 ScopedDrawingBufferBinder binder(drawingBuffer(), framebuffer); 4112 ScopedDrawingBufferBinder binder(drawingBuffer(), framebuffer);
4113 contextGL()->ReadPixels(x, y, width, height, format, type, data); 4113 contextGL()->ReadPixels(x, y, width, height, format, type, data);
4114 } 4114 }
4115 } 4115 }
(...skipping 3645 matching lines...) Expand 10 before | Expand all | Expand 10 after
7761 7761
7762 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7762 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7763 HTMLCanvasElementOrOffscreenCanvas& result) const { 7763 HTMLCanvasElementOrOffscreenCanvas& result) const {
7764 if (canvas()) 7764 if (canvas())
7765 result.setHTMLCanvasElement(canvas()); 7765 result.setHTMLCanvasElement(canvas());
7766 else 7766 else
7767 result.setOffscreenCanvas(getOffscreenCanvas()); 7767 result.setOffscreenCanvas(getOffscreenCanvas());
7768 } 7768 }
7769 7769
7770 } // namespace blink 7770 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698