Skip to content

Commit 08bcff8

Browse files
committed
fix sonar安全性问题
1 parent bce17b5 commit 08bcff8

File tree

5 files changed

+2
-137
lines changed

5 files changed

+2
-137
lines changed

dist/iclient9-leaflet.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25985,52 +25985,7 @@ SuperMap.Format.JSON = SuperMap.Class(SuperMap.Format, {
2598525985
catch (e) {
2598625986
// Fall through if the regexp test fails.
2598725987
}
25988-
} else try {
25989-
/*
25990-
* Parsing happens in three stages. In the first stage, we run the
25991-
* text against a regular expression which looks for non-JSON
25992-
* characters. We are especially concerned with '()' and 'new'
25993-
* because they can cause invocation, and '=' because it can
25994-
* cause mutation. But just to be safe, we will reject all
25995-
* unexpected characters.
25996-
*/
25997-
if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
25998-
25999-
/*
26000-
* In the second stage we use the eval function to compile the
26001-
* text into a JavaScript structure. The '{' operator is
26002-
* subject to a syntactic ambiguity in JavaScript - it can
26003-
* begin a block or an object literal. We wrap the text in
26004-
* parens to eliminate the ambiguity.
26005-
*/
26006-
//object = eval('(' + json + ')');
26007-
object = function (str) {
26008-
return (new Function("return " + str))();
26009-
}(json);
26010-
/*
26011-
* In the optional third stage, we recursively walk the new
26012-
* structure, passing each name/value pair to a filter
26013-
* function for possible transformation.
26014-
*/
26015-
if (typeof filter === 'function') {
26016-
function walk(k, v) {
26017-
if (v && typeof v === 'object') {
26018-
for (var i in v) {
26019-
if (v.hasOwnProperty(i)) {
26020-
v[i] = walk(i, v[i]);
26021-
}
26022-
}
26023-
}
26024-
return filter(k, v);
26025-
}
26026-
26027-
object = walk('', object);
26028-
}
26029-
}
26030-
} catch (e) {
26031-
// Fall through if the regexp test fails.
2603225988
}
26033-
2603425989
if (this.keepData) {
2603525990
this.data = object;
2603625991
}

dist/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-openlayers.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15910,52 +15910,7 @@ SuperMap.Format.JSON = SuperMap.Class(SuperMap.Format, {
1591015910
catch (e) {
1591115911
// Fall through if the regexp test fails.
1591215912
}
15913-
} else try {
15914-
/*
15915-
* Parsing happens in three stages. In the first stage, we run the
15916-
* text against a regular expression which looks for non-JSON
15917-
* characters. We are especially concerned with '()' and 'new'
15918-
* because they can cause invocation, and '=' because it can
15919-
* cause mutation. But just to be safe, we will reject all
15920-
* unexpected characters.
15921-
*/
15922-
if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
15923-
15924-
/*
15925-
* In the second stage we use the eval function to compile the
15926-
* text into a JavaScript structure. The '{' operator is
15927-
* subject to a syntactic ambiguity in JavaScript - it can
15928-
* begin a block or an object literal. We wrap the text in
15929-
* parens to eliminate the ambiguity.
15930-
*/
15931-
//object = eval('(' + json + ')');
15932-
object = function (str) {
15933-
return (new Function("return " + str))();
15934-
}(json);
15935-
/*
15936-
* In the optional third stage, we recursively walk the new
15937-
* structure, passing each name/value pair to a filter
15938-
* function for possible transformation.
15939-
*/
15940-
if (typeof filter === 'function') {
15941-
function walk(k, v) {
15942-
if (v && typeof v === 'object') {
15943-
for (var i in v) {
15944-
if (v.hasOwnProperty(i)) {
15945-
v[i] = walk(i, v[i]);
15946-
}
15947-
}
15948-
}
15949-
return filter(k, v);
15950-
}
15951-
15952-
object = walk('', object);
15953-
}
15954-
}
15955-
} catch (e) {
15956-
// Fall through if the regexp test fails.
1595715913
}
15958-
1595915914
if (this.keepData) {
1596015915
this.data = object;
1596115916
}

dist/iclient9-openlayers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/format/JSON.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -84,52 +84,7 @@ SuperMap.Format.JSON = SuperMap.Class(SuperMap.Format, {
8484
catch (e) {
8585
// Fall through if the regexp test fails.
8686
}
87-
} else try {
88-
/*
89-
* Parsing happens in three stages. In the first stage, we run the
90-
* text against a regular expression which looks for non-JSON
91-
* characters. We are especially concerned with '()' and 'new'
92-
* because they can cause invocation, and '=' because it can
93-
* cause mutation. But just to be safe, we will reject all
94-
* unexpected characters.
95-
*/
96-
if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
97-
98-
/*
99-
* In the second stage we use the eval function to compile the
100-
* text into a JavaScript structure. The '{' operator is
101-
* subject to a syntactic ambiguity in JavaScript - it can
102-
* begin a block or an object literal. We wrap the text in
103-
* parens to eliminate the ambiguity.
104-
*/
105-
//object = eval('(' + json + ')');
106-
object = function (str) {
107-
return (new Function("return " + str))();
108-
}(json);
109-
/*
110-
* In the optional third stage, we recursively walk the new
111-
* structure, passing each name/value pair to a filter
112-
* function for possible transformation.
113-
*/
114-
if (typeof filter === 'function') {
115-
function walk(k, v) {
116-
if (v && typeof v === 'object') {
117-
for (var i in v) {
118-
if (v.hasOwnProperty(i)) {
119-
v[i] = walk(i, v[i]);
120-
}
121-
}
122-
}
123-
return filter(k, v);
124-
}
125-
126-
object = walk('', object);
127-
}
128-
}
129-
} catch (e) {
130-
// Fall through if the regexp test fails.
13187
}
132-
13388
if (this.keepData) {
13489
this.data = object;
13590
}

0 commit comments

Comments
 (0)