Recent

Author Topic: Problem to load PNG Image from file  (Read 11985 times)

dsiders

  • Hero Member
  • *****
  • Posts: 1084
Re: Problem to load PNG Image from file
« Reply #15 on: January 04, 2019, 07:51:39 pm »
The "mostly" applied to the "free" part (but now I think about it also to the "open") and applies because the license is not a vanilla free/open source one and contains some ad-hoc restrictions, like p.e.
Quote
2. Modified files may not be distributed. [...]
4. Commercial visual graphics libraries are not allowed to use this component WITHOUT AUTHOR PRIOR AGREEMENT.
5. Credit for the author is required somewhere [...]
6. Source code may be changed if it's not redistributed.

"Free/Open Source" is about more than just letting other see the source.

Well #2 is restrictive only if Mr. Daud refuses to maintain his code.

Otherwise, I have no issues with it. Not using a "vanilla" license does not make it any less free or any less open source. License purists can take over from here.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: Problem to load PNG Image from file
« Reply #16 on: January 05, 2019, 08:19:32 am »
It's not from Embarcadero; it's Gustavo Daud's (mostly free/open) source code

What's not open source about it? According to the source:

Code: [Select]
{This is a full, open sourced implementation of png in Delphi }

The "mostly" applied to the "free" part (but now I think about it also to the "open") and applies because the license is not a vanilla free/open source one and contains some ad-hoc restrictions, like p.e.
Quote
2. Modified files may not be distributed. [...]
4. Commercial visual graphics libraries are not allowed to use this component WITHOUT AUTHOR PRIOR AGREEMENT.
5. Credit for the author is required somewhere [...]
6. Source code may be changed if it's not redistributed.

"Free/Open Source" is about more than just letting other see the source.
the original component, which the embarcadero (sorry I do not remember their new name) bought, was an open source component that had only one restriction, you were not allowed to share copies of the code with out permission from the author. Since there were no copies shared only a few lines of code to make a point this, falls under fair use and no license is violated.

Lets not  spin things out of proportion here. If there is any doubt contact the author or embarcadero to get the only definitive answer.


wp

  • Hero Member
  • *****
  • Posts: 11922
Re: Problem to load PNG Image from file
« Reply #17 on: January 05, 2019, 12:08:20 pm »
I solved my problem.
How?

And I decided to look deeper.

Original image is base64 encoded string, like this:
Code: Pascal  [Select][+][-]
  1. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAABGdBTUEAAYagMeiWXwAAADRJREFUeJztwQENAAAAwqD3T20ON6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH4MdZQAAahQ8jkAAAAASUVORK5C/4I=

I don't understand what you want to say...

In the meantime, I investigated myself. There is a program PNGAnalyzer (http://wolfgangfellger.de/de/product,4) which also reports the CRC issue and is able to fix it - afterwards the file is readable by standard Lazarus code.

I temporarily bypassed the crc check in the fpc png reader (fpreadpng.pp), and this made the original file being readable immediately.

So, should fpreadpng be extended to bypass the crc check? (I think now that it is this what you wanted to say (in an non-understandable way) by citing Delphi code). I don't think we should. The crc check is the sanity check of the file. If it fails there is some chance that it has been modified for example to inject buffer overflow etc. I uploaded the file to VirusTotal, it seems to be clean. But it could have been an attack. In my opinion, all the programs which had opened the file without any notice have a security risk regarding manipulated png files.
« Last Edit: January 05, 2019, 12:28:08 pm by wp »

wyfinger

  • Newbie
  • Posts: 5
Re: Problem to load PNG Image from file
« Reply #18 on: January 05, 2019, 01:00:35 pm »
Yes, I suggested adding the conditional compilation directive {$DEFINE CheckCRC} so that you can easily disable CRC checking.
It is strange that, according to the specification, it is required to check the CRC of the blocks, but in fact a large number of applications do not.

 

TinyPortal © 2005-2018