[Boost-bugs] [Boost C++ Libraries] #5086: Fix for possible assertion failure in MSVC isctype.c

Subject: [Boost-bugs] [Boost C++ Libraries] #5086: Fix for possible assertion failure in MSVC isctype.c
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-18 18:27:06


#5086: Fix for possible assertion failure in MSVC isctype.c
-------------------------------------------------------+--------------------
 Reporter: Kazutoshi Satoda <k_satoda@…> | Owner: jsiek
     Type: Patches | Status: new
Milestone: To Be Determined | Component: tokenizer
  Version: Boost 1.45.0 | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 Ticket #4791 about warning C6328 was closed as fixed. But in fact, the
 fix (r66855) only silenced the warning, not addressing the real problem
 indicated by the warning.

 The problem is explained [http://msdn.microsoft.com/en-
 us/library/ms245348.aspx here].
 In short: (for character classification functions in <cctype>)
> the valid range of values for its input argument is:
> 0 <= c <= 255, plus the special value EOF.
 Otherwise, the behavior is undefined. Thus, passing an user provided
 value of char (may be signed) can cause UB. The existing comment just
 above struct traits_extension addresses the same issue.

 Nothing was changed by the static_cast<int> introduced by the fix. It
 just expressed what the compiler implicitly does (integral promotion).

 Here is the patch to fix the real problem, including a test about the
 problem.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5086>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC