circuitpython/shared-module
Jeff Epler d7c3f811af sharpdisplay: Fix memory corruption across soft-reset
It was incorrect to NULL out the pointer to our heap allocated buffer in
`reset`, because subsequent to framebuffer_reset, but while
the heap was still active, we could call `get_bufinfo` again,
leading to a fresh allocation on the heap that is about to be destroyed.

Typical stack trace:
```
#1  0x0006c368 in sharpdisplay_framebuffer_get_bufinfo
#2  0x0006ad6e in _refresh_display
#3  0x0006b168 in framebufferio_framebufferdisplay_background
#4  0x00069d22 in displayio_background
#5  0x00045496 in supervisor_background_tasks
#6  0x000446e8 in background_callback_run_all
#7  0x00045546 in supervisor_run_background_tasks_if_tick
#8  0x0005b042 in common_hal_neopixel_write
#9  0x00044c4c in clear_temp_status
#10 0x000497de in spi_flash_flush_keep_cache
#11 0x00049a66 in supervisor_external_flash_flush
#12 0x00044b22 in supervisor_flash_flush
#13 0x0004490e in filesystem_flush
#14 0x00043e18 in cleanup_after_vm
#15 0x0004414c in run_repl
#16 0x000441ce in main
```
When this happened -- which was inconsistent -- the display would keep
some heap allocation across reset which is exactly what we need to avoid.

NULLing the pointer in reconstruct follows what RGBMatrix does, and that
code is a bit more battle-tested anyway.

If I had a motivation for structuring the SharpMemory code differently,
I can no longer recall it.

Testing performed: Ran my complicated calculator program over multiple
iterations without observing signs of heap corruption.

Closes: #3473
2020-10-01 09:22:09 -05:00
..
_bleio discovery of Nordic UART service working 2020-08-08 00:29:37 -04:00
_eve Fix up end of file and trailing whitespace. 2020-06-03 10:56:35 +01:00
_pixelbuf use the stack 2020-08-10 18:42:05 -04:00
_stage modified _stage/__init__.c call to set region to update 2020-09-28 19:10:47 -04:00
aesio aesio: add basic AES encryption and decryption 2020-05-06 17:40:06 +08:00
audiocore audiocore: The arguments to reset_buffer went missing 2019-12-13 18:31:12 -06:00
audioio bring MixerVoice back to building state; update documentation 2019-08-03 11:20:06 -05:00
audiomixer audiomixer: Fix garbled playback when voice 0 is stopped, audio pops 2020-06-01 19:14:38 -05:00
audiomp3 MP3Decoder: take advantage of background callback 2020-07-15 09:26:47 -05:00
audiopwmio audiopwmio: Add the shared files for this new module 2019-07-26 07:52:37 -05:00
bitbangio Add license to some obvious files. 2020-07-06 19:16:25 +01:00
board Change I2C default to 100khz 2020-09-25 11:07:22 -07:00
busio add timeout keyword to I2C - for bitbangio - ignored for busio 2018-05-13 21:54:44 -04:00
canio CAN: Use mp_obj_t insteaed of canio_message_obj_t, get rid of rtr field 2020-09-28 17:22:00 -05:00
displayio Removed redundant subrectangle sizing code 2020-09-30 11:06:13 -07:00
fontio Move Glyph and BuiltinFont into fontio 2019-03-19 16:22:09 -07:00
framebufferio FramebufferDisplay: Don't set rotation via core_construct 2020-09-01 11:00:22 -05:00
gamepad Gamepad & GamepadShift: Enable ticks while object exists 2020-05-13 10:14:37 -05:00
gamepadshift Gamepad & GamepadShift: Enable ticks while object exists 2020-05-13 10:14:37 -05:00
ipaddress Changes based on Dan's feedback 2020-09-03 16:32:12 -07:00
memorymonitor remove other extraneous files 2020-08-21 19:10:13 -05:00
multiterminal Merge tag 'v1.9.3' 2017-11-02 12:41:50 -07:00
network Add license to some obvious files. 2020-07-06 19:16:25 +01:00
os Add license to some obvious files. 2020-07-06 19:16:25 +01:00
random Introduce a random module that is a subset of CPython's random. It 2017-06-27 17:37:24 -07:00
rgbmatrix rgbmatrix: Move struct definition to shared-module, rename 'core' member 2020-09-02 13:34:16 -05:00
sdcardio remove extraneous files 2020-08-21 19:08:25 -05:00
sharpdisplay sharpdisplay: Fix memory corruption across soft-reset 2020-10-01 09:22:09 -05:00
socket modify modnetwork and modusocket for circuitpython 2018-10-04 22:02:25 +10:00
storage Merge pull request #3223 from dhalbert/unmount-before-reset 2020-07-29 10:47:24 -07:00
struct struct.pack_into incorrect buffer size check 2019-01-21 11:45:38 -05:00
terminalio fix terminalio not clearing on construct 2019-08-08 14:58:51 -04:00
time Fix up Spresense build. It doesn't sleep. 2020-03-17 14:21:45 -07:00
touchio Claim USB pins at startup to prevent overwrites 2020-07-22 14:22:05 -04:00
uheap uheap: Switch to using gc_nbytes to measure allcoation size so we stop undercounting. 2016-11-23 17:32:50 -08:00
usb_hid support to get HID OUT report 2020-08-19 20:18:17 +08:00
usb_midi update tinyusb lib to 0.5.x 2019-07-24 16:46:31 +07:00
ustack Fix up end of file and trailing whitespace. 2020-06-03 10:56:35 +01:00
vectorio use top-left heuristic for vectorio.Polygon 2020-07-28 23:10:59 -07:00
wiznet Add license to some obvious files. 2020-07-06 19:16:25 +01:00