Uploaded image for project: 'ActiveMQ C++ Client'
  1. ActiveMQ C++ Client
  2. AMQCPP-235

UTF8 length marshalling bug in openwire readString and writeString.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.2.6, 3.0
    • Openwire
    • None
    • Windows XP / Visual Studio 2005

    • Patch Available

    Description

      In investigating a bug for the check "if( str->size() > 65536 )" which should be "if( str->size() > 65535 )" in writeString() , I found a couple of other problems:
      (1) The OpenwireStringSupport::readString method should read the utf8 length as an unsigned short rather than short. The problem is that utf8 encoded strings (using writeString) longer than 32768 will become truncated when read back using readString().
      (2) The writeString() method should also check the value of utflen after determining the UTF8 length of the encoded string, since with the support of characters greater than value 127, encodings of 2 UTF8 bytes per byte can exist.

      Attachments

        1. OpenwireStringSupportTest.h.patch
          0.7 kB
          Martin Schlapfer
        2. OpenwireStringSupportTest.cpp.patch
          2 kB
          Martin Schlapfer
        3. OpenwireStringSupport.cpp.patch
          2 kB
          Martin Schlapfer

        Activity

          People

            tabish Timothy A. Bish
            mschlapf Martin Schlapfer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: