certik / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

memory corruption reading a node #195

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. YAML::Node file = YAML::LoadFile("file.yml");
2. file["Buttons"]["Start"]["Text Color"]["Red"].as<float>();

What is the expected output? What do you see instead?
Expected to get 0, but it crashes the program with
*** glibc detected *** /home/eric/git/Shoppe/Debug/Shoppe: malloc(): memory 
corruption (fast): 0x00000000007ab640 ***

What version of the product are you using? On what operating system?
0.5.0, ubuntu linux x64_86

Please provide any additional information below.
if I do .as<string>() it prints 0.0 correctly, so it seems to be a problem with 
.as<float>(). .as<double> and .as<int> all give me the same crash, I really 
don't know what I've done wrong, but I assume that the program crashing with 
memory corruption is not the library's intended behavior (gdb cannot even 
recover the stack trace).

Original issue reported on code.google.com by bour...@gmail.com on 10 Mar 2013 at 5:46

GoogleCodeExporter commented 9 years ago
whoops, this actually turned out to be a bug in gcc, and not this library at 
all. Sorry about that.

Original comment by bour...@gmail.com on 10 Mar 2013 at 6:06

GoogleCodeExporter commented 9 years ago
I'm really curious - what version of gcc, and what's your example YAML file? 
How'd you find out that it's a bug in gcc and not in the library?  (I love 
compiler bugs!)

Original comment by jbe...@gmail.com on 11 Mar 2013 at 3:05

GoogleCodeExporter commented 9 years ago
Honestly... I'm not skilled enough to give very insightful answers. I'm
writing a game and decided to use YAML for the data files, and I've
attached the file that caused the issue. As you can see it's a pretty
simple use case. I'm using gcc 4.7.2. In desperation I deleted all my .o
files and binaries and rebuilt, and then it was fine! I guess something got
corrupted somehow, but what went wrong is beyond me.

Original comment by bour...@gmail.com on 11 Mar 2013 at 3:47

GoogleCodeExporter commented 9 years ago
OK, thanks for the info.

Original comment by jbe...@gmail.com on 11 Mar 2013 at 1:03