Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coders/pcd.c DecodeImage()function potential memory-leak bug #1193

Closed
3 tasks done
fisher2020 opened this issue Jul 4, 2018 · 2 comments
Closed
3 tasks done

coders/pcd.c DecodeImage()function potential memory-leak bug #1193

fisher2020 opened this issue Jul 4, 2018 · 2 comments
Labels

Comments

@fisher2020
Copy link

fisher2020 commented Jul 4, 2018

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

a potential memory leak bug locates in coders/pcd.c

Steps to Reproduce

the bug locates in
https://github.com/ImageMagick/ImageMagick/blob/master/coders/pcd.c : DecodeImage() function.
the code frament is as follows: we allocate buffer memory, we freed it in normal branch,but forgot free it in exception branch

https://github.com/ImageMagick/ImageMagick/blob/master/coders/pcd.c#L186

  buffer=(unsigned char *) AcquireQuantumMemory(0x800,sizeof(*buffer));
  if (buffer == (unsigned char *) NULL)
    ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
      image->filename);

but we forget free it in
https://github.com/ImageMagick/ImageMagick/blob/master/coders/pcd.c#L286

          default:
          {
            ThrowBinaryException(CorruptImageError,"CorruptImage",
              image->filename);
          }

credit: www.vackbot.com ( 墨云科技)

System Configuration

urban-warrior pushed a commit to ImageMagick/ImageMagick6 that referenced this issue Jul 4, 2018
@urban-warrior
Copy link
Member

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

@nohmask
Copy link

nohmask commented Jul 20, 2018

This was assigned CVE-2018-14435.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants