JianyuWang0623 opened a new pull request, #3446: URL: https://github.com/apache/nuttx-apps/pull/3446
## Summary Fix two bugs in the camera example app that cause heap corruption crash on ESP32-S3 with PSRAM. ## Changes - **camera_main.c**: increase V4L2 USERPTR buffer alignment from 32 to 64 bytes. ESP32-S3 PSRAM DMA uses 64-byte block size (`ESP32S3_DMA_EXT_MEMBLK_64B`); misaligned buffers cause DMA to corrupt adjacent heap metadata, leading to crash in `free()`. - **camera_bkgd.c**: fix `nximage_draw` to use source image width as `nx_bitmap` stride instead of LCD screen width. When image and screen dimensions differ (e.g. 320x240 image on 240x320 LCD), the wrong stride causes NX to read past buffer boundaries. Also clip destination rect to `min(image, screen)` dimensions. ## Impact - Fixes StoreProhibitedCause crash in `mm_delayfree` during `fclose` after image save - Fixes incorrect LCD preview rendering when image and screen dimensions differ ## Testing Tested on lckfb-szpi-esp32s3 (ESP32-S3 + GC0308 320x240 sensor + ST7789 240x320 LCD): - Camera example app: 10 captures + LCD preview + normal exit, no crash - Multiple consecutive runs stable - camcap (simple V4L2 capture) unaffected ## Related PR nuttx-side fix: https://github.com/apache/nuttx/pull/18663 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
