Skip to content

Commit

Permalink
fix CVE-2021-27568 in 2 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielCh committed Apr 4, 2021
1 parent d07cf9f commit 768db58
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion json-smart-mini/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>net.minidev</groupId>
<artifactId>parent</artifactId>
<version>1.0.9-1</version>
<version>1.3.2</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,13 @@ private Object readNumber(boolean[] stop) throws ParseException, IOException {
return sb.toString().trim();
}
String num = sb.toString().trim();
if (num.length() > 18) // follow JSjonIJ parssing methode
return new BigDecimal(num);
return Double.parseDouble(num);
try {
if (num.length() > 18) // follow JSjonIJ parssing methode
return new BigDecimal(num);
return Double.parseDouble(num);
} catch (NumberFormatException e) {
throw new ParseException(pos, ERROR_UNEXPECTED_TOKEN, xs);
}
}
sb.append('E');
read();
Expand All @@ -266,7 +270,11 @@ private Object readNumber(boolean[] stop) throws ParseException, IOException {
skipNQString(stop);
return sb.toString().trim();
}
return Double.parseDouble(sb.toString().trim());
try {
return Double.parseDouble(sb.toString().trim());
} catch (NumberFormatException e) {
throw new ParseException(pos, ERROR_UNEXPECTED_TOKEN, xs);
}
} else {
skipNQString(stop);
return sb.toString().trim();
Expand Down
2 changes: 1 addition & 1 deletion json-smart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>net.minidev</groupId>
<artifactId>parent</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,13 @@ public void checkLeadinZero() throws ParseException {
protected Number extractFloat() throws ParseException {
if (!acceptLeadinZero)
checkLeadinZero();

try {
if (!useHiPrecisionFloat)
return Float.parseFloat(xs);

if (xs.length() > 18) // follow JSonIJ parsing method
return new BigDecimal(xs);

return Double.parseDouble(xs);

} catch(NumberFormatException e){
} catch(NumberFormatException e) {
throw new ParseException(pos, ERROR_UNEXPECTED_TOKEN, xs);
}
}
Expand Down
4 changes: 2 additions & 2 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.minidev</groupId>
<artifactId>parent</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
<name>Minidev public super pom</name>
<description>minidev common properties.</description>
<packaging>pom</packaging>
Expand All @@ -25,7 +25,7 @@
<id>uriel</id>
<name>Uriel Chemouni</name>
<email>uchemouni@gmail.com</email>
<timezone>GMT+1</timezone>
<timezone>GMT+3</timezone>
<roles>
</roles>
</developer>
Expand Down

0 comments on commit 768db58

Please sign in to comment.