9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] jpg bugfix
@ 2009-09-15  1:49 erik quanstrom
  2009-09-15  2:55 ` cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: erik quanstrom @ 2009-09-15  1:49 UTC (permalink / raw)
  To: 9fans

this fixes a bug triggered by steve's bug report.

; diffy -c readjpg.c
/n/dump/2009/0914/sys/src/cmd/jpg/readjpg.c:441,453 - readjpg.c:441,452
  	uchar tmp[2];

  	m = marker(h);
- 	switch(m){
- 	case EOI:
+ 	if(m == EOI || (m&~7) == RST){
  		*markerp = m;
  		return 0;
- 	case 0:
- 		jpgerror(h, "ReadJPG: expecting marker; saw %.2x at offset %lld", m, Boffset(h->fd));
  	}
+ 	if(m == 0)
+ 		jpgerror(h, "ReadJPG: expecting marker; saw %.2x at offset %lld", m, Boffset(h->fd));
  	if(Bread(h->fd, tmp, 2) != 2)
      Readerr:
  		jpgerror(h, readerr);

- erik



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] jpg bugfix
  2009-09-15  1:49 [9fans] jpg bugfix erik quanstrom
@ 2009-09-15  2:55 ` cinap_lenrek
  0 siblings, 0 replies; 2+ messages in thread
From: cinap_lenrek @ 2009-09-15  2:55 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 17 bytes --]

:)

--
cinap

[-- Attachment #2: Type: message/rfc822, Size: 2436 bytes --]

From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] jpg bugfix
Date: Mon, 14 Sep 2009 21:49:03 -0400
Message-ID: <6a794eca8e2b9a252883671a05ed6344@quanstro.net>

this fixes a bug triggered by steve's bug report.

; diffy -c readjpg.c
/n/dump/2009/0914/sys/src/cmd/jpg/readjpg.c:441,453 - readjpg.c:441,452
  	uchar tmp[2];

  	m = marker(h);
- 	switch(m){
- 	case EOI:
+ 	if(m == EOI || (m&~7) == RST){
  		*markerp = m;
  		return 0;
- 	case 0:
- 		jpgerror(h, "ReadJPG: expecting marker; saw %.2x at offset %lld", m, Boffset(h->fd));
  	}
+ 	if(m == 0)
+ 		jpgerror(h, "ReadJPG: expecting marker; saw %.2x at offset %lld", m, Boffset(h->fd));
  	if(Bread(h->fd, tmp, 2) != 2)
      Readerr:
  		jpgerror(h, readerr);

- erik

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-15  2:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15  1:49 [9fans] jpg bugfix erik quanstrom
2009-09-15  2:55 ` cinap_lenrek

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).