View Issue Details

IDProjectCategoryView StatusLast Update
0033956FPCFCLpublic2018-07-09 13:58
ReporterOndrej PokornyAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033956: fcl-image: TFPCustomImage.LoadFromStream fixes
DescriptionThere are 3 issues in TFPCustomImage.LoadFromStream code:

1.) msg is not initialized
2.) msg is not cleared before break (theoretically it can be assigned to a valid error message in previous loop run).
3.) if d is not assigned, h keeps value from previous loop run - or even worse is unassigned in case of first loop run.
Additional InformationThe attached patch fixed these issues.
TagsNo tags attached.
Fixed in Revision39417
FPCOldBugId
FPCTarget
Attached Files
  • fpimage-TFPCustomImage.LoadFromStream-01.patch (882 bytes)
    Index: packages/fcl-image/src/fpimage.inc
    ===================================================================
    --- packages/fcl-image/src/fpimage.inc	(revision 39414)
    +++ packages/fcl-image/src/fpimage.inc	(working copy)
    @@ -108,6 +108,7 @@
         d : TIHData;
         startPos: Int64;
     begin
    +  msg := '';
       startPos := str.Position;
       with ImageHandlers do
         try
    @@ -116,7 +117,9 @@
             begin
             d := GetData(r);
             if assigned (d) then
    -          h := d.FReader;
    +          h := d.FReader
    +        else
    +          h := nil;
             if assigned (h) then
               begin
               reader := h.Create;
    @@ -127,6 +130,7 @@
                       FStream := str;
                       FImage := self;
                       InternalRead (str, self);
    +                  msg := '';
                       break;
                     except
                       on e : exception do
    

Activities

Ondrej Pokorny

2018-07-08 20:00

developer  

fpimage-TFPCustomImage.LoadFromStream-01.patch (882 bytes)
Index: packages/fcl-image/src/fpimage.inc
===================================================================
--- packages/fcl-image/src/fpimage.inc	(revision 39414)
+++ packages/fcl-image/src/fpimage.inc	(working copy)
@@ -108,6 +108,7 @@
     d : TIHData;
     startPos: Int64;
 begin
+  msg := '';
   startPos := str.Position;
   with ImageHandlers do
     try
@@ -116,7 +117,9 @@
         begin
         d := GetData(r);
         if assigned (d) then
-          h := d.FReader;
+          h := d.FReader
+        else
+          h := nil;
         if assigned (h) then
           begin
           reader := h.Create;
@@ -127,6 +130,7 @@
                   FStream := str;
                   FImage := self;
                   InternalRead (str, self);
+                  msg := '';
                   break;
                 except
                   on e : exception do

Michael Van Canneyt

2018-07-09 13:31

administrator   ~0109312

Applied, thank you very much !

Ondrej Pokorny

2018-07-09 13:58

developer   ~0109313

Thank you!

Issue History

Date Modified Username Field Change
2018-07-08 20:00 Ondrej Pokorny New Issue
2018-07-08 20:00 Ondrej Pokorny File Added: fpimage-TFPCustomImage.LoadFromStream-01.patch
2018-07-08 21:10 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-07-08 21:10 Michael Van Canneyt Status new => assigned
2018-07-09 13:31 Michael Van Canneyt Fixed in Revision => 39417
2018-07-09 13:31 Michael Van Canneyt Note Added: 0109312
2018-07-09 13:31 Michael Van Canneyt Status assigned => resolved
2018-07-09 13:31 Michael Van Canneyt Fixed in Version => 3.1.1
2018-07-09 13:31 Michael Van Canneyt Resolution open => fixed
2018-07-09 13:31 Michael Van Canneyt Target Version => 3.2.0
2018-07-09 13:58 Ondrej Pokorny Note Added: 0109313
2018-07-09 13:58 Ondrej Pokorny Status resolved => closed