You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (JIRA)" <ji...@apache.org> on 2019/05/16 01:08:00 UTC

[jira] [Comment Edited] (IMAGING-222) JPEG segment size not validated

    [ https://issues.apache.org/jira/browse/IMAGING-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16840894#comment-16840894 ] 

Bruno P. Kinoshita edited comment on IMAGING-222 at 5/16/19 1:07 AM:
---------------------------------------------------------------------

exiftool seems to be able to parse it, raising one warning.
{noformat}
$ exiftool -v -validate NegSegment.jpg
  ExifToolVersion = 10.80
  FileName = NegSegment.jpg
  Directory = .
  FileSize = 22
  FileModifyDate = 1557968340
  FileAccessDate = 1557968364
  FileInodeChangeDate = 1557968343
  FilePermissions = 33204
  FileType = JPEG
  FileTypeExtension = JPG
  MIMEType = image/jpeg
  Warning = JPEG format error
  Validate = 0 1 0
Validate                        : 1 Warning{noformat}
The warning: "JPEG format error".


was (Author: kinow):
exiftool seems to be able to parse it, raising one warning, but still validates it.
{noformat}
$ exiftool -v -validate NegSegment.jpg
  ExifToolVersion = 10.80
  FileName = NegSegment.jpg
  Directory = .
  FileSize = 22
  FileModifyDate = 1557968340
  FileAccessDate = 1557968364
  FileInodeChangeDate = 1557968343
  FilePermissions = 33204
  FileType = JPEG
  FileTypeExtension = JPG
  MIMEType = image/jpeg
  Warning = JPEG format error
  Validate = 0 1 0
Validate                        : 1 Warning{noformat}

> JPEG segment size not validated
> -------------------------------
>
>                 Key: IMAGING-222
>                 URL: https://issues.apache.org/jira/browse/IMAGING-222
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: JPEG
>            Reporter: Le Huu Quang Linh
>            Assignee: Bruno P. Kinoshita
>            Priority: Major
>             Fix For: 1.0-alpha2
>
>         Attachments: NegSegment.jpg
>
>
> Using my AFL-based fuzzer for Java. I found that a NegativeArraySizeException may be throw when attempting to read an invalid JPEG image.
> {code:java}
> public void traverseJFIF(final ByteSource byteSource, final Visitor visitor)
>             throws ImageReadException,
>             IOException {
>         try (InputStream is = byteSource.getInputStream()) {
>             readAndVerifyBytes(is, JpegConstants.SOI,
>                     "Not a Valid JPEG File: doesn't begin with 0xffd8");
> .....
> {code}
> I think you should add the handle NegativeArraySizeException exception



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)