Heap-based Buffer Overflow Affecting gpac4ios package, versions >=0.0.0

  • Exploit Maturity

    Proof of concept

  • Attack Complexity


  • Confidentiality


Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • snyk-id


  • published

    19 Aug 2021

  • disclosed

    19 Aug 2021

  • credit

    Cisco Talos

How to fix?

There is no fixed version for GPAC4iOS.


GPAC4iOS is a GPAC4iOS is the libgpac library packaged for iOS as a Pod. It is preconfigured and tested to do a single task: create a MP4 file from a raw H.264 and an audio track.

Affected versions of this package are vulnerable to Heap-based Buffer Overflow. In order to parse an atom with the "fpar" FOURCC code, the following function is used. After reading a few fields from the beginning of the atom, at line 25 the library will read 32-bits from the input if the “version” field is set to a value other than 0. Due to it being verified against a 64-bit size, the check is insufficient. Afterwards at line 26, the library will use the GF_SAFE_ALLOC_N macro to multiply the number of entries with the size of the FilePartitionEntry type. This multiplication can result in an integer overflow which can result in an undersized buffer being made. Later at line 27, the library will read integers from the input directly into this undersized buffer. This will eventually write outside the bounds of the allocation, resulting in a heap-based buffer overflow.