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
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