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 in ReadPSImage in coder/ps.c #1601

Closed
YangY-Xiao opened this issue Jun 18, 2019 · 2 comments
Closed

Memory leak in ReadPSImage in coder/ps.c #1601

YangY-Xiao opened this issue Jun 18, 2019 · 2 comments
Labels
Milestone

Comments

@YangY-Xiao
Copy link

Prerequisites

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

Description

There is a memory leak issue in ReadPSImage in coder/ps.c

      page_geometry=GetPageGeometry(option);
      flags=ParseMetaGeometry(page_geometry,&page.x,&page.y,&page.width,
        &page.height);
      if (flags == NoValue)
        {
          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
            "InvalidGeometry","`%s'",option);
          image=DestroyImage(image);
          return((Image *) NULL);
        }
      page.width=(size_t) ceil((double) (page.width*image->resolution.x/delta.x)
        -0.5);
      page.height=(size_t) ceil((double) (page.height*image->resolution.y/
        delta.y) -0.5);
      page_geometry=DestroyString(page_geometry);
      fitPage=MagickTrue;

https://github.com/ImageMagick/ImageMagick/blob/master/coders/ps.c#L740

It is possible that page_geometry is not destroyed since there is a return statement before it.
It is the issue which is similar to the one fixed in 15be797

@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.

urban-warrior pushed a commit to ImageMagick/ImageMagick6 that referenced this issue Jun 18, 2019
@dlemstra dlemstra added the bug label Jun 18, 2019
@dlemstra dlemstra added this to the 7.0.8-50 milestone Jun 18, 2019
@nohmask
Copy link

nohmask commented Jul 3, 2019

This was assigned CVE-2019-13137.

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