Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[Android] Fix C++ Crash in WeexCore::NotifyLayout #2831

Merged
merged 1 commit into from
Aug 16, 2019

Conversation

YorkShen
Copy link
Contributor

The return value of jString2StrFast(env, instanceId) could be std::string(nullptr)`` if instanceId is nullptr`, in which case the return value would cause crash.

    #00 pc 0x4aaec libweexcore.so (_ZNSt6__ndk16__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPN8WeexCore14RenderPageBaseEEENS_19__map_value_compareIS7_SB_NS_4lessIS7_EELb1EEENS5_ISB_EEE13__lower_boundIS7_EENS_15__tree_iteratorISB_PNS_11__tree_nodeISB_PvEEiEERKT_SN_PNS_15__tree_end_nodeIPNS_16__tree_node_baseISL_EEEE+23)
    #01 pc 0x4aa6b libweexcore.so (_ZNSt6__ndk16__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPN8WeexCore14RenderPageBaseEEENS_19__map_value_compareIS7_SB_NS_4lessIS7_EELb1EEENS5_ISB_EEE4findIS7_EENS_15__tree_iteratorISB_PNS_11__tree_nodeISB_PvEEiEERKT_+18)
    #02 pc 0x4907b libweexcore.so (_ZN8WeexCore13RenderManager7GetPageERKNSt6__ndk112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+6)
    #03 pc 0x5d2d5 libweexcore.so (_ZN8WeexCore18CoreSideInPlatform12NotifyLayoutERKNSt6__ndk112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+12)

Brief Description of the PR

Checklist

  • Demo:
  • Documentation:

The return value of `jString2StrFast(env, instanceId)` could be `std::string(nullptr)`` if instanceId is `nullptr`, in which case the return value would cause crash.

```
    #00 pc 0x4aaec libweexcore.so (_ZNSt6__ndk16__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPN8WeexCore14RenderPageBaseEEENS_19__map_value_compareIS7_SB_NS_4lessIS7_EELb1EEENS5_ISB_EEE13__lower_boundIS7_EENS_15__tree_iteratorISB_PNS_11__tree_nodeISB_PvEEiEERKT_SN_PNS_15__tree_end_nodeIPNS_16__tree_node_baseISL_EEEE+23)
    #1 pc 0x4aa6b libweexcore.so (_ZNSt6__ndk16__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPN8WeexCore14RenderPageBaseEEENS_19__map_value_compareIS7_SB_NS_4lessIS7_EELb1EEENS5_ISB_EEE4findIS7_EENS_15__tree_iteratorISB_PNS_11__tree_nodeISB_PvEEiEERKT_+18)
    #2 pc 0x4907b libweexcore.so (_ZN8WeexCore13RenderManager7GetPageERKNSt6__ndk112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+6)
    #3 pc 0x5d2d5 libweexcore.so (_ZN8WeexCore18CoreSideInPlatform12NotifyLayoutERKNSt6__ndk112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+12)
 ```
@YorkShen YorkShen added this to the Weex 0.27 milestone Aug 16, 2019
@weex-bot
Copy link

Warnings
⚠️ No Changelog changes! - Can you add a Changelog? To do so,append your changes to the changelog.md
⚠️ If your PR is about fixing a bug excluding crash the code,you should add the demo link in the PR description. Demo link: http://dotwe.org/vue
⚠️ If you update the code, maybe you should update the documentation and add the documentation link in the PR description. here is the guide about how to contribute documentation: https://github.com/apache/incubator-weex/blob/master/CONTRIBUTING.md#contribute-code-or-document
Messages
📖 danger test finished.

Generated by 🚫 dangerJS against 2da0847

Copy link
Contributor

@jianhan-he jianhan-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jianhan-he jianhan-he merged commit f3c3c17 into apache:master Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants