diff options
Diffstat (limited to 'fs/udf/unicode.c')
| -rw-r--r-- | fs/udf/unicode.c | 6 | 
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index f897e55f2cd0..16a8ad21b77e 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c @@ -28,6 +28,9 @@  #include "udf_sb.h" +#define SURROGATE_MASK 0xfffff800 +#define SURROGATE_PAIR 0x0000d800 +  static int udf_uni2char_utf8(wchar_t uni,  			     unsigned char *out,  			     int boundlen) @@ -37,6 +40,9 @@ static int udf_uni2char_utf8(wchar_t uni,  	if (boundlen <= 0)  		return -ENAMETOOLONG; +	if ((uni & SURROGATE_MASK) == SURROGATE_PAIR) +		return -EINVAL; +  	if (uni < 0x80) {  		out[u_len++] = (unsigned char)uni;  	} else if (uni < 0x800) {  | 
