Skip to content
Snippets Groups Projects
  1. Feb 11, 2020
    • Leon Scroggins III's avatar
      AImageDecoder: Make create enforce int32_t dimensions · 2e6bedf9
      Leon Scroggins III authored
      Bug: 135133301
      Test: AImageDecoderTest
      
      AImageDecoderHeaderInfo_getWidth/Height return an int32_t. Ensure at
      creation time that the actual image dimensions will fit in int32_t.
      
      In today's code, this should almost never happen:
      - PNGs have their dimensions limited to 1000000
        - see PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX in pnglibconf.h
      - JPEGs are limited to 65500
        - see JPEG_MAX_DIMENSION in jmorecfg.h
      - WebPs' dimensions are encoded in 14 bits
      - GIFs' dimensions are encoded in 16 bits
      - SkBmpCodec and SkWbmpCodec require dimensions to fit in 16 bits
      - SkIcoCodec uses SkBmpCodec or SkPngCodec, so their limits are
        enforced
      - libheif limits to a size smaller than int32_t
      
      It might be possible for a DNG image to be larger, and some of the above
      are configurable. Just in case, make AImageDecoder_create fail on such a
      large image.
      
      Change-Id: Id520dfbc0581f990c4f52cb6675e987bf71c558c
      2e6bedf9
  2. Feb 06, 2020
Loading