You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/09/28 01:48:05 UTC

DO NOT REPLY [Bug 51902] New: [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

             Bug #: 51902
           Summary: [PATCH] Picture.fillRawImageContent -
                    ArrayIndexOutOfBoundsException
           Product: POI
           Version: 3.8-dev
          Platform: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: HWPF
        AssignedTo: dev@poi.apache.org
        ReportedBy: hockey69guy@yahoo.com
    Classification: Unclassified


Created attachment 27617
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27617
Patch for issue

Found a handful of Word files that cause ArrayIndexOOB. (Unable to attach
sample due to sensitive nature of files).

Patch included, essentially the pictureBytesStartOffset used for a
System.arraycopy() is sometimes set to a negative value.

Fix uses an existing less-than check but also makes sure it's greater than zero
before using the new value rather than the default PICTF1BlockOffset.

Stack Trace: (POI-3.8-beta4)

Caused by: java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at
org.apache.poi.hwpf.usermodel.Picture.fillRawImageContent(Picture.java:363)
    at org.apache.poi.hwpf.usermodel.Picture.getRawContent(Picture.java:203)
    at org.apache.poi.hwpf.usermodel.Picture.fillImageContent(Picture.java:372)
    at org.apache.poi.hwpf.usermodel.Picture.getContent(Picture.java:191)
    at
org.apache.poi.hwpf.usermodel.Picture.suggestPictureType(Picture.java:330)
    at
org.apache.poi.hwpf.usermodel.Picture.suggestFileExtension(Picture.java:315)
    at
org.apache.poi.hwpf.usermodel.Picture.suggestFullFileName(Picture.java:150)
    at
org.apache.tika.parser.microsoft.WordExtractor$PicturesSource.<init>(WordExtractor.java:504)
    at
org.apache.tika.parser.microsoft.WordExtractor$PicturesSource.<init>(WordExtractor.java:488)
    at
org.apache.tika.parser.microsoft.WordExtractor.parse(WordExtractor.java:81)
    at
org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:196)
    at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
    ... 45 more

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

Sergey Vladimirov <vl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pablo.queixalos@polyspot.co
                   |                            |m

--- Comment #3 from Sergey Vladimirov <vl...@gmail.com> 2011-09-30 13:26:26 UTC ---
*** Bug 51890 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

--- Comment #5 from pqueixalos <pa...@polyspot.com> 2011-09-30 16:04:05 UTC ---
Works like a charm.

(In reply to comment #4)
> Image loading is completely rewritten. Please, check r1177710 or later.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

Sergey Vladimirov <vl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

Jeremy <ho...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27617|0                           |1
        is obsolete|                            |

--- Comment #1 from Jeremy <ho...@yahoo.com> 2011-09-28 01:53:51 UTC ---
Created attachment 27619
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27619
Replaces initial patch.. improved

Changes to greater-than or equal to 0

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

Jeremy <rp...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |51974

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

--- Comment #7 from Jeremy <rp...@yahoo.com> 2011-10-12 13:00:50 UTC ---
Sergey,

Thanks for this re-work of the Picture handling logic for MS Word documents. 
This seems to have fixed many of the random bugs that would pop-up across a
large and varying data-set.  I did however uncover one bug that was introduced
by these fixes, and have supplied a patch.  When you get a chance, could you
please take a look at Bug 51974.
(https://issues.apache.org/bugzilla/show_bug.cgi?id=51974)

It's essentially a null pointer exception that is encountered when parsing text
via TIKA that was not present prior.


Thanks in advance,

Jeremy



(In reply to comment #4)
> Image loading is completely rewritten. Please, check r1177710 or later.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

Sergey Vladimirov <vl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
         OS/Version|                            |All

--- Comment #2 from Sergey Vladimirov <vl...@gmail.com> 2011-09-30 13:24:51 UTC ---
Please, provide example doc. It is possible we will be able to handle image
correctly. You can send it to my email privately.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

--- Comment #6 from Jeremy <ho...@yahoo.com> 2011-10-03 19:24:38 UTC ---
Agree, definitly works for the files I was having an issue with prior.  Thanks
very much for your attention to this matter.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 51902] [PATCH] Picture.fillRawImageContent - ArrayIndexOutOfBoundsException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51902

--- Comment #4 from Sergey Vladimirov <vl...@gmail.com> 2011-09-30 15:50:23 UTC ---
Image loading is completely rewritten. Please, check r1177710 or later.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org