# HG changeset patch # User Kenichi Handa # Date 1200050925 0 # Node ID df9e1c6631621e3126cde9b9a031d2ffbf793697 # Parent a3cca415f9e68f9437a7b20a27c96c6423e2f016 (detect_coding_mask): Fix previous change. diff -r a3cca415f9e6 -r df9e1c663162 src/coding.c --- a/src/coding.c Fri Jan 11 09:59:48 2008 +0000 +++ b/src/coding.c Fri Jan 11 11:28:45 2008 +0000 @@ -4153,12 +4153,16 @@ label_loop_detect_coding: null_byte_found = 0; - while (src < src_end && ascii_skip_code[*src]) + /* We stop this loop before the last byte because it may be a NULL + anchor byte. */ + while (src < src_end - 1 && ascii_skip_code[*src]) null_byte_found |= (! *src++); - if (! null_byte_found) + if (ascii_skip_code[*src]) + src++; + else if (! null_byte_found) { unsigned char *p = src + 1; - while (p < src_end) + while (p < src_end - 1) null_byte_found |= (! *p++); } *skip = src - source;