1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-08 23:24:19 +00:00

MemoryOutputStream: Avoid integer overflow which may result in incorrect size after expansion

This commit is contained in:
reuk 2025-11-25 11:34:35 +00:00
parent 65e9bf1c52
commit 540830506b
No known key found for this signature in database

View file

@ -93,7 +93,7 @@ char* MemoryOutputStream::prepareToWrite (size_t numBytes)
if (blockToUse != nullptr)
{
if (storageNeeded >= blockToUse->getSize())
blockToUse->ensureSize ((storageNeeded + jmin (storageNeeded / 2, (size_t) (1024 * 1024)) + 32) & ~31u);
blockToUse->ensureSize ((storageNeeded + jmin (storageNeeded / 2, (size_t) (1024 * 1024)) + 32) & ~(size_t) 31);
data = static_cast<char*> (blockToUse->getData());
}