Re: [9fans] pngread: alloc chunk's length

2021-07-14 Thread adr via 9fans
On Wed, 14 Jul 2021, o...@eigenstate.org wrote: Yes, but your patch doesn't apply cleanly to 9front, and it would be useful to check whether I fuck up porting it manually. Ok, but I told you already how to create one. http://adr.freeshell.org/files/turner_ovid_banished_from_rome.png

Re: [9fans] pngread: alloc chunk's length

2021-07-14 Thread ori
Quoth adr via 9fans <9fans@9fans.net>: > On Mon, 12 Jul 2021, o...@eigenstate.org wrote: > > Do you have an example? > > I could upload it in some place but you don't need it, really. The > specification is clear Yes, but your patch doesn't apply cleanly to 9front, and it would be useful to

Re: [9fans] pngread: alloc chunk's length

2021-07-13 Thread adr via 9fans
By the way, the lenght should be checked to not exceed 0x7FFF so a corrupt chunk can be detected early. --- /n/dump/2021/0627/sys/src/cmd/jpg/readpng.c Thu Jan 24 23:39:55 2013 +++ /sys/src/cmd/jpg/readpng.c Tue Jul 13 11:16:50 2021 @@ -10,8 +10,6 @@ enum { - IDATSIZE = 100, -

Re: [9fans] pngread: alloc chunk's length

2021-07-13 Thread adr via 9fans
On Tue, 13 Jul 2021, hiro wrote: you seem to propose that if the png tells us to then we should allocate 2GB per chunk, just bec. the spec allows it even if the spec doesn't tell us a limit, we might want to have a limit. No. The system should constrain the allocation. If you have enough

Re: [9fans] pngread: alloc chunk's length

2021-07-13 Thread hiro
you seem to propose that if the png tells us to then we should allocate 2GB per chunk, just bec. the spec allows it even if the spec doesn't tell us a limit, we might want to have a limit. On 7/13/21, adr via 9fans <9fans@9fans.net> wrote: > On Tue, 13 Jul 2021, hiro wrote: >> are you saying

Re: [9fans] pngread: alloc chunk's length

2021-07-13 Thread adr via 9fans
On Tue, 13 Jul 2021, hiro wrote: are you saying this is a purely synthetic error, it doesn't happen in the wild bec. these sizes are normally more sane? No, no... you got it wrong. You have to follow the specification of the format, unless you want to have surprises like this one. The file

Re: [9fans] pngread: alloc chunk's length

2021-07-13 Thread hiro
are you saying this is a purely synthetic error, it doesn't happen in the wild bec. these sizes are normally more sane? On 7/13/21, adr via 9fans <9fans@9fans.net> wrote: > On Mon, 12 Jul 2021, adr via 9fans wrote: > [...] >> the length of a data chunk must be less than 2^31 - 1 > [...] >> can't

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread adr via 9fans
On Mon, 12 Jul 2021, adr via 9fans wrote: [...] the length of a data chunk must be less than 2^31 - 1 [...] can't be fixed (At least you want to allocate more than 2GB...) [...] Well... to be exact here, it can't be bigger than 2^31 - 1, so there are "almost" 2GB.

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread adr via 9fans
On Mon, 12 Jul 2021, hiro wrote: Date: Mon, 12 Jul 2021 20:04:23 +0200 From: hiro <23h...@gmail.com> Reply-To: 9fans <9fans@9fans.net> To: 9fans <9fans@9fans.net> Subject: Re: [9fans] pngread: alloc chunk's length it's always useful to have the testcase available, for other

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread hiro
it's always useful to have the testcase available, for others and for possible future regressions On 7/12/21, adr via 9fans <9fans@9fans.net> wrote: > On Mon, 12 Jul 2021, o...@eigenstate.org wrote: >> Do you have an example? > > I could upload it in some place but you don't need it, really. The

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread adr via 9fans
On Mon, 12 Jul 2021, o...@eigenstate.org wrote: Do you have an example? I could upload it in some place but you don't need it, really. The specification is clear, the length of a data chunk must be less than 2^31 - 1, and the complete image data is represented by a single zlib datastream that

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread adr via 9fans
On Mon, 12 Jul 2021, o...@eigenstate.org wrote: Why not make getchunk allocate? Somethign like: --- //.git/fs/object/e8259861da3a55c03491904e4d11c5c15b7577c5/tree/sys/src/cmd/jpg/readpng.c +++ sys/src/cmd/jpg/readpng.c @@ -94,7 +94,7 @@ } static int -getchunk(Biobuf *b, char *type, uchar *d,

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread ori
Quoth adr via 9fans <9fans@9fans.net>: > because it couldn't open some png files Do you have an example? -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4a714ed14c50767a-Mfc030872ffba9972709a61bd Delivery options:

Re: [9fans] pngread: alloc chunk's length

2021-07-12 Thread ori
Quoth adr via 9fans <9fans@9fans.net>: > Checking the sent mail I noticed that I forgot to remove mag... Why not make getchunk allocate? Somethign like: --- //.git/fs/object/e8259861da3a55c03491904e4d11c5c15b7577c5/tree/sys/src/cmd/jpg/readpng.c +++ sys/src/cmd/jpg/readpng.c @@ -94,7 +94,7 @@

Re: [9fans] pngread: alloc chunk's length

2021-07-10 Thread adr via 9fans
Checking the sent mail I noticed that I forgot to remove mag... --- sys/src/cmd/jpg/readpng.c Thu Jan 24 23:39:55 2013 +++ /sys/src/cmd/jpg/readpng.c Sat Jul 10 13:09:13 2021 @@ -10,8 +10,6 @@ enum { - IDATSIZE = 100, - /* filtering algorithms */ FilterNone =

[9fans] pngread: alloc chunk's length

2021-07-10 Thread adr via 9fans
Hi, Png is using a fix size to allocate space for the chunks. I noticed it because it couldn't open some png files (the chunk size was bigger than IDATSIZE). This patch removes IDATSIZE and instead makes png to allocate the size of the chunk before reading it. --- sys/src/cmd/jpg/readpng.c