Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-3206

Variant converts from negative number in string format to unsigned integer without error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8, 0.10
    • 0.11
    • C++ Broker, C++ Client
    • None

    Description

      E.g.
      uint16_t i = 0;
      qpid::types::Variant v = "-5";
      i = v;

      The above results in an exception in older versions of gcc (e.g. 4.1.2) but sets i to 65531 on later versions (e.g. 4.4.4). This is a result of a fix to the gcc std library to be compliant with specification which requires stringstream to accept negative values even for unsigned ints (which is the behaviour of scanf).

      See e.g:
      http://boost.2283326.n4.nabble.com/conversion-lexical-cast-doesn-t-throw-td2593967.html
      http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/97475b21515462c9/ce369a327fa39243#ce369a327fa39243

      Attachments

        Activity

          People

            gsim Gordon Sim
            gsim Gordon Sim
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: