Fix a null pointer bug in SkData::copyRange
The documentation for SkData::copyRange allows for a null pointer to be passed to the buffer argument. However, the current implementation throws a Segmentation fault if a null pointer is passed. A null pointer check is added. fix: check for null pointer Change-Id: I1b5b67fa161f3b3ddf1fa48093ccdf0380024204 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/498137 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
96071b714f
commit
dd1547f582
1
AUTHORS
1
AUTHORS
@ -74,6 +74,7 @@ JetBrains <*@jetbrains.com>
|
||||
Vibe Inc <*@vibe.us>
|
||||
Scene Group Ltd. <*@scenegroup.co>
|
||||
LG Electronics <*@lge.com>
|
||||
Shekhar Dutta <sherlockdoyle1904@gmail.com>
|
||||
|
||||
# Trusted service accounts.
|
||||
Recipe roller SA <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
|
||||
|
@ -57,7 +57,9 @@ size_t SkData::copyRange(size_t offset, size_t length, void* buffer) const {
|
||||
}
|
||||
SkASSERT(length > 0);
|
||||
|
||||
memcpy(buffer, this->bytes() + offset, length);
|
||||
if (buffer) {
|
||||
memcpy(buffer, this->bytes() + offset, length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user