mirror of
https://github.com/php/php-src.git
synced 2024-12-18 14:30:35 +08:00
Fix recovery of large entities in mb_decode_numericentity()
Make sure we don't overflow the integer.
This commit is contained in:
parent
5265fabc25
commit
91f878779c
@ -2586,12 +2586,10 @@ collector_decode_htmlnumericentity(int c, void *data)
|
||||
(*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */
|
||||
r = 1;
|
||||
n = pc->digit;
|
||||
while (n > 0) {
|
||||
while (n > 1) {
|
||||
r *= 10;
|
||||
n--;
|
||||
}
|
||||
s %= r;
|
||||
r /= 10;
|
||||
while (r > 0) {
|
||||
d = s/r;
|
||||
s %= r;
|
||||
@ -2764,12 +2762,10 @@ int mbfl_filt_decode_htmlnumericentity_flush(mbfl_convert_filter *filter)
|
||||
s = pc->cache;
|
||||
r = 1;
|
||||
n = pc->digit;
|
||||
while (n > 0) {
|
||||
while (n > 1) {
|
||||
r *= 10;
|
||||
n--;
|
||||
}
|
||||
s %= r;
|
||||
r /= 10;
|
||||
while (r > 0) {
|
||||
d = s/r;
|
||||
s %= r;
|
||||
|
@ -14,8 +14,16 @@ $convmap = array(0x0, 0x2FFFF, 0, 0xFFFF);
|
||||
echo mb_decode_numericentity($str1, $convmap, "UTF-8")."\n";
|
||||
echo mb_decode_numericentity($str2, $convmap, "UTF-8")."\n";
|
||||
echo mb_decode_numericentity($str3, $convmap, "UTF-8")."\n";
|
||||
|
||||
echo mb_decode_numericentity('�', $convmap), "\n";
|
||||
echo mb_decode_numericentity('�', $convmap), "\n";
|
||||
echo mb_decode_numericentity('�', $convmap), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
|
||||
ƒΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψωϑϒϖ•…′″‾⁄℘ℑℜ™ℵ←↑→↓↔↵⇐⇑⇒⇓⇔∀∂∃∅∇∈∉∋∏∑−∗√∝∞∠∧∨∩∪∫∴∼≅≈≠≡≤≥⊂⊃⊄⊆⊇⊕⊗⊥⋅⌈⌉⌊⌋〈〉◊♠♣♥♦
|
||||
aŒbœcŠdše€fg
|
||||
�
|
||||
�
|
||||
�
|
||||
|
Loading…
Reference in New Issue
Block a user