Skip to content

Commit 57e6f6e

Browse files
committed
Changed in review.
1 parent 9464907 commit 57e6f6e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Source/Plugins/PluginHDR.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,14 +630,15 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
630630
if (!rgbe_ReadHeader(io, handle, &width, &height, &header_info)) {
631631
return nullptr;
632632
}
633+
if (width > 65500 || height > 65500) {
634+
throw FI_MSG_ERROR_DIB_MEMORY;
635+
}
633636

634637
// allocate a RGBF image
635638
std::unique_ptr<FIBITMAP, decltype(&FreeImage_Unload)> dib(FreeImage_AllocateHeaderT(header_only, FIT_RGBF, width, height), &FreeImage_Unload);
636639
if (!dib) {
637640
throw FI_MSG_ERROR_MEMORY;
638641
}
639-
width = FreeImage_GetWidth(dib.get());
640-
height = FreeImage_GetHeight(dib.get());
641642

642643
// set the metadata as comments
643644
rgbe_ReadMetadata(dib.get(), &header_info);

0 commit comments

Comments
 (0)