An exploitable heap write out of bounds vulnerability exists in the decoding of BPG images in Libbpg library. A crafted BPG image decoded by libbpg can cause an integer underflow vulnerability causing an out of bounds heap write leading to remote code execution. This vulnerability can be triggered via attempting to decode a crafted BPG image using Libbpg.
BPG (Better Portable Graphics) is an image format created in 2014 based on the HECV video compression standard. BPG has been praised for its ability to produce the same quality image as JPEG or JPEG XR, but in a much smaller file size. It is currently in line to be incorporated in the multimedia player VLC.
During the decoding of a BPG, in the restore_tqb_pixels function, an attacker controlled integer underflow can occur  during the calculation of offsets for the src and dst operands of a mempcy. Because of the underflows, the resulting addresses passed to the memcpy  are outside the bounds of the original heap structures, resulting in an out of bounds write condition.