Commit 3e7e5d0
committed
ICU-23251 Validate serialized spoof data in SpoofData deserialization
Add comprehensive validation for serialized spoof checker data:
1. initPtrs(): Bounds check all offset+size pairs (fCFUKeys, fCFUStringIndex,
fCFUStringTable) against the total data length. Validate cross-table
consistency: if keys exist, value index and string table must also exist;
value index table must have at least as many entries as the keys table.
2. confusableLookup(): Guard against empty confusable data (length == 0 or
fCFUKeys == nullptr) to prevent the do-while binary search loop from
dereferencing a null pointer.
3. appendValueTo(): Bounds check the string table index before reading from
fCFUStrings to prevent heap-buffer-overflow when crafted data contains
out-of-range string references.
Without these validations, crafted serialized data passed to
uspoof_openFromSerialized() causes null pointer dereference, heap buffer
overflow reads, and other memory safety issues when the spoof checker is
subsequently used.1 parent a746312 commit 3e7e5d0
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
105 | 122 | | |
106 | 123 | | |
107 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
| 717 | + | |
717 | 718 | | |
718 | 719 | | |
719 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
720 | 732 | | |
721 | 733 | | |
722 | 734 | | |
| |||
802 | 814 | | |
803 | 815 | | |
804 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
805 | 821 | | |
806 | 822 | | |
807 | 823 | | |
| |||
842 | 858 | | |
843 | 859 | | |
844 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
845 | 867 | | |
846 | 868 | | |
847 | 869 | | |
| |||
0 commit comments