xunzhang / gflags

Automatically exported from code.google.com/p/gflags
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Crash in windows, when string flag longer then default value. #60

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define flag as: DEFINE_string(LogPath, "..\\..\\..\\logs", "The path to save 
log files.");
2. Run as: <program_name>.exe --LogPath="..\\..\\..\\logs\\1"
3. Program crashed at gflags.cc:441 void FlagValue::CopyFrom(const FlagValue& x)

What is the expected output? What do you see instead?
No crash

What version of the product are you using? On what operating system?
gflags 2.0, VS 2008

Please provide any additional information below.

Original issue reported on code.google.com by zhangpei...@gmail.com on 1 Nov 2012 at 1:53

GoogleCodeExporter commented 9 years ago
In new test, program crashed even the string length is 1.
crash reason is x.value_buffer_ can not cast to string.
How to fix it?

Original comment by zhangpei...@gmail.com on 1 Nov 2012 at 2:17

GoogleCodeExporter commented 9 years ago
I created an empty project, just defined some flags.
It works fine.

Original comment by zhangpei...@gmail.com on 1 Nov 2012 at 2:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
glog can not used with gflags?

Original comment by zhangpei...@gmail.com on 1 Nov 2012 at 3:19

GoogleCodeExporter commented 9 years ago
Debug version is fine, Release version crash always.
Linux is OK?

Original comment by zhangpei...@gmail.com on 1 Nov 2012 at 4:01

GoogleCodeExporter commented 9 years ago
I had such crash while using DEFINE_string. 
The crash was caused by linking libgflags-debug.lib while building Release 
version.
After changing to libgflags.lib the crash disappeared.

Original comment by y...@longshortway.com on 31 Oct 2013 at 6:11

GoogleCodeExporter commented 9 years ago
I presume yuri is right and the problem was simply linking incompatible 
binaries. Before the v2.2 release, I will make sure to add unit tests for this 
scenario.

Original comment by andreas....@gmail.com on 20 Mar 2014 at 3:46

GoogleCodeExporter commented 9 years ago

Original comment by andreas....@gmail.com on 20 Mar 2014 at 4:03