Skip to content

Conversation

@ardbiesheuvel
Copy link
Member

SafeIntLib is only safe if it is used correctly, and if it signals an overflow, the error must be handled, rather than limping on and using garbage data from the stack, as this may turn out to be more dangerous than using the overflowed value.

So initialize RelocBase to NULL as it will get tested even in case of overflow, and this will prevent it from being initialized as expected.

SafeIntLib is only safe if it is used correctly, and if it signals an
overflow, the error must be handled, rather than limping on and using
garbage data from the stack, as this may turn out to be more dangerous
than using the overflowed value.

So initialize RelocBase and RelocBaseEnd to NULL first, as it will get
tested even in case of overflow, and this will prevent it from being
initialized as expected.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
@ardbiesheuvel ardbiesheuvel force-pushed the mdepkg-pecofflib-fix-uninit-relocbase branch from 009b58c to ffdc267 Compare January 28, 2025 09:58
@mergify
Copy link

mergify bot commented Jan 28, 2025

PR can not be merged due to conflict. Please rebase and resubmit

@mdkinney
Copy link
Member

This appears to be a duplicate of PR #10689 and should be closed

@ardbiesheuvel ardbiesheuvel deleted the mdepkg-pecofflib-fix-uninit-relocbase branch January 28, 2025 22:58
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

Successfully merging this pull request may close these issues.

3 participants