Off-by-one in $obj->asGif after upgrading to ACEDB_4.9s

Morten Hulden morten at ngb.se
Wed Sep 10 05:21:27 EST 2003


On Tue, 9 Sep 2003, Ed Griffiths wrote:

> > After upgrading to ACEDB_4.9s, sgifserver seems to provide gif-images
> > where the first byte is NULL and the last byte is dropped.
> > 
> > AcePerl now outputs faulty gifs with the obj->asGif method (Object.pm). As
> > AcePerl has not changed, and giface client produces good gifs I assume
> > something changed in sgifserver. Anyone else seen this?
> > 
> > I also tested 4.9u with same results.
> > Compiled with gcc 3.2.2 on Linux RH9, -O2/-03 optimation.
> 
> I have looked into this and its been caused by a change to a low level routine
> in acedb changing which resulted in a null byte being inserted in front of the
> GIF image in the datastream. I think you see the last byte dropped because the
> aceperl code is now one byte out.
> 
> I am checking with Lincoln what we should do about this, the null byte in the
> datastream makes some sense in fact so the answer may be to change the aceperl
> code to handle it.

In that case, as already posted on this list, following patch to 
Ace::Object.pm will do the job:

Object.pm line 1764, Aceperl 1.86:
- return unless ($bytes, $trim) = $data=~m!^// (\d+) bytes\n(.+)!sm;
+ return unless ($bytes, $trim) = $data=~m!^// (\d+) bytes\n\x0?(.+)!sm;

Not necessary strictly correct place to strip the extra NULL-byte here,
just before output, but it works and I can now use versions of AceDB >=
4.9_s.

(Because of Perl autosplit, the patch should be made in the AcePerl 
source tree, which should then be reinstalled.)

rgds
Morten







More information about the Acedb mailing list