quibble icon indicating copy to clipboard operation
quibble copied to clipboard

Fix framebuffer overflow when drawing timer rect

Open Simi4 opened this issue 3 years ago • 3 comments

Simi4 avatar Aug 08 '22 16:08 Simi4

Is there an actual bug you're fixing here? The only way I could see this triggering is if you chose a ludicrously large font size.

maharmstone avatar Aug 08 '22 21:08 maharmstone

Is there an actual bug you're fixing here? The only way I could see this triggering is if you chose a ludicrously large font size.

Yes. I didn't change the font size - it still depends on the dpi. Out-of-range access occurs when the resolution is 2048x2048 (which is the max mode in Simics) in this code:

                    p.y = gop_info.VerticalResolution - (font_height * 3 / 4);
                    draw_rect(p.x, p.y - font_height, font_height * 5, font_height * 2, 0x000000);

font_height == 23 p.y == 2031 p.y - font_height == 2008 font_height * 2 == 46

2008 + 46 > 2048

I think the rect height there can be changed to (font_height * 7 / 4) I'll update PR

Simi4 avatar Aug 09 '22 06:08 Simi4

I don't see why it shouldn't be merged.

linux-leo avatar Aug 12 '22 18:08 linux-leo

Thanks for this, you're right. I've fixed it with https://github.com/maharmstone/quibble/commit/f98986d884bd825572111f58e905d2e1bb1b7ba0.

Rather than working out what the height of the rectangle should be, the easiest way was just to draw it to the bottom of the screen.

maharmstone avatar Sep 11 '22 22:09 maharmstone