Skip to content

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

Description

@R3x

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
			}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions