Check the padded size of the read byte array
Bug: 13509200 Change-Id: Id93894fcc617ec1cd4ce66921c6e1f1c3cf40b09
This commit is contained in:
parent
f0190bff38
commit
5b61ad2cda
@ -908,7 +908,8 @@ void Parcel::remove(size_t start, size_t amt)
|
|||||||
|
|
||||||
status_t Parcel::read(void* outData, size_t len) const
|
status_t Parcel::read(void* outData, size_t len) const
|
||||||
{
|
{
|
||||||
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
|
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize
|
||||||
|
&& len <= PAD_SIZE(len)) {
|
||||||
memcpy(outData, mData+mDataPos, len);
|
memcpy(outData, mData+mDataPos, len);
|
||||||
mDataPos += PAD_SIZE(len);
|
mDataPos += PAD_SIZE(len);
|
||||||
ALOGV("read Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("read Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
@ -919,7 +920,8 @@ status_t Parcel::read(void* outData, size_t len) const
|
|||||||
|
|
||||||
const void* Parcel::readInplace(size_t len) const
|
const void* Parcel::readInplace(size_t len) const
|
||||||
{
|
{
|
||||||
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
|
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize
|
||||||
|
&& len <= PAD_SIZE(len)) {
|
||||||
const void* data = mData+mDataPos;
|
const void* data = mData+mDataPos;
|
||||||
mDataPos += PAD_SIZE(len);
|
mDataPos += PAD_SIZE(len);
|
||||||
ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
|
Loading…
Reference in New Issue
Block a user