breakintoprogram / pico-mposite

A hacked together demo for the Raspberry Pi Pico to output a composite video signal from the GPIO
MIT License
104 stars 10 forks source link

Bounds checking in draw_horizontal_line #7

Open sharpie7 opened 2 years ago

sharpie7 commented 2 years ago

draw_horizontal_line doesn't check its bounds correctly and can stamp over memory outside the bitmap.

The vertical position isn't checked before attempting to draw the line.

The horizontal position is clipped to max of width and should be clipped to width-1.

breakintoprogram commented 3 days ago

@sharpie7 it was a quick demo knocked up in an afternoon to test the capabilities. I'll be adding some more graphics primitives in due course and will fix the clipping whilst I'm at it.