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

avoid slice bounds out of range of LooksLikeFormat function #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pic4xiu
Copy link

@pic4xiu pic4xiu commented Jul 22, 2023

When we use a "picture" that is smaller than the length of PngSignature, the index is out of bounds due to the direct use of the index in the LooksLikeFormat function:

func (pmp *PngMediaParser) LooksLikeFormat(data []byte) bool {
	return bytes.Compare(data[:len(PngSignature)], PngSignature[:]) == 0
	// len(data) is smaller than len(PngSignature)
}

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.

1 participant