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

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

Issue 2046223003: Prevent Null input in texSubImage2D(3D) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change if to switch Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4116 functionType = TexImage; 4116 functionType = TexImage;
4117 else 4117 else
4118 functionType = TexSubImage; 4118 functionType = TexSubImage;
4119 if (!validateTexFunc(funcName, functionType, SourceArrayBufferView, target, level, internalformat, width, height, depth, border, format, type, xoffset, yoff set, zoffset)) 4119 if (!validateTexFunc(funcName, functionType, SourceArrayBufferView, target, level, internalformat, width, height, depth, border, format, type, xoffset, yoff set, zoffset))
4120 return; 4120 return;
4121 TexImageDimension sourceType; 4121 TexImageDimension sourceType;
4122 if (functionID == TexImage2D || functionID == TexSubImage2D) 4122 if (functionID == TexImage2D || functionID == TexSubImage2D)
4123 sourceType = Tex2D; 4123 sourceType = Tex2D;
4124 else 4124 else
4125 sourceType = Tex3D; 4125 sourceType = Tex3D;
4126 if (!validateTexFuncData(funcName, sourceType, level, width, height, depth, format, type, pixels, NullAllowed)) 4126 switch (functionType) {
4127 return; 4127 case TexImage:
4128 if (!validateTexFuncData(funcName, sourceType, level, width, height, dep th, format, type, pixels, NullAllowed))
4129 return;
4130 case TexSubImage:
4131 if (!validateTexFuncData(funcName, sourceType, level, width, height, dep th, format, type, pixels, NullNotAllowed))
4132 return;
Ken Russell (switch to Gerrit) 2016/06/09 05:31:24 As you've seen the bots failed to compile this bec
4133 }
4128 void* data = pixels ? pixels->baseAddress() : 0; 4134 void* data = pixels ? pixels->baseAddress() : 0;
4129 Vector<uint8_t> tempData; 4135 Vector<uint8_t> tempData;
4130 bool changeUnpackAlignment = false; 4136 bool changeUnpackAlignment = false;
4131 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { 4137 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
4132 if (sourceType == Tex2D) { 4138 if (sourceType == Tex2D) {
4133 if (!WebGLImageConversion::extractTextureData(width, height, format, type, m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, tempDat a)) 4139 if (!WebGLImageConversion::extractTextureData(width, height, format, type, m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, tempDat a))
4134 return; 4140 return;
4135 data = tempData.data(); 4141 data = tempData.data();
4136 } 4142 }
4137 changeUnpackAlignment = true; 4143 changeUnpackAlignment = true;
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
6425 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6431 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6426 } 6432 }
6427 6433
6428 void WebGLRenderingContextBase::restoreUnpackParameters() 6434 void WebGLRenderingContextBase::restoreUnpackParameters()
6429 { 6435 {
6430 if (m_unpackAlignment != 1) 6436 if (m_unpackAlignment != 1)
6431 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6437 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6432 } 6438 }
6433 6439
6434 } // namespace blink 6440 } // namespace blink
OLDNEW
« 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