After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 604000 - SGI: sanitize input
SGI: sanitize input
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other Linux
: Normal normal
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2009-12-07 16:46 UTC by Nils Philippsen
Modified: 2009-12-09 16:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix: sanitize input data (1.09 KB, patch)
2009-12-07 16:48 UTC, Nils Philippsen
none Details | Review
Proposed fix: sanitize input data (amended) (1.19 KB, patch)
2009-12-09 14:47 UTC, Nils Philippsen
committed Details | Review
SGI image file exhibiting the RLE decoding error (84.07 KB, application/octet-stream)
2009-12-09 15:03 UTC, Nils Philippsen
  Details
Proposed fix: ensure that RLE decoding doesn't access memory beyond allocated buffers (amended) (910 bytes, patch)
2009-12-09 15:13 UTC, Nils Philippsen
none Details | Review

Description Nils Philippsen 2009-12-07 16:46:22 UTC
The SGI plugin doesn't sanitize the xsize, ysize and zsize header fields (basically width, height and color depth). It is possible to use zero in one of these and this value will be used later on without further checks. While this may not be a security issue (it doesn't seem to crash the plugin), it should be fixed so that the user knows that something is wrong with the file instead of getting this error message:

Calling error for procedure 'gimp-image-new':
Procedure 'gimp-image-new' has been called with value '0' for argument 'height' (#2, type GimpInt32). This value is out of range.
Comment 1 Nils Philippsen 2009-12-07 16:48:56 UTC
Created attachment 149272 [details] [review]
Proposed fix: sanitize input data
Comment 2 Simon Budig 2009-12-09 14:38:49 UTC
This also needs to check for GIMP_MAX_IMAGE_SIZE. Please amend the patch accordingly.
Comment 3 Nils Philippsen 2009-12-09 14:47:34 UTC
Created attachment 149434 [details] [review]
Proposed fix: sanitize input data (amended)
Comment 4 Nils Philippsen 2009-12-09 15:03:14 UTC
Created attachment 149435 [details]
SGI image file exhibiting the RLE decoding error
Comment 5 Nils Philippsen 2009-12-09 15:13:49 UTC
Created attachment 149437 [details] [review]
Proposed fix: ensure that RLE decoding doesn't access memory beyond allocated buffers (amended)

Rework the fix above using "count = MIN (ch & 127, xsize);" instead, as proposed by Simon.
Comment 6 Nils Philippsen 2009-12-09 15:55:00 UTC
Comment on attachment 149435 [details]
SGI image file exhibiting the RLE decoding error

wrong bug
Comment 7 Nils Philippsen 2009-12-09 15:55:11 UTC
Comment on attachment 149437 [details] [review]
Proposed fix: ensure that RLE decoding doesn't access memory beyond allocated buffers (amended)

wrong bug
Comment 8 Nils Philippsen 2009-12-09 15:55:51 UTC
Comment on attachment 149434 [details] [review]
Proposed fix: sanitize input data (amended)

un-obsolete this patch
Comment 9 Simon Budig 2009-12-09 16:00:10 UTC
Review of attachment 149434 [details] [review]:

looks good, please commit.
Comment 10 Nils Philippsen 2009-12-09 16:19:45 UTC
Review of attachment 149434 [details] [review]:

committed:
daaf1d2 SGI: sanitize input data