]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix decoding DOS EOL in a unibyte buffer
authorEli Zaretskii <eliz@gnu.org>
Wed, 17 Feb 2016 15:48:30 +0000 (17:48 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 17 Feb 2016 15:48:30 +0000 (17:48 +0200)
* src/coding.c (decode_eol): Loop over bytes, not characters.
(Bug#5251)

src/coding.c

index 3bee16c4f0ca8ff1ac617068ffd44773cbc6b65c..e591bedc3e5bed8bd227b6b4fcf919cf9657f349 100644 (file)
@@ -6828,11 +6828,11 @@ decode_eol (struct coding_system *coding)
        }
       else
        {
-         ptrdiff_t pos_byte = coding->dst_pos_byte;
          ptrdiff_t pos = coding->dst_pos;
-         ptrdiff_t pos_end = pos + coding->produced_char - 1;
+         ptrdiff_t pos_byte = coding->dst_pos_byte;
+         ptrdiff_t pos_end = pos_byte + coding->produced - 1;
 
-         while (pos < pos_end)
+         while (pos_byte < pos_end)
            {
              p = BYTE_POS_ADDR (pos_byte);
              if (*p == '\r' && p[1] == '\n')