mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
LocalString doesn't have a check for nullptr
Summary: LocalString doesn't have a check for null ptr which causes a crash if the null string passed. Closes https://github.com/facebook/react-native/pull/15372 Differential Revision: D5601469 Pulled By: javache fbshipit-source-id: a1b20efbae90009f0d465c077e6401a701d7515f
This commit is contained in:
parent
92dd6b9c9d
commit
7e515479b0
@ -82,6 +82,7 @@ size_t modifiedLength(const uint8_t* str, size_t* length) {
|
||||
// NUL-terminated: Scan for length and supplementary characters
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
if (str != nullptr) {
|
||||
while (str[i] != 0) {
|
||||
if (str[i + 1] == 0 ||
|
||||
str[i + 2] == 0 ||
|
||||
@ -94,6 +95,7 @@ size_t modifiedLength(const uint8_t* str, size_t* length) {
|
||||
j += 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*length = i;
|
||||
return j;
|
||||
|
Loading…
x
Reference in New Issue
Block a user