1--TEST-- 2mb_strcut() missing boundary check. 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_convert_encoding') or die("skip mb_convert_encoding() is not available in this build"); 7?> 8--FILE-- 9<?php 10mb_internal_encoding("UCS-4LE"); 11var_dump(bin2hex(mb_strcut("\x61\x00\x00\x00\x62\x00\x00\x00\x63\x00\x00\x00", 0, 32))); 12mb_internal_encoding("UCS-4BE"); 13var_dump(bin2hex(mb_strcut("\x00\x00\x00\x61\x00\x00\x00\x62\x00\x00\x00\x63", 0, 32))); 14mb_internal_encoding("UCS-2LE"); 15var_dump(bin2hex(mb_strcut("\x61\x00\x62\x00\x63\x00", 0, 32))); 16mb_internal_encoding("UCS-2BE"); 17var_dump(bin2hex(mb_strcut("\x00\x61\x00\x62\x00\x63", 0, 32))); 18mb_internal_encoding("UTF-16"); 19var_dump(bin2hex(mb_strcut("\x00\x61\x00\x62\x00\x63", 0, 32))); 20mb_internal_encoding("UTF-8"); 21var_dump(bin2hex(mb_strcut("abc", 0, 32))); 22mb_internal_encoding("ISO-8859-1"); 23var_dump(bin2hex(mb_strcut("abc", 0, 32))); 24--EXPECT-- 25string(24) "610000006200000063000000" 26string(24) "000000610000006200000063" 27string(12) "610062006300" 28string(12) "006100620063" 29string(12) "006100620063" 30string(6) "616263" 31string(6) "616263" 32