515183 Error occurred while executing the command
`valgrind --num-callers=1 ./hello_world`
515265 Add SSE4.1 BLENDPS and PBLENDW instruction for x86 32 bit
+515612 Sanity check VG_(realpath) and VG_(readlink) return values
To see details of a given bug, visit
SizeT VG_(data_size)(void)
{
- HChar resolved[1000];
- VG_(realpath)( VG_(args_the_exename), resolved);
-
- for (DebugInfo* di = debugInfo_list; di; di = di->next) {
- if (di->data_size && VG_(strcmp)(di->soname, "NONE") == 0 && VG_(strcmp)(resolved, di->fsm.filename) == 0) {
- return VG_PGROUNDUP(di->data_size);
+ HChar resolved[VKI_PATH_MAX];
+ if (VG_(realpath)( VG_(args_the_exename), resolved)) {
+ for (DebugInfo* di = debugInfo_list; di; di = di->next) {
+ if (di->data_size
+ && VG_(strcmp)(di->soname, "NONE") == 0
+ && VG_(strcmp)(resolved, di->fsm.filename) == 0) {
+ return VG_PGROUNDUP(di->data_size);
+ }
}
}
return 0U;
exe_name = interp_name;
}
HChar resolved_name[VKI_PATH_MAX];
- VG_(realpath)(exe_name, resolved_name);
- VG_(resolved_exename) = VG_(strdup)("initimg-darwin.scs.2", resolved_name);
+ if (VG_(realpath)(exe_name, resolved_name)) {
+ VG_(resolved_exename) = VG_(strdup)("initimg-darwin.scs.2", resolved_name);
+ } else {
+ /* This should not really happen. realpath tried and failed.
+ So lets just continue with the exe_name as is. */
+ VG_(resolved_exename) = VG_(strdup)("initimg-darwin.scs.3", exe_name);
+ }
}
/* client_SP is pointing at client's argc/argv */
exe_name = interp_name;
}
HChar resolved_name[VKI_PATH_MAX];
- VG_(realpath)(exe_name, resolved_name);
+ if (!VG_(realpath)(exe_name, resolved_name)) {
+ /* This should not really happen. realpath tried and failed.
+ So lets just continue with the exe_name as is. */
+ VG_(strcpy)(resolved_name, exe_name);
+ }
/* use our own auxv as a prototype */
orig_auxv = find_auxv(init_sp);
exe_name = interp_name;
}
HChar resolved_name[VKI_PATH_MAX];
- VG_(realpath)(exe_name, resolved_name);
- VG_(resolved_exename) = VG_(strdup)("initimg-linux.scs.1", resolved_name);
+ if (VG_(realpath)(exe_name, resolved_name)) {
+ VG_(resolved_exename) = VG_(strdup)("initimg-linux.scs.1", resolved_name);
+ } else {
+ /* This should not really happen. realpath tried and failed.
+ So lets just continue with the exe_name as is. */
+ VG_(resolved_exename) = VG_(strdup)("initimg-linux.scs.2", exe_name);
+ }
}
/* client_SP is pointing at client's argc/argv */
exe_name = interp_name;
}
HChar resolved_name[VKI_PATH_MAX];
- VG_(realpath)(exe_name, resolved_name);
- VG_(resolved_exename) = VG_(strdup)("initimg-solaris.lc.1", resolved_name);
+ if (VG_(realpath)(exe_name, resolved_name)) {
+ VG_(resolved_exename) = VG_(strdup)("initimg-solaris.lc.1", resolved_name);
+ } else {
+ /* This should not really happen. realpath tried and failed.
+ So lets just continue with the exe_name as is. */
+ VG_(resolved_exename) = VG_(strdup)("initimg-solaris.lc.2", exe_name);
+ }
}
/* Set initial brk values. */
if (VKI_S_ISLNK(statbuf.mode)) {
SizeT link_len = VG_(readlink)(path, tmp, VKI_PATH_MAX);
+ if (link_len < 0)
+ return False;
tmp[link_len] = '\0';
resolved_name = tmp;
} else {
#elif defined(VGO_freebsd)
res = VG_(do_syscall2)(__NR___getcwd, (UWord)wd, VKI_PATH_MAX);
#endif
+ if (sr_isError(res)) {
+ return False;
+ }
VG_(snprintf)(resolved, VKI_PATH_MAX, "%s/%s", wd, resolved_name);
} else {
VG_(snprintf)(resolved, VKI_PATH_MAX, "%s", resolved_name);