From: Sergei Trofimovich Date: Mon, 22 Oct 2018 22:05:56 +0000 (+0100) Subject: src/dfa/closure_posix.cc: fix pack() to drop two highest bits X-Git-Tag: 1.2~330^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F224%2Fhead;p=re2c src/dfa/closure_posix.cc: fix pack() to drop two highest bits ```c longest | (leftmost << 30); ``` assumes `longest` does not exceed 30 bits. It could if it's a negative value originally. Signed-off-by: Sergei Trofimovich --- diff --git a/re2c/src/dfa/closure_posix.cc b/re2c/src/dfa/closure_posix.cc index c33e7302..d110d73f 100644 --- a/re2c/src/dfa/closure_posix.cc +++ b/re2c/src/dfa/closure_posix.cc @@ -204,6 +204,7 @@ void orders(determ_context_t &ctx) static uint32_t pack_u32(uint32_t longest, uint32_t leftmost) { // leftmost: higher 2 bits, longest: lower 30 bits + longest &= ~0u >> 2; return longest | (leftmost << 30); }