WebGL: Improve index validation when using uint index values
<rdar://problem/31083056>
Created attachment 304725 [details] Patch
Comment on attachment 304725 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=304725&action=review > Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1758 > + maxIndex = std::max(maxIndex.value(), static_cast<unsigned>(p[i])); Won't maxIndex.value() assert the first time you use it because the optional is still nullopt?
Created attachment 304728 [details] Patch
Comment on attachment 304728 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=304728&action=review > Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1782 > + if (maxIndex) { You could early return here: if (!maxIndex) return false; > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:757 > + std::optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type); Why am I seeing all this code twice?
Committed r214086: <http://trac.webkit.org/changeset/214086>
Comment on attachment 304728 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=304728&action=review >> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1782 >> + if (maxIndex) { > > You could early return here: if (!maxIndex) return false; done. >> Source/WebCore/html/canvas/WebGLRenderingContext.cpp:757 >> + std::optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type); > > Why am I seeing all this code twice? Blame myles :) I think we could share most of it.