Commit 5b7d40b3 by Jamie Madill Committed by Commit Bot

translator: Avoid divide-by-zero in error case.

In some code path found by a fuzzer, we would have a zero sized array, which would trigger a zero divide. I was unable to extract the failing shader from the fuzzer case trivially. BUG=chromium:653274 Change-Id: Ia2558ae828fa73615c901fd1cda9ddaa3a72f1a9 Reviewed-on: https://chromium-review.googlesource.com/394238Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 26a717b0
...@@ -327,6 +327,9 @@ size_t TType::getObjectSize() const ...@@ -327,6 +327,9 @@ size_t TType::getObjectSize() const
if (isArray()) if (isArray())
{ {
if (totalSize == 0)
return 0;
size_t currentArraySize = getArraySize(); size_t currentArraySize = getArraySize();
if (currentArraySize > INT_MAX / totalSize) if (currentArraySize > INT_MAX / totalSize)
totalSize = INT_MAX; totalSize = INT_MAX;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment