You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2018/11/23 06:33:54 UTC
[incubator-weex] branch master updated: [iOS] Protect invalid
rich-text data. (#1807)
This is an automated email from the ASF dual-hosted git repository.
cxfeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new bdd5337 [iOS] Protect invalid rich-text data. (#1807)
bdd5337 is described below
commit bdd5337308cdf084fe975d71be93da76ceec93be
Author: wqyfavor <wq...@163.com>
AuthorDate: Fri Nov 23 14:33:50 2018 +0800
[iOS] Protect invalid rich-text data. (#1807)
---
ios/sdk/WeexSDK/Sources/Component/WXRichText.mm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXRichText.mm b/ios/sdk/WeexSDK/Sources/Component/WXRichText.mm
index 833c7d4..c985d23 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXRichText.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXRichText.mm
@@ -25,6 +25,7 @@
#import "WXComponent+Layout.h"
#import "WXNavigationProtocol.h"
#import "WXImgLoaderProtocol.h"
+#import "WXLog.h"
#include <pthread/pthread.h>
@interface WXRichNode : NSObject
@@ -214,6 +215,16 @@ do {\
- (void)recursivelyAddChildNode:(NSDictionary *)nodeValue toSuperNode:(WXRichNode *)superNode
{
+ if (![nodeValue isKindOfClass:[NSDictionary class]]) {
+ WXLogError(@"Invalid rich text structure.");
+ return;
+ }
+
+ if (![nodeValue[@"type"] isKindOfClass:[NSString class]]) {
+ WXLogError(@"Invalid rich text structure.");
+ return;
+ }
+
WXRichNode *node = [[WXRichNode alloc]init];
[_richNodes addObject:node];