[Cuis-dev] BMP Reader broken

lewis at mail.msen.com lewis at mail.msen.com
Mon Mar 18 08:35:36 PDT 2024


  Hi Juan,

On 2024-03-17 18:17, Juan Vuletich via Cuis-dev wrote:

> Hi Dave,
> 
> On 3/16/2024 6:22 PM, lewis--- via Cuis-dev wrote:As I said in a 
> separate email, Vanessa found the origin of the problem, and the fix is 
> now at GitHub.
> 
> Still, as you say, the primitive fails, both in Cuis and Squeak, but 
> only the first time it is called. The lines are read in reverse order, 
> so the line that is first copied is actually the last one.
> 
> In #read24BmpLine:into:startingAt:width:, at the start of the fallback 
> code, I added this line: `{formBitsIndex+width. formBits size} print.`. 
> Then tried to load Hilaire's BMP. In the Transcript I got #(63601 
> 63600). So, in BMPReadWriterPlugin.c, the lines that read:
> 
> if (!(((formBitsIndex + width) <= formBitsSize)
> && ((width * 3) <= pixelLineSize))) {
> return primitiveFail();
> 
> should actually read
> 
> if (!(((formBitsIndex + width - 1) <= formBitsSize)
> && ((width * 3) <= pixelLineSize))) {
> return primitiveFail();
> 
> and the primitive will not fail.
> 
> It is a minor bug, with no practical consequences, so this is not 
> really important. But I found this while investigating the BMP read 
> failure, and I thought it was worth commenting.
> 
> Thanks,

The expression appears in both 
BMPReadWriterPlugin>>primitiveRead24BmpLine and 
BMPReadWriterPlugin>>primitiveWrite24BmpLine. Can you please confirm my 
assumption that the same fix should be applied to both methods? Sorry if 
this is obvious but I just want to be sure.

Thanks!

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240318/71b86c55/attachment.htm>


More information about the Cuis-dev mailing list