Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3c29798 authored by Ram Mohan's avatar Ram Mohan Committed by Dichen Zhang
Browse files

ultrahdr: asan fix, default initialize member variable

The default value of mExifPos is commented as -1, but this is missing.
Further size_t is usually defined as unsigned int resulting negative
values as overflow. Best to declare it as ssize_t

Bug: 299596513
Test: atest ultrahdr_unit_test

Change-Id: I187f21aea44914993872def5a4889435d3f2d402
parent e1ecba3a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ private:
    size_t mHeight;

    // Position of EXIF package, default value is -1 which means no EXIF package appears.
    size_t mExifPos;
    ssize_t mExifPos = -1;
};
} /* namespace android::ultrahdr  */

+1 −1
Original line number Diff line number Diff line
@@ -1268,7 +1268,7 @@ status_t JpegR::appendGainMap(jr_compressed_ptr primary_jpg_image_ptr,
  jpegr_compressed_struct new_jpg_image;
  new_jpg_image.data = nullptr;
  new_jpg_image.length = 0;
  if (decoder.getEXIFPos() != 0) {
  if (decoder.getEXIFPos() >= 0) {
    if (pExif != nullptr) {
      ALOGE("received EXIF from outside while the primary image already contains EXIF");
      return ERROR_JPEGR_INVALID_INPUT_TYPE;