"TFPCustomImage.LoadFromStream" throws exception "Invalid chunklength" when compiled with FPC v3.0.2
Original Reporter info from Mantis: Valdas
-
Reporter name: Valdas Jankūnas
Original Reporter info from Mantis: Valdas
- Reporter name: Valdas Jankūnas
Description:
I'm using code (LCL)(see attached minimal project):
stream := TLazarusResourceStream.Create('image_for_resource', nil);
image := TLazIntfImage.Create(0,0);
image.LoadFromStream(stream);
It works without problems with FPC v3.0.0 and earlier versions. After I updated it to v3.0.2 I always getting an Exception on line "LoadFromStream":
TApplication.HandleException Error while reading stream: Invalid chunklength
Stack trace:
$00000000004C6BDE
$00000000004C76A9
$000000000060BFB2 line 2851 of include/control.inc
$0000000000639F2A line 55 of include/buttoncontrol.inc
$000000000063A773 line 169 of include/buttons.inc
$0000000000639E16 line 21 of include/buttoncontrol.inc
$0000000000435B7F
$00000000005FD77D line 5404 of include/wincontrol.inc
$00000000006777AB line 5728 of qtwidgets.pas
$0000000000678739 line 6101 of qtwidgets.pas
$00007F00C7430F70
$00007F00C8343632
Same exception I got when using code (wrote quick FCL-only test case)(see attached minimal project):
fs := TFileStream.Create ('image_for_resource.png', fmOpenRead);
image := TFPMemoryImage.Create(10, 10);
image.LoadFromStream(fs);
This code works without problems when it is compiled with FPC v3.0.0.
Steps to reproduce:
Compile project, run application and press Button1 or Button2.
Additional information:
Related LCL bug #0032005
Mantis conversion info:
- Mantis ID: 32013
- OS: Kubuntu 17.04
- Platform: Linux 64bit
- Version: 3.0.2
- Monitored by: » Valdas (Valdas Jankūnas)