Fix an uninitialized memory read in PIEX am: bb217acdca am: 945ea16b97

am: 49b79bc8ec

Change-Id: Ie3821020951d5978a311c6cee8f4bcc5a1f76984
This commit is contained in:
Leon Scroggins III
2018-03-12 14:57:06 +00:00
committed by android-build-merger
2 changed files with 9 additions and 6 deletions

View File

@@ -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;
}
}

View File

@@ -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);