From de72a3ca7347ef9b0a69ccdcca437cc7b23e7b16 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sat, 11 Dec 2010 13:48:18 +0000 Subject: [PATCH] mark GutsRecord as terminating row blocks, prevent exception when reading workbooks with unexpected GutsRecords, see Bugzilla 50426 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1044655 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../apache/poi/hssf/model/RecordOrderer.java | 1 + .../org/apache/poi/hssf/usermodel/TestBugs.java | 5 +++++ test-data/spreadsheet/50426.xls | Bin 0 -> 18915 bytes 4 files changed, 7 insertions(+) create mode 100644 test-data/spreadsheet/50426.xls diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index a5e4670409..fe9ac0bd46 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 50246 - Properly position GutsRecord when reading HSSF workbooks 48539 - Added implementation for MROUND(), VAR() and VARP() 50446 - Code cleanup and optimizations to keep some IDE quiet 50437 - Support passing ranges to NPV() diff --git a/src/java/org/apache/poi/hssf/model/RecordOrderer.java b/src/java/org/apache/poi/hssf/model/RecordOrderer.java index b7d942e5dc..764d5a5110 100644 --- a/src/java/org/apache/poi/hssf/model/RecordOrderer.java +++ b/src/java/org/apache/poi/hssf/model/RecordOrderer.java @@ -417,6 +417,7 @@ final class RecordOrderer { case ObjRecord.sid: case TextObjectRecord.sid: + case GutsRecord.sid: // see Bugzilla 50426 case WindowOneRecord.sid: // should really be part of workbook stream, but some apps seem to put this before WINDOW2 case WindowTwoRecord.sid: diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 288479ac68..cb7cdbd1f6 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -1894,4 +1894,9 @@ if(1==2) { HSSFWorkbook wb = openSample("50020.xls"); writeOutAndReadBack(wb); } + + public void test50426() throws Exception { + HSSFWorkbook wb = openSample("50426.xls"); + writeOutAndReadBack(wb); + } } diff --git a/test-data/spreadsheet/50426.xls b/test-data/spreadsheet/50426.xls new file mode 100644 index 0000000000000000000000000000000000000000..1a807f854c8dc14260f8ff2d3a55fd4a7ea53073 GIT binary patch literal 18915 zcmeI43v^t?dB;ajOO|cPvSj3IJyw!evL#F2)%#&v((Y=t@!z*!t0$DYag-h$_6;3tT)0nX^daE5>1 zcV%G>L8I7*QC?QV9)#4~RkzTAj$&z1TiGbv3&(Gg9e{0w#!(j=hLLmtMpPFIL*6LZ z|G(AEj!kC|V0_Ha&-aviJoP2wM|SK=5D@~TNP8T4@H;y;nVrCRi`l%=PbsW2_Tik1 z4h7$xc3rTe694l$I7D{%FXsB=6_P%ZyXHLhwdb)HoyVSd9y?CB@G>hul8b4$>^2H} z?5r9Obh+&?*`4L@7UjL%Pe7KxSJ{bsPJg|;J)heCzd+AI(eW%XE()Y5N1@z5k7=5SB#Laz~y#aw1 zKX^5x>zUZ$#f>cRV+IR|-3)xsU;=)eK7AU#X4vfP9DDWkcfrS5_Otgsf)G5y=D^NI z&a$&-=h(?Jkca=!H~AwEa6dB3jvYJ3pa3hM1w%Rf2iq)dU@M2ZV7Lw@mdkPO2x@t*gBf8_BPN!!=EGCr z$mn=@V%pU@F)|q$AD$kaocM(8iGLdMaf@Yadw6UNCaS@)gOibX#=3_i`@_=<81qj~ zOhZjDbq$YCjfLS_=D!qnUE5%K+vM>=)vg`BPDq6MHbeQIiAyF*JYJaRV$I0pn3u|x zsjNz%bPbP9myx|39Jh6LLk;-hcePD+c9XpV{I+y-*wt#uTq)gn%PCzYt5;C68u$Kg zRfy7_8ksKRZK;)&DBJ4+RBK0vSCy(nFJ3!MXm6RQ<@G?e&x5Xf9_)nAgKhD7un9g7 zR`z+SXpjDVo*LSt6CbbZrMh0M>-Q*(r_9!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