Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings with Valgrind #401

Closed
thibaultmeyer opened this issue Jan 29, 2018 · 1 comment
Closed

Warnings with Valgrind #401

thibaultmeyer opened this issue Jan 29, 2018 · 1 comment

Comments

@thibaultmeyer
Copy link

thibaultmeyer commented Jan 29, 2018

Hello,

I have some warnings from json-c.

==3937== Conditional jump or move depends on uninitialised value(s)
==3937==    at 0x4C2CA68: __strlen_sse42 (vg_replace_strmem.c:458)
==3937==    by 0x4E3AC47: json_tokener_parse_ex (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C6D6: json_tokener_parse_verbose (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C73D: json_tokener_parse (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x40298D: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x401F63: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x40204B: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x5062C04: (below main) (in /usr/lib64/libc-2.17.so)
==3937==
==3937== Use of uninitialised value of size 8
==3937==    at 0x4E3B61D: json_tokener_parse_ex (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C6D6: json_tokener_parse_verbose (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C73D: json_tokener_parse (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x40298D: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x401F63: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x40204B: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x5062C04: (below main) (in /usr/lib64/libc-2.17.so)
==3937==
==3937== Conditional jump or move depends on uninitialised value(s)
==3937==    at 0x4E3B62A: json_tokener_parse_ex (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C6D6: json_tokener_parse_verbose (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C73D: json_tokener_parse (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x40298D: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x401F63: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x40204B: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x5062C04: (below main) (in /usr/lib64/libc-2.17.so)
==3937==
==3937== Conditional jump or move depends on uninitialised value(s)
==3937==    at 0x4E3AB7C: json_tokener_parse_ex (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C6D6: json_tokener_parse_verbose (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x4E3C73D: json_tokener_parse (in /usr/lib64/libjson-c.so.2.0.1)
==3937==    by 0x40298D: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x401F63: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x40204B: ??? (in /tmp/sd/build/s5miner)
==3937==    by 0x5062C04: (below main) (in /usr/lib64/libc-2.17.so)
==3937==
@hawicz
Copy link
Member

hawicz commented Feb 1, 2018

There's only one place where json_tokener_parse_ex() calls strlen(), and it does so on the passed in string.
https://github.com/json-c/json-c/blob/json-c-0.13/json_tokener.c#L259

If you're getting valgrind errors about uninitialized errors there, then that's almost certainly your error: you haven't nul terminated the string.

@hawicz hawicz closed this as completed Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants