View Issue Details

IDProjectCategoryView StatusLast Update
0033493FPCPackagespublic2018-06-27 20:08
ReporterFiliuta VitaliAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.4Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033493: fix-patch for 0026827-bug for packages\paszlib\src\infcodes.pas, fixes "out of range" on decompressing
DescriptionAfter migrating from 2.7.1 to 3.0.5 frepascal, got an error Z_DATA_ERROR (if release) or "out of range" (if dedug) while decompressing streams via zlibpas. Found, that cause of it is the patch, applied in 0026827 issue, without it everything works just fine.

I have fixed error, and prepared patch. Now both: my test code, and troublemaker code from 0026827 works fine.

Also that fix must resolve 0031219 and, maybe 0032773 issues.
TagsNo tags attached.
Fixed in Revision38657
FPCOldBugId
FPCTarget
Attached Files
  • inflate_codes.diff (676 bytes)
    Index: infcodes.pas
    ===================================================================
    --- infcodes.pas	(revision 38588)
    +++ infcodes.pas	(working copy)
    @@ -155,8 +155,13 @@
               if s.last then
               begin
                 t := c^.sub.code.tree;
    -            if t^.exop and 32 <> 0 then
    -              break;
    +            { update t (like as in following code), and check, if requested
    +              bits are available }
    +            Inc(t, cardinal(b) and inflate_mask[j]);
    +            if k >= t^.bits then
    +            { now, we can examine t^.exop value }
    +              if t^.exop and 32 <> 0 then
    +                break;
               end;
     
               exit;
    
    inflate_codes.diff (676 bytes)

Relationships

related to 0026827 resolvedMichael Van Canneyt Buffer error in TDecompressionStream when decompressing some data without deflate header 
related to 0031219 resolvedMichael Van Canneyt paszlib, unable to extract with "out of range" error 
related to 0032773 resolvedMichael Van Canneyt paszlib inflate of file gives crc error 
related to 0033911 new paszlib error 

Activities

Filiuta Vitali

2018-03-23 21:23

reporter  

inflate_codes.diff (676 bytes)
Index: infcodes.pas
===================================================================
--- infcodes.pas	(revision 38588)
+++ infcodes.pas	(working copy)
@@ -155,8 +155,13 @@
           if s.last then
           begin
             t := c^.sub.code.tree;
-            if t^.exop and 32 <> 0 then
-              break;
+            { update t (like as in following code), and check, if requested
+              bits are available }
+            Inc(t, cardinal(b) and inflate_mask[j]);
+            if k >= t^.bits then
+            { now, we can examine t^.exop value }
+              if t^.exop and 32 <> 0 then
+                break;
           end;
 
           exit;
inflate_codes.diff (676 bytes)

Michael Van Canneyt

2018-04-01 09:31

administrator   ~0107496

Applied, checked that it fixes other 2 testcases as well, and it seems all to work. Thanks for the patch.

Issue History

Date Modified Username Field Change
2018-03-23 21:23 Filiuta Vitali New Issue
2018-03-23 21:23 Filiuta Vitali File Added: inflate_codes.diff
2018-03-23 22:09 Michael Van Canneyt Relationship added related to 0026827
2018-03-23 22:09 Michael Van Canneyt Relationship added related to 0031219
2018-03-23 22:09 Michael Van Canneyt Relationship added related to 0032773
2018-03-23 22:10 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-03-23 22:10 Michael Van Canneyt Status new => assigned
2018-04-01 09:31 Michael Van Canneyt Fixed in Revision => 38657
2018-04-01 09:31 Michael Van Canneyt Note Added: 0107496
2018-04-01 09:31 Michael Van Canneyt Status assigned => resolved
2018-04-01 09:31 Michael Van Canneyt Fixed in Version => 3.1.1
2018-04-01 09:31 Michael Van Canneyt Resolution open => fixed
2018-04-01 09:31 Michael Van Canneyt Target Version => 3.2.0
2018-04-07 21:03 Filiuta Vitali Status resolved => closed
2018-06-27 20:08 Florian Relationship added related to 0033911