Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1057

casts in TBinaryProtocol.tcc causing "dereferencing type-punned pointer will break strict-aliasing rules" warnings from gcc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7
    • 0.7
    • C++ - Library
    • None
    • Patch Available

    Description

      Code is doing things like:

      uint8_t b[2];
      uint16_t val;
      
      val = *(int16_t*)b;
      

      Due to aliasing there isn't a guarantee that b[] will be placed on a 16 bit boundary.

      Fix is to use unions to ensure alignment. Patch attached.

      Attachments

        Activity

          People

            clavoie Christian Lavoie
            chmorgan Chris Morgan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: