Merge pull request #7346 from JosJuice/png-buffer-overflow

Fix critital buffer overflow in LoadPNG
This commit is contained in:
Pierre Bourdon 2018-08-19 17:36:19 +02:00 committed by GitHub
commit 5eca5f69c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -24,11 +24,11 @@ bool LoadPNG(const std::vector<u8>& input, std::vector<u8>* data_out, u32* width
return false;
// Prepare output vector
png.format = PNG_FORMAT_RGBA;
size_t png_size = PNG_IMAGE_SIZE(png);
data_out->resize(png_size);
// Convert to RGBA and write into output vector
png.format = PNG_FORMAT_RGBA;
if (!png_image_finish_read(&png, nullptr, data_out->data(), 0, nullptr))
return false;