From b5bcbcba4f6b3e7bd5fccaee788ffce43b5cf7ae Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Wed, 26 Apr 2006 20:51:54 +0000 Subject: [PATCH] Fixed a rare memory corruption bug in the Wave Re2C scanner buffer management code. [SVN r33831] --- ChangeLog | 1 + src/cpplexer/re2clex/cpp_re.cpp | 6 +++--- src/cpplexer/re2clex/cpp_re.inc | 2 +- src/cpplexer/re2clex/strict_cpp_re.inc | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef58a79..21e23bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -100,6 +100,7 @@ Boost V1.34.0 - Fixed the macro tracing information to contain the column numbers of the macro definitions as well (the format used is the same as for error messages). - Fixed a memory leak in the flex_string copy on write code. +- Fixed a memory corruption bug in the Re2C scanner buffer management code. Sat Feb 18 2005 - Version 1.2.3 diff --git a/src/cpplexer/re2clex/cpp_re.cpp b/src/cpplexer/re2clex/cpp_re.cpp index cc22969..869fbcd 100644 --- a/src/cpplexer/re2clex/cpp_re.cpp +++ b/src/cpplexer/re2clex/cpp_re.cpp @@ -194,7 +194,7 @@ uchar *fill(Scanner *s, uchar *cursor) { if (NULL == s->lim) s->lim = s->top; - memcpy(s->bot, s->tok, s->lim - s->tok); + memmove(s->bot, s->tok, s->lim - s->tok); s->tok = s->cur = s->bot; s->ptr -= cnt; cursor -= cnt; @@ -218,7 +218,7 @@ uchar *fill(Scanner *s, uchar *cursor) return cursor; } - memcpy(buf, s->tok, s->lim - s->tok); + memmove(buf, s->tok, s->lim - s->tok); s->tok = s->cur = buf; s->ptr = &buf[s->ptr - s->bot]; cursor = &buf[cursor - s->bot]; @@ -238,7 +238,7 @@ uchar *fill(Scanner *s, uchar *cursor) cnt = s->last - s->act; if (cnt > BOOST_WAVE_BSIZE) cnt = BOOST_WAVE_BSIZE; - memcpy(s->lim, s->act, cnt); + memmove(s->lim, s->act, cnt); s->act += cnt; if (cnt != BOOST_WAVE_BSIZE) { diff --git a/src/cpplexer/re2clex/cpp_re.inc b/src/cpplexer/re2clex/cpp_re.inc index a6abde7..5411883 100644 --- a/src/cpplexer/re2clex/cpp_re.inc +++ b/src/cpplexer/re2clex/cpp_re.inc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.10.0 on Mon Mar 20 11:46:13 2006 */ +/* Generated by re2c 0.10.0 on Wed Apr 26 15:42:21 2006 */ #line 1 "cpp.re" /*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library diff --git a/src/cpplexer/re2clex/strict_cpp_re.inc b/src/cpplexer/re2clex/strict_cpp_re.inc index 7e53cb0..3e73407 100644 --- a/src/cpplexer/re2clex/strict_cpp_re.inc +++ b/src/cpplexer/re2clex/strict_cpp_re.inc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.10.0 on Mon Mar 20 11:46:13 2006 */ +/* Generated by re2c 0.10.0 on Wed Apr 26 15:42:21 2006 */ #line 1 "strict_cpp.re" /*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library