Bug 402395 - coregrind/vgdb-invoker-solaris.c: 2 * poor error checking ?
Summary: coregrind/vgdb-invoker-solaris.c: 2 * poor error checking ?
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.15 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-20 22:15 UTC by dcb314
Modified: 2018-12-23 14:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dcb314 2018-12-20 22:15:29 UTC
SUMMARY

1.

[valgrind/coregrind/vgdb-invoker-solaris.c:177]: (style) Checking if unsigned variable 'bytes' is less than zero.

  bytes = read(status_fd, &pstatus, sizeof(pstatus));
   if ((bytes < 0) || (bytes != sizeof(pstatus))) {

but

  size_t bytes = sizeof(ctl.cmd) + sizeof(ctl.arg.flags);

The return type of read is ssize_t, not size_t, isn't it ?

2.

[valgrind/coregrind/vgdb-invoker-solaris.c:404]: (style) Checking if unsigned variable 'bytes' is less than zero.

Duplicate.
                                  
STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Philippe Waroquiers 2018-12-23 14:13:30 UTC
Fix done in 59f0855049a1.
However, I do not have access to a Solaris system, so maybe the
result does not even compile :).

Please verify and re-open in case the fix is wrong.

Thanks for reporting the bug.