pvs-studio: Fix various static analysis warnings

Keeping this initial set of fixes to a few with relatively low footprint.

None of the errors fixed here represented reachable undefined behavior, except possibly an off-by-one in the llvm-nm parser (but I do not think the tool would ever output such a line as to trigger it). However, fixing these allows us to enable the relevant error codes to prevent future bugs of this sort from leaking through.

Merge request reports

Loading