Summary: | Crash on saving an image > 65.535 (2^16-1) due to insufficient math ranges | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Tiar <tamtamy.tymona> |
Component: | General | Assignee: | Tiar <tamtamy.tymona> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | halla |
Priority: | NOR | ||
Version: | 4.4.2 | ||
Target Milestone: | --- | ||
Platform: | Mint (Ubuntu based) | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/graphics/krita/commit/0817c0f56c1b947d4cc76f824f330af6b8d318f4 | Version Fixed In: | |
Sentry Crash Report: |
Description
Tiar
2021-01-26 23:22:26 UTC
Let's confirm it since there are at least three people who encountered it, me, windragon and wayneqq from https://forum.kde.org/viewtopic.php?f=139&t=169787 Let's assign it as well :P Git commit fc52cc9ca602b75d423a5b8b4f5bbea882393938 by Agata Cacko. Committed on 30/03/2021 at 12:11. Pushed by tymond into branch 'master'. Fix crash on saving a huge image to .kra Before this commit, an image of size bigger than 66k in any dimension would crash Krita because it tries to scale the projection to 256x256 image, which means that the scale would be less than 1/256. KisTransformWorker uses KisFixedPoint to scale, which means that the scale would (in KisFixedPoint maths) equal 0, which means there is division by 0. M +9 -0 libs/image/kis_image.cc https://invent.kde.org/graphics/krita/commit/fc52cc9ca602b75d423a5b8b4f5bbea882393938 Git commit c6608d08c24f8a5417425e13e4c040cde891b43b by Agata Cacko. Committed on 30/03/2021 at 12:11. Pushed by tymond into branch 'master'. Ensure that transform worker won't try to scale to 0 Transform Worker did have a check for scale being 0... but it's only in the double value. KisFilterWeightsBuffer converts those values to KisFixedPoint, which has much different precision (the scale cannot be lower than 1/256, otherwise it gets rounded to 0). This commit adds a check after converting to KisFixedPoint. Note: it would be best if the KisFixedPoint had higher precision. I added the conversion check there, because it's an easy operation, but it could be KisFilterWeightsBuffer and KisFilterWeightsApplicator checking the values to make sure they're correct transformation-wise and KisTransfromWorker only checking some kind of buffer->valid() and applicator->valid() result. M +8 -3 libs/image/kis_transform_worker.cc https://invent.kde.org/graphics/krita/commit/c6608d08c24f8a5417425e13e4c040cde891b43b Git commit 0817c0f56c1b947d4cc76f824f330af6b8d318f4 by Agata Cacko. Committed on 03/06/2021 at 21:21. Pushed by tymond into branch 'krita/4.3'. Fix crash on saving a huge image to .kra Before this commit, an image of size bigger than 66k in any dimension would crash Krita because it tries to scale the projection to 256x256 image, which means that the scale would be less than 1/256. KisTransformWorker uses KisFixedPoint to scale, which means that the scale would (in KisFixedPoint maths) equal 0, which means there is division by 0. M +9 -0 libs/image/kis_image.cc https://invent.kde.org/graphics/krita/commit/0817c0f56c1b947d4cc76f824f330af6b8d318f4 Git commit d621189b910fec56b38890dab54f7e218c6e6b3b by Agata Cacko. Committed on 03/06/2021 at 21:21. Pushed by tymond into branch 'krita/4.3'. Ensure that transform worker won't try to scale to 0 Transform Worker did have a check for scale being 0... but it's only in the double value. KisFilterWeightsBuffer converts those values to KisFixedPoint, which has much different precision (the scale cannot be lower than 1/256, otherwise it gets rounded to 0). This commit adds a check after converting to KisFixedPoint. Note: it would be best if the KisFixedPoint had higher precision. I added the conversion check there, because it's an easy operation, but it could be KisFilterWeightsBuffer and KisFilterWeightsApplicator checking the values to make sure they're correct transformation-wise and KisTransfromWorker only checking some kind of buffer->valid() and applicator->valid() result. M +8 -3 libs/image/kis_transform_worker.cc https://invent.kde.org/graphics/krita/commit/d621189b910fec56b38890dab54f7e218c6e6b3b |