[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#804102: marked as done (Undefined Behavior in .../include/c++/4.9/bits/ios_base.h)



Your message dated Fri, 27 Nov 2015 02:45:11 +0100
with message-id <5657B5A7.3030802@debian.org>
and subject line Re: Bug#804102: Update on host/platform configuration
has caused the Debian Bug report #804102,
regarding Undefined Behavior in .../include/c++/4.9/bits/ios_base.h
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
804102: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804102
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libstdc++6
Source: gcc-4.9
Version: 4.9.2-10

**********

I believe the fix is to cast from an Ios_Fmtflags to an unsigned type,
perform the bit operations, and then cast back to a Ios_Fmtflags
before returning it.

I recall seeing this one in some Apple headers. Also see
http://lists.llvm.org/pipermail/cfe-dev/2015-January/040945.html .

**********

$ cat tt.cxx
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
  cout << std::hex << argc << std::dec << argc << endl;
  return 0;
}

$ clang++ -fsanitize=undefined tt.cxx -o tt.exe

$ ./tt.exe
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/ios_base.h:96:24:
runtime error: load of value 4294967221, which is not a valid value
for type 'std::_Ios_Fmtflags'
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/ios_base.h:76:67:
runtime error: load of value 4294967221, which is not a valid value
for type 'std::_Ios_Fmtflags'
...

**********

$ apt-cache show libstdc++
Package: libstdc++6
Source: gcc-4.9
Version: 4.9.2-10
Installed-Size: 1319
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Architecture: amd64
Replaces: libstdc++6-4.9-dbg (<< 4.9.0-3)
Depends: gcc-4.9-base (= 4.9.2-10), libc6 (>= 2.18), libgcc1 (>= 1:4.1.1)
Pre-Depends: multiarch-support
Conflicts: scim (<< 1.4.2-1)
Breaks: gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<< 4.4.6-4), gcc-4.5 (<< 4.5.3-2)
Description-en: GNU Standard C++ Library v3
 This package contains an additional runtime library for C++ programs
 built with the GNU compiler.
 .
 libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which
 was included up to g++-2.95. The first version of libstdc++-v3 appeared
 in g++-3.0.
Description-md5: 724ab84919e0e220afb960e36463914d
Multi-Arch: same
Homepage: http://gcc.gnu.org/
Tag: implemented-in::c++, role::shared-lib
Section: libs
Priority: important
Filename: pool/main/g/gcc-4.9/libstdc++6_4.9.2-10_amd64.deb
Size: 272946
MD5sum: 391ae724457378c71fb16fb5d8eb232c
SHA1: 234c8593643d0e3bcfd36302f48edeaa4ca01fe5
SHA256: f1509bbabd78e89c861de16931aec5988e1215649688fd4f8dfe1af875a7fbef

--- End Message ---
--- Begin Message ---
Control: 4.9.3-6

fixed.

--- End Message ---

Reply to: