ImageMagick 7.0.8-34 has a "use of uninitialized value" vulnerability in the WriteJP2Image function in coders/jp2.c.
cpe:2.3:a:imagemagick:imagemagick:7.0.8-34:*:*:*:*:*:*:*
F10870C6-6679-45A8-8F7F-8C3C295A4E29
OR
### 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](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported

### Description
<!-- A description of the bug or feature -->

There a use-of-uninitialized-value vulnerability in function WriteJP2Image in coders/jp2.c.

```
  if (image_info->extract != (char *) NULL)
    {
      RectangleInfo
        geometry;

      int
        flags;

      /*
        Set tile size.
      */
      flags=ParseAbsoluteGeometry(image_info->extract,&geometry);
      parameters.cp_tdx=(int) geometry.width;
      parameters.cp_tdy=(int) geometry.width;
      if ((flags & HeightValue) != 0)
        parameters.cp_tdy=(int) geometry.height;
      if ((flags & XValue) != 0)
        parameters.cp_tx0=geometry.x;
      if ((flags & YValue) != 0)
        parameters.cp_ty0=geometry.y;
      parameters.tile_size_on=OPJ_TRUE;
}
```
https://github.com/ImageMagick/ImageMagick/blob/master/coders/jp2.c#L853

We should call `(void) memset(&geometry,0,sizeof(geometry));` after declaration.

See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6441, https://github.com/ImageMagick/ImageMagick/commit/eeb68ee77dfb2b508284e4ea7d49e8b807d32783 and 81bfff2759854654bf07e452bf3b9b329f3c55e5 for detail.


Use-of-uninitialized-value in function WriteJP2Image
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Use-of-uninitialized-value in function WriteJP2Image
Issue date:

--- start body ---
### 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](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported

### Description
<!-- A description of the bug or feature -->

There a use-of-uninitialized-value vulnerability in function WriteJP2Image in coders/jp2.c.

```
  if (image_info->extract != (char *) NULL)
    {
      RectangleInfo
        geometry;

      int
        flags;

      /*
        Set tile size.
      */
      flags=ParseAbsoluteGeometry(image_info->extract,&geometry);
      parameters.cp_tdx=(int) geometry.width;
      parameters.cp_tdy=(int) geometry.width;
      if ((flags & HeightValue) != 0)
        parameters.cp_tdy=(int) geometry.height;
      if ((flags & XValue) != 0)
        parameters.cp_tx0=geometry.x;
      if ((flags & YValue) != 0)
        parameters.cp_ty0=geometry.y;
      parameters.tile_size_on=OPJ_TRUE;
}
```
https://github.com/ImageMagick/ImageMagick/blob/master/coders/jp2.c#L853

We should call `(void) memset(&geometry,0,sizeof(geometry));` after declaration.

See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6441, https://github.com/ImageMagick/ImageMagick/commit/eeb68ee77dfb2b508284e4ea7d49e8b807d32783 and 81bfff2759854654bf07e452bf3b9b329f3c55e5 for detail.


--- end body ---

comments :
--- start comments ---

--- end comments ---