In the Linux kernel, the following vulnerability has been resolved:
media: venus: hfi: add check to handle incorrect queue size
qsize represents size of shared queued between driver and video firmware. Firmware can modify this value to an invalid large value. In such situation, emptyspace will be bigger than the space actually available. Since newwridx is not checked, so the following code will result in an OOB write. ... qsize = qhdr->qsize
if (wridx >= rdidx) emptyspace = qsize - (wridx - rdidx) .... if (newwridx < qsize) { memcpy(wrptr, packet, dwords << 2) --> OOB write
Add check to ensure qsize is within the allocated size while reading and writing packets into the queue.