Commit 1fa9b7a
authored
Validate that strings being parsed as integers consist of ASCII characters (#2995)
* Validate that strings being parsed as integers consist of ASCII characters.
This is technically an incompatible change, although it is unlikely that
anyone will be affected by it. It also fixes a minor security issue.
Fixes #2994.
* Verify that `Integer.parseInt` does accept non-ASCII digits.
* Move validation outside try/catch.
Suggested by @Marcono1234.1 parent b7d5954 commit 1fa9b7a
2 files changed
Lines changed: 40 additions & 0 deletions
File tree
- gson/src
- main/java/com/google/gson/stream
- test/java/com/google/gson/stream
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1090 | 1090 | | |
1091 | 1091 | | |
1092 | 1092 | | |
| 1093 | + | |
1093 | 1094 | | |
1094 | 1095 | | |
1095 | 1096 | | |
| |||
1332 | 1333 | | |
1333 | 1334 | | |
1334 | 1335 | | |
| 1336 | + | |
1335 | 1337 | | |
1336 | 1338 | | |
1337 | 1339 | | |
| |||
1853 | 1855 | | |
1854 | 1856 | | |
1855 | 1857 | | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
1856 | 1866 | | |
1857 | 1867 | | |
1858 | 1868 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
736 | 736 | | |
737 | 737 | | |
738 | 738 | | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
739 | 766 | | |
740 | 767 | | |
741 | 768 | | |
| |||
828 | 855 | | |
829 | 856 | | |
830 | 857 | | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
831 | 861 | | |
832 | 862 | | |
833 | 863 | | |
| |||
0 commit comments