Memleak in AcquireVirtualMemory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
imagemagick (Debian) |
Fix Released
|
Unknown
|
|||
imagemagick (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The latest ImageMagick package (version 8:6.8.9.
To reproduce it, just take e.g. an image test.jpg and call "convert test.jpg test.png". Valgrind here shows:
[...]
==8396== 1,408 bytes in 1 blocks are definitely lost in loss record 237 of 248
==8396== at 0x4C2FFC6: memalign (in /usr/lib/
==8396== by 0x4C300D1: posix_memalign (in /usr/lib/
==8396== by 0x4FA11DA: AcquireAlignedM
==8396== by 0x4FA14EC: AcquireVirtualM
==8396== by 0x511FF5A: ReadJPEGImage (jpeg.c:1271)
==8396== by 0x4EF86D7: ReadImage (constitute.c:547)
==8396== by 0x4EF976A: ReadImages (constitute.c:853)
==8396== by 0x5541E17: ConvertImageCommand (convert.c:622)
==8396== by 0x55AE466: MagickCommandGe
==8396== by 0x4008B6: ConvertMain (convert.c:81)
==8396== by 0x4008B6: main (convert.c:92)
==8396==
==8396== 1,408 bytes in 1 blocks are definitely lost in loss record 238 of 248
==8396== at 0x4C2FFC6: memalign (in /usr/lib/
==8396== by 0x4C300D1: posix_memalign (in /usr/lib/
==8396== by 0x4FA11DA: AcquireAlignedM
==8396== by 0x4FA14EC: AcquireVirtualM
==8396== by 0x512C787: WriteOnePNGImage (png.c:10750)
==8396== by 0x5130AB1: WritePNGImage (png.c:12052)
==8396== by 0x4EF9BCE: WriteImage (constitute.c:1184)
==8396== by 0x4EFA571: WriteImages (constitute.c:1335)
==8396== by 0x55416DD: ConvertImageCommand (convert.c:3215)
==8396== by 0x55AE466: MagickCommandGe
==8396== by 0x4008B6: ConvertMain (convert.c:81)
==8396== by 0x4008B6: main (convert.c:92)
==8396==
==8396== LEAK SUMMARY:
==8396== definitely lost: 2,816 bytes in 2 blocks
==8396== indirectly lost: 0 bytes in 0 blocks
==8396== possibly lost: 1,352 bytes in 18 blocks
==8396== still reachable: 120,708 bytes in 228 blocks
[...]
The memleak is introduced by the Debian patch "0095-Fix-
The patch - according to its name and its commit message - fixes some OOB problems, but unfortunately also modifies other behaviour, in constrast to the original commit that it refers to:
https:/
The memleak happens in the function "AcquireVirtual
https:/
In that function, the different usable memory sources are queried one-after-another until memory from one source can be acquired. This means that the function does NOT try to acquire memory from source X, if the acquisition from source X-1 already succeeded.
Unfortunately the mentioned patch contradicts this behaviour for the first memory source that uses the "AcquireAligned
I attach a patch that fixes the memleak. Valgrind then displays:
==5428== LEAK SUMMARY:
==5428== definitely lost: 0 bytes in 0 blocks
==5428== indirectly lost: 0 bytes in 0 blocks
==5428== possibly lost: 1,352 bytes in 18 blocks
==5428== still reachable: 120,708 bytes in 228 blocks
But possibly it rather makes sense to clean up that Debian patch in general, and to separate the OOB fixes and the other changes (that needs to be corrected). The reason is that the patch got a bit complex and the patch name does not reflect what the patch actually does.
tags: | added: xenial |
Changed in imagemagick (Debian): | |
status: | Unknown → Fix Released |
The attachment "Memleak patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]