mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 17:34:12 +02:00
1002b269ac
ElementPictureFactory::pixmap() made a pixmap of whatever width and height the symbol file declares. A symbol whose parts span 280 000 px (made by the GUI fuzzer in the symbol editor) asked for a ~315 GB pixmap. Under AddressSanitizer that aborts QElectroTech; the symbol then sat in the user collection and every later start died loading its icon. The preview is now drawn scaled down to fit 4096 px on its longer side. The largest symbols in the shipped collection are 3160 px, so none of them changes. The size is also bounded before it is rounded up to a multiple of 10, so a crafted value near INT_MAX cannot overflow. Checked with a user collection holding one symbol declared 280000 x 280000, on ASan builds: master aborts (out of memory, exit 1) 3/3 when the collection is expanded; with this change QElectroTech keeps running and lists the symbol, 3/3. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>