diff options
| author | Leon Scroggins III <scroggo@google.com> | 2018-03-12 14:40:04 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2018-03-12 14:40:04 +0000 |
| commit | 945ea16b97d3d2ee129a2b268f3efdf9c4307c81 (patch) | |
| tree | ad1dbaac28851868cadbbdde7bceda97bc771a32 | |
| parent | bfb129687dab57f1ccfdc76e1b1d84a111fce111 (diff) | |
| parent | bb217acdca1cc0c16b704669dd6f91a1b509c406 (diff) | |
| download | platform_external_piex-945ea16b97d3d2ee129a2b268f3efdf9c4307c81.tar.gz platform_external_piex-945ea16b97d3d2ee129a2b268f3efdf9c4307c81.tar.bz2 platform_external_piex-945ea16b97d3d2ee129a2b268f3efdf9c4307c81.zip | |
Fix an uninitialized memory read in PIEX
am: bb217acdca
Change-Id: I970cefdb5c409ee598beb896547167ddf543e548
| -rw-r--r-- | src/tiff_parser.cc | 13 | ||||
| -rw-r--r-- | src/tiff_parser.h | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/tiff_parser.cc b/src/tiff_parser.cc index 6bf3bb4..f36c5ba 100644 --- a/src/tiff_parser.cc +++ b/src/tiff_parser.cc @@ -165,11 +165,14 @@ bool FillPreviewImageData(const TiffDirectory& tiff_directory, // Get color_space if (tiff_directory.Has(kExifTagColorSpace)) { std::uint32_t color_space; - success &= tiff_directory.Get(kExifTagColorSpace, &color_space); - if (color_space == 1) { - preview_image_data->color_space = PreviewImageData::kSrgb; - } else if (color_space == 65535 || color_space == 2) { - preview_image_data->color_space = PreviewImageData::kAdobeRgb; + if (tiff_directory.Get(kExifTagColorSpace, &color_space)) { + if (color_space == 1) { + preview_image_data->color_space = PreviewImageData::kSrgb; + } else if (color_space == 65535 || color_space == 2) { + preview_image_data->color_space = PreviewImageData::kAdobeRgb; + } + } else { + success = false; } } diff --git a/src/tiff_parser.h b/src/tiff_parser.h index 84b3fc6..e809274 100644 --- a/src/tiff_parser.h +++ b/src/tiff_parser.h @@ -163,7 +163,7 @@ bool GetFullDimension32(const tiff_directory::TiffDirectory& tiff_directory, std::uint32_t* width, std::uint32_t* height); // Reads the width and height of the crop information if available. -// Returns false if an error occured. +// Returns false if an error occurred. bool GetFullCropDimension(const tiff_directory::TiffDirectory& tiff_directory, std::uint32_t* width, std::uint32_t* height); |
