From f6330ab8f137871f786fc72a7700b54da21f0603 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Fri, 22 Apr 2016 11:26:47 -0700 Subject: [PATCH] Fixed SkipByteOrderMark advancing cursor_ too early. Change-Id: Ie60f01d935ca6b4aa6ce0eab7598602ac0758342 Tested: on Linux. --- src/idl_parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 4c7820933..28aa0835d 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -205,8 +205,10 @@ CheckedError Parser::ParseHexNum(int nibbles, int64_t *val) { CheckedError Parser::SkipByteOrderMark() { if (static_cast(*cursor_) != 0xef) return NoError(); cursor_++; - if (static_cast(*cursor_++) != 0xbb) return Error("invalid utf-8 byte order mark"); - if (static_cast(*cursor_++) != 0xbf) return Error("invalid utf-8 byte order mark"); + if (static_cast(*cursor_) != 0xbb) return Error("invalid utf-8 byte order mark"); + cursor_++; + if (static_cast(*cursor_) != 0xbf) return Error("invalid utf-8 byte order mark"); + cursor_++; return NoError(); }