mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-27 06:12:24 +08:00
Fix crash when calling substring() on a string containing emoji. (#23609)
Summary: Fixes #23459. It is not legal to write the character array of a std::string, and can result in undefined behavior. [General] [Fixed] - Crash when substring intersects with emoji Pull Request resolved: https://github.com/facebook/react-native/pull/23609 Differential Revision: D14198159 Pulled By: mdvacca fbshipit-source-id: 71060b1b99ddab89793c98c09f99ec9974479e62
This commit is contained in:
committed by
Facebook Github Bot
parent
e903d8059a
commit
58c3a4c078
@@ -615,11 +615,13 @@ class TextExample extends React.Component<{}> {
|
||||
Works with other text styles
|
||||
</Text>
|
||||
</RNTesterBlock>
|
||||
<RNTesterBlock title="Substring Emoji (should only see 'test')">
|
||||
<Text>{'test🙃'.substring(0, 5)}</Text>
|
||||
</RNTesterBlock>
|
||||
</RNTesterPage>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
backgroundColorText: {
|
||||
left: 5,
|
||||
|
||||
Reference in New Issue
Block a user