From: Erik Quanstrom <quanstro@quanstro.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] bug in topng(1)
Date: Mon, 24 Dec 2012 09:07:48 -0500 [thread overview]
Message-ID: <76qln1m5a49sd2bbsf19xumb.1356358068256@email.android.com> (raw)
yaroslav <yarikos@gmail.com> wrote:
>There's a bug in topng(1) which under certain circumstances may result in
>broken output image. When such an image then is fed to png(1)
>diagnostics like the following are produced:
>
> term% png /tmp/1.png
> png: unknown filtering scheme 49
>
>(The filtering scheme number may differ.)
>
>This happens when at the beginning of an input line (z->x == 0) there
>are only room for exactly one pixel in output buffer (b+pixwids == e),
>at /sys/src/cmd/jpg/writepng.c:/^zread/+/while/.
>
>Since every scan line should start with a filter algorithm ID it
>consumes a byte in the buffer, leaving no room for the pixel. The
>"pixels" variable turns zero, no pixels are emitted, yet the alg byte
>slips out. During next run of zread() with empty buffer, the alg byte
>is emitted again, causing permanent skew of output bytes.
>
>The proposed fix is to modify the loop condition so the loop won't
>proceed if there are not enough room for at least one pixel plus a
>byte for the filter alg ID.
>
>Submitted /n/sources/patch/topng-extrabyte/.
>
>- yk
>
>
>
next reply other threads:[~2012-12-24 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-24 14:07 Erik Quanstrom [this message]
2012-12-24 17:45 ` cinap_lenrek
2012-12-24 20:01 ` erik quanstrom
2012-12-25 1:49 ` cinap_lenrek
2012-12-25 13:39 ` erik quanstrom
-- strict thread matches above, loose matches on Subject: below --
2012-12-24 12:27 yaroslav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=76qln1m5a49sd2bbsf19xumb.1356358068256@email.android.com \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).