Avro
  1. Avro
  2. AVRO-968

Avro C - avro_value_cmp_fast() may return garbage value for AVRO_STRING comparison

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.1, 1.6.2, 1.7.0
    • Fix Version/s: 1.6.2, 1.7.0
    • Component/s: c
    • Labels:
      None
    • Environment:

      All. Currently using gcc 4.6.1 on Ubuntu 11.10.

    • Release Note:
      Fix uninitialized variable warning in value.c, by initializing the variables properly.

      Description

      Compiler shows a warning that variables may be used uninitialized in avro_value_cmp_fast():

      /home/user/avro-trunk/lang/c/src/value.c: In function 'avro_value_cmp_fast':
      /home/user/avro-trunk/lang/c/src/value.c:387:13: warning: 'size2' may be used uninitialized in this function [-Wuninitialized]
      /home/user/avro-trunk/lang/c/src/value.c:387:13: warning: 'size1' may be used uninitialized in this function [-Wuninitialized]
      /home/user/avro-trunk/lang/c/src/value.c:388:11: warning: 'buf1' may be used uninitialized in this function [-Wuninitialized]
      /home/user/avro-trunk/lang/c/src/value.c:388:11: warning: 'buf2' may be used uninitialized in this function [-Wuninitialized]

      Examining the file shows that the warnings are real, and the variables size1, buf1, size2, buf2 should be loaded before they are used. The simple fix is to copy matching code from the function avro_value_equal_fast(). I will attach that code in an upcoming patch.

      Cheers,
      Vivek

        Activity

        Vivek Nadkarni created issue -
        Vivek Nadkarni made changes -
        Field Original Value New Value
        Attachment AVRO-968.patch [ 12505846 ]
        Vivek Nadkarni made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Douglas Creager made changes -
        Douglas Creager made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Assignee Douglas Creager [ dcreager ]
        Resolution Fixed [ 1 ]
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Douglas Creager
            Reporter:
            Vivek Nadkarni
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 24h
              24h
              Remaining:
              Remaining Estimate - 24h
              24h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development