forked from AcademySoftwareFoundation/OpenImageIO
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: broken pgm having memory access error (AcademySoftwareFoundation…
…#4559) Fixes AcademySoftwareFoundation#4552 Caught during fuzzing with address sanitizer. The source of the problem was a corrupted/truncated pgm file. Several minor modifications in this PR shore up various cascading errors that followed. Not all were directly causal to the sanitizer trigger, in some cases I fixed what appeared to be related areas. * In imagebuf.cpp, any time we free the local pixel memory m_pixels, also explicitly clear the m_bufspan that has a span representation of the usable memory and its bounds. * An extra check related to oiiotool --printstats to make sure that the image is valid before passing along to stats collection. * In pnminput.cpp, a better error message when we hit a premature end of file. With these fixes in place, we seem to get a graceful error message and exit when running the POC that was provided with the bug report. Signed-off-by: Larry Gritz <[email protected]>
- Loading branch information
Showing
6 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
P5 | ||
9 1 | ||
255 | ||
� |