[Bug 61287] New: HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] New: HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

            Bug ID: 61287
           Summary: HeaderRecord or FooterRecord throws
                    RecordFormatException when the text of length 0
           Product: POI
           Version: 3.16-FINAL
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

in the construtor method of
`org.apache.poi.hssf.record.HeaderFooterBase#HeaderFooterBase(org.apache.poi.hssf.record.RecordInputStream)`,
it will throw RecordFormatException in the method call `in.readByte()` when
variable field_1_footer_len equals to 0

the constrator is as follows:

        protected HeaderFooterBase(RecordInputStream in) {
                if (in.remaining() > 0) {
                        int field_1_footer_len = in.readShort();
                        field_2_hasMultibyte = in.readByte() != 0x00;

                        if (field_2_hasMultibyte) {
                                field_3_text =
in.readUnicodeLEString(field_1_footer_len);
                        } else {
                                field_3_text =
in.readCompressedUnicode(field_1_footer_len);
                        }
                } else {
                        // Note - this is unusual for BIFF records in general,
but normal for header / footer records:
                        // when the text is empty string, the whole record is
empty (just the 4 byte BIFF header)
                        field_3_text = "";
                }
        }

and the exception stack is as follows:

org.apache.poi.hssf.record.RecordFormatException: Not enough data (0) to read
requested (1) bytes
        at
org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:237)
        at
org.apache.poi.hssf.record.RecordInputStream.readByte(RecordInputStream.java:246)
        at
org.apache.poi.hssf.record.HeaderFooterBase.<init>(HeaderFooterBase.java:39)
        at org.apache.poi.hssf.record.HeaderRecord.<init>(HeaderRecord.java:36)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:84)
        at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:345)
        at
org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:288)
        at
org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:254)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:494)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:348)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:405)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:386)

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

--- Comment #1 from lejingw <[hidden email]> ---
Created attachment 35125
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35125&action=edit
the excel to be read with exception

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

--- Comment #2 from Tim Allison <[hidden email]> ---
Thank you for opening this issue and sharing a triggering document.  I'm not
able to reproduce this with trunk.  Are you using 3.17-beta1 or an earlier
version of POI?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

Tim Allison <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #3 from Tim Allison <[hidden email]> ---
(In reply to Tim Allison from comment #2)
> Thank you for opening this issue and sharing a triggering document.  I'm not
> able to reproduce this with trunk.  Are you using 3.17-beta1 or an earlier
> version of POI?

Doh.  Right, you selected 3.16-final above.  This looks to be fixed now.
Please reopen if you are having problems with 3.17-beta1.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

lejingw <[hidden email]> changed:

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

--- Comment #4 from lejingw <[hidden email]> ---
Created attachment 35136
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35136&action=edit
pach file to be validated

i have updated the attachment, the exception still exists in 3.17-beta1.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

lejingw <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |---
             Status|RESOLVED                    |REOPENED

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

--- Comment #5 from lejingw <[hidden email]> ---
Created attachment 35137
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35137&action=edit
the excel to be read with exception

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61287] HeaderRecord or FooterRecord throws RecordFormatException when the text of length 0

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61287

Tim Allison <[hidden email]> changed:

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

--- Comment #6 from Tim Allison <[hidden email]> ---
Thank you for reporting this, diagnosing the problem and sharing triggering
files!

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...