mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00
[mpp_buffer]: avoid accessing violation address
Sometimes the offset or the offset plus the size is beyond the buffer area. It would be better to raise an error and stopping the future step rather than the kernel halt it. Change-Id: I32d6f05736c874d56e1e9f77505f16ca3a2c01ac Signed-off-by: Randy Li <randy.li@rock-chips.com>
This commit is contained in:
@@ -147,6 +147,8 @@ MPP_RET mpp_buffer_write_with_caller(MppBuffer buffer, size_t offset, void *data
|
||||
return MPP_OK;
|
||||
|
||||
MppBufferImpl *p = (MppBufferImpl*)buffer;
|
||||
if (offset + size > p->info.size)
|
||||
return MPP_ERR_VALUE;
|
||||
if (NULL == p->info.ptr)
|
||||
mpp_buffer_mmap(p, caller);
|
||||
|
||||
|
Reference in New Issue
Block a user