Open douglaspkelly opened 1 month ago
Hi, this is basically ported from https://github.com/adafruit/circuitpython/blob/main/shared-module/busdisplay/BusDisplay.c#L235-L254.
In lines 359-360, it's already being set to 1. For lines 362-368, I'm trying to figure what set of values would set it back down to zero and if this is a problem in the main displayio code.
For lines 362-368, I'm trying to figure what set of values would set it back down to zero and if this is a problem in the main displayio code.
Here are values that ultimately result in division by zero:
buffer_size=12
pixels_per_word=8
clipped.width()=102
So, rows_per_buffer = 12 * 8 // 102 = 0 (which is bumped to 1 on the next if
statement.
Later: self._core.colorspace.depth=4 self._core.colorspace.pixels_in_byte_share_row=True So, pixels_per_byte = 8 // 4 = 2
Then: rows_per_buffer (1) % pixels_per_byte (2) = 1 (!=0), so then: rows_per_buffer -= 1 % 2 = 1-1 = 0, resulting in the subrectangles division being by zero.
For a ssd1327 rows_per_buffer is 104/106, which rounds/truncates to zero, causing ZeroDivisionError on line 371 (subrectangles=...).
Tested with a ssd1327 on raspberry pi 4.