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

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: forgot a break line... 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 (functionID) {
4127 return; 4127 case TexImage2D:
4128 case TexImage3D:
4129 if (!validateTexFuncData(funcName, sourceType, level, width, height, dep th, format, type, pixels, NullAllowed))
4130 return;
4131 break;
4132 case TexSubImage2D:
4133 case TexSubImage3D:
4134 if (!validateTexFuncData(funcName, sourceType, level, width, height, dep th, format, type, pixels, NullNotAllowed))
4135 return;
4136 }
4128 void* data = pixels ? pixels->baseAddress() : 0; 4137 void* data = pixels ? pixels->baseAddress() : 0;
4129 Vector<uint8_t> tempData; 4138 Vector<uint8_t> tempData;
4130 bool changeUnpackAlignment = false; 4139 bool changeUnpackAlignment = false;
4131 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { 4140 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
4132 if (sourceType == Tex2D) { 4141 if (sourceType == Tex2D) {
4133 if (!WebGLImageConversion::extractTextureData(width, height, format, type, m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, tempDat a)) 4142 if (!WebGLImageConversion::extractTextureData(width, height, format, type, m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, tempDat a))
4134 return; 4143 return;
4135 data = tempData.data(); 4144 data = tempData.data();
4136 } 4145 }
4137 changeUnpackAlignment = true; 4146 changeUnpackAlignment = true;
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
6425 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6434 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6426 } 6435 }
6427 6436
6428 void WebGLRenderingContextBase::restoreUnpackParameters() 6437 void WebGLRenderingContextBase::restoreUnpackParameters()
6429 { 6438 {
6430 if (m_unpackAlignment != 1) 6439 if (m_unpackAlignment != 1)
6431 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6440 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6432 } 6441 }
6433 6442
6434 } // namespace blink 6443 } // 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