FIX: 3mf files containing small thumbnails cause crash

Fix the issue that 3mf files containing small thumbnails cause the print page to crash. Due to m_cur_input_thumbnail_data has small size which caused array out of bounds and crash.

jira: STUDIO-13731
Change-Id: Ie3c30287265f635e6afb2b1157c97c5b6863d54e
(cherry picked from commit adffd16e1fbbcba0f1bc33ebd6112e57c88f30e7)
This commit is contained in:
songwei.li 2025-07-30 15:57:05 +08:00 committed by Noisyfox
parent 83feaeadec
commit 873fb30bc5

View file

@ -4031,7 +4031,7 @@ void SelectMachineDialog::record_edge_pixels_data()
};
ThumbnailData &data = m_cur_no_light_thumbnail_data;
ThumbnailData &origin_data = m_cur_input_thumbnail_data;
if (data.width > 0 && data.height > 0) {
if (data.width > 0 && data.height > 0 && (data.width == origin_data.width && data.height == origin_data.height) ) {
m_edge_pixels.resize(data.width * data.height);
for (unsigned int r = 0; r < data.height; ++r) {
unsigned int rr = (data.height - 1 - r) * data.width;