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

Uninitialized Memory access due to fread return value being ignored. #32

Open
R3x opened this issue Feb 17, 2024 · 0 comments
Open

Uninitialized Memory access due to fread return value being ignored. #32

R3x opened this issue Feb 17, 2024 · 0 comments
Assignees

Comments

@R3x
Copy link

R3x commented Feb 17, 2024

GetByteStr returns -1 on error, However this return value is ignored wherever the GetByteStr is called.

This leads to the buffer being uninitialized, which leads to incorrect control flow in the application.

For example, in GetGifWord, the byte buffer will be uninitialized.

			if(--context->restbyte == 0) {
				context->restbyte = GetByte(i->parent);
#if defined(DEBUG) && !defined(NGIFLIB_NO_FILE)
				if(i->parent->log) fprintf(i->parent->log, "restbyte = %02X\n", context->restbyte);
#endif /* defined(DEBUG) && !defined(NGIFLIB_NO_FILE) */
				GetByteStr(i->parent, context->byte_buffer, context->restbyte); <- return value ignored
				context->srcbyte = context->byte_buffer; <- buffer reused
			}
@miniupnp miniupnp self-assigned this Feb 19, 2024
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