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

Guard avifDiagnosticsClearError() in avif.c #1492

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

y-guyon
Copy link
Collaborator

@y-guyon y-guyon commented Aug 3, 2023

[skip ci]

src/avif.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have stated my preference. This pull request is one of two ways to make the two functions consistent about whether a null diag is allowed.

@joedrago The "calls to avifFileTypeIsCompatible()" part of the comment is incorrect. Joe, do you remember what you had in mind when you wrote it?

@y-guyon
Copy link
Collaborator Author

y-guyon commented Aug 4, 2023

@joedrago The "calls to avifFileTypeIsCompatible()" part of the comment is incorrect. Joe, do you remember what you had in mind when you wrote it?

It was about avifPeekCompatibleFileType() and its BEGIN_STREAM() called with NULL diag argument:

libavif/src/read.c

Lines 3196 to 3198 in 3e66456

avifBool avifPeekCompatibleFileType(const avifROData * input)
{
BEGIN_STREAM(s, input->data, input->size, NULL, NULL);

@y-guyon y-guyon merged commit 173961d into AOMediaCodec:main Aug 4, 2023
@joedrago
Copy link
Collaborator

joedrago commented Aug 4, 2023

My intent with avifFileTypeIsCompatible() was to be a very cheap way to peek into a buffer and see if it was likely to be an AVIF. If it internally creates an avifDiagnostics and throws away its value so that the entire codebase can assert that a diag pointer is never NULL, I think that is a good change.

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