avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Douglas Creager (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-968) Avro C - avro_value_cmp_fast() may return garbage value for AVRO_STRING comparison
Date Tue, 13 Dec 2011 19:54:30 GMT

    [ https://issues.apache.org/jira/browse/AVRO-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13168656#comment-13168656
] 

Douglas Creager commented on AVRO-968:
--------------------------------------

Also, there is a difference between _cmp and _equal.  You can't do an arbitrary comparison
of map values using _cmp or _cmp_fast, since the spec doesn't define a sort order for them.
 But you can compare them for equality, by checking that the set of keys is identical, and
that each key maps to equal values.

That said, there's still some refactoring that we could do there.
                
> Avro C - avro_value_cmp_fast() may return garbage value for AVRO_STRING comparison
> ----------------------------------------------------------------------------------
>
>                 Key: AVRO-968
>                 URL: https://issues.apache.org/jira/browse/AVRO-968
>             Project: Avro
>          Issue Type: Bug
>          Components: c
>    Affects Versions: 1.6.1, 1.6.2, 1.7.0
>         Environment: All. Currently using gcc 4.6.1 on Ubuntu 11.10.
>            Reporter: Vivek Nadkarni
>            Priority: Minor
>             Fix For: 1.6.2, 1.7.0
>
>         Attachments: 0001-AVRO-968.-C-Fixed-avro_value_cmp-on-string-values.patch, AVRO-968.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message