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

memory leak bug in MagickCore/animate.c: AcquireMagickMemory() function #1195

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

Comments

@hanguanggithub
Copy link

hanguanggithub 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

hello,i find a memory leak bug in imagemagick,the details is on the Steps to Reproduce.

Steps to Reproduce

the bug located in animate.c,
static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
XWindows *windows,const CommandType command_type,
Image **image, MagickStatusType *state,
ExceptionInfo *exception) functiion
the bug code is on
https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/animate.c#L424
the code fragment is as follows:
filelist=(char **) AcquireMagickMemory(sizeof(char *));

we can see that we allocate a memory and assigned it to file list,but we forget to free it in the code:
https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/animate.c#L434
the code fragment is as follows:

if ((status == MagickFalse) || (number_files == 0))
        {
          if (number_files == 0)
            {
              ThrowXWindowException(ImageError,"NoImagesWereLoaded",filenames);
             return((Image *) NULL);
            }
          ThrowXWindowException(ResourceLimitError,"MemoryAllocationFailed",
            filenames);
          return((Image *) NULL);
        }

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

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 6, 2018

This was assigned CVE-2018-13153.

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