Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVS-Studio errors #33

Open
ziggi opened this issue Sep 6, 2018 · 1 comment
Open

PVS-Studio errors #33

ziggi opened this issue Sep 6, 2018 · 1 comment

Comments

@ziggi
Copy link

ziggi commented Sep 6, 2018

This is possible mistakes given by PVS-Studio static analyzer. It may help with something?

===============64 bit (64)===============
  (1): error V004: Diagnostics from the 64-bit rule set are not entirely accurate without the appropriate 64-bit compiler. Consider utilizing 64-bit compiler if possible.
subhook\subhook_x86.c (372): error V104: Implicit conversion of 'reloc_op_offset' to memsize type in an arithmetic expression.
subhook\subhook_x86.c (251): error V112: Dangerous magic number 4 used: len += 4;...
subhook\subhook_x86.c (236): error V112: Dangerous magic number 4 used: len += 4;...
subhook\subhook_x86.c (225): error V112: Dangerous magic number 4 used: ...3 && rm == 4) {.
subhook\subhook_x86.c (493): error V104: Implicit conversion of 'maybe_jmp32->offset' to memsize type in an arithmetic expression: maybe_jmp32->offset + (uintptr_t) src
subhook\subhook_x86.c (164): error V112: Dangerous magic number 4 used: ...rand_size = 4;.
subhook\subhook_private.h (40): error V122: Memsize type is used in the struct/class.
subhook\subhook_private.h (47): error V122: Memsize type is used in the struct/class.
subhook\subhook_private.h (46): error V122: Memsize type is used in the struct/class.
subhook\subhook_private.h (45): error V122: Memsize type is used in the struct/class.
subhook\subhook_private.h (44): error V122: Memsize type is used in the struct/class.
subhook\subhook_private.h (43): error V122: Memsize type is used in the struct/class.
subhook\subhook_private.h (41): error V122: Memsize type is used in the struct/class.
subhook\subhook_x86.c (295): error V202: Explicit conversion from memsize type to 32-bit integer type.
subhook\subhook_x86.c (371): error V202: Explicit conversion from memsize type to 32-bit integer type: (int32_t)(trampoline_addr - src_addr)
subhook\subhook_x86.c (217): error V202: Explicit conversion from memsize type to 32-bit integer type: (int32_t) len

===============General Analysis (GA)===============
subhook\subhook_x86.c (47): error V677: Custom declaration of a standard 'uintptr_t' type. The system header file should be used: #include <STDDEF.H>.
subhook\subhook_x86.c (290): error V560: A part of conditional expression is always false: distance < (- 0x7fffffff - 1).
subhook\subhook_x86.c (290): error V560: A part of conditional expression is always false: distance > 0x7fffffff.
subhook\subhook_x86.c (46): error V677: Custom declaration of a standard 'intptr_t' type. The system header file should be used: #include <STDDEF.H>.

@Zeex
Copy link
Owner

Zeex commented Sep 6, 2018

Most of these warnings seem like noise (especially ones about "dangerous magic number"). But these need investigation:

subhook\subhook_x86.c (290): error V560: A part of conditional expression is always false: distance < (- 0x7fffffff - 1).
subhook\subhook_x86.c (290): error V560: A part of conditional expression is always false: distance > 0x7fffffff.

I will look into them

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants