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

Fix stack overflow when reading buffer

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.13.0
    • Fix Version/s: 0.14.0
    • Component/s: C glib - Library
    • Labels:
      None
    • Flags:
      Patch

      Description

      Alloca() allocates memory on the stack. A stack overflow exception is generated if the space cannot be allocated.
      Use g_new0 instead of g_alloca.

      =================================================================
      ==lt-tutorial_client==24186==ERROR: AddressSanitizer: stack-overflow on address 0x7ffdcda0c1e8 (pc 0x7fef1f6eec74 bp 0x7ffdce40c2b0 sp 0x7ffdcda0c1f0 T0)
      #0 0x7fef1f6eec73 in thrift_buffered_transport_read_slow src/thrift/c_glib/transport/thrift_buffered_transport.c:82
      #1 0x7fef1f6ef2c2 in thrift_buffered_transport_read src/thrift/c_glib/transport/thrift_buffered_transport.c:152
      #2 0x7fef1f6e7a08 in thrift_transport_real_read_all src/thrift/c_glib/transport/thrift_transport.c:122
      #3 0x7fef1f6e78f1 in thrift_transport_read_all src/thrift/c_glib/transport/thrift_transport.c:92
      #4 0x7fef1f6dd2f6 in thrift_binary_protocol_read_string src/thrift/c_glib/protocol/thrift_binary_protocol.c:800
      #5 0x7fef1f6d444c in thrift_protocol_read_string src/thrift/c_glib/protocol/thrift_protocol.c:410
      #6 0x40cf1c in shared_struct_read gen-c_glib/shared_types.c:91
      #7 0x7fef1f6cf865 in thrift_struct_read src/thrift/c_glib/thrift_struct.c:30
      #8 0x40ad30 in shared_service_client_recv_get_struct gen-c_glib/shared_service.c:227
      #9 0x40b0b9 in shared_service_client_get_struct gen-c_glib/shared_service.c:268
      #10 0x402ead in main /mnt/hgfs/share/thrift-0.13.0/tutorial/c_glib/c_glib_client.c:163
      #11 0x7fef1e212872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872)
      #12 0x40269d in _start (/mnt/hgfs/share/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_client+0x40269d)

      SUMMARY: AddressSanitizer: stack-overflow src/thrift/c_glib/transport/thrift_buffered_transport.c:82 in thrift_buffered_transport_read_slow
      ==lt-tutorial_client==24186==ABORTING

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                wangyunjian wangyunjian
                Reporter:
                wangyunjian wangyunjian
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m