Skip to content

Fix file pointer not initialized in rnnoise_model_from_buffer #270

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

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

Conversation

henkelmax
Copy link

@henkelmax henkelmax commented Aug 10, 2025

This causes the null check in rnnoise_model_free to be not NULL when creating a model using rnnoise_model_from_buffer and thus trying to close a file handle that does not exist.

rnnoise/src/denoise.c

Lines 236 to 241 in 70f1d25

RNNModel *model;
model = malloc(sizeof(*model));
model->blob = NULL;
model->const_blob = ptr;
model->blob_len = len;
return model;

if (model->file != NULL) fclose(model->file);

@orvitpng
Copy link

orvitpng commented Aug 11, 2025

Patch looks good to me. On a related note: rnnoise_model_from_filename seems to have a similar issue, calling rnnoise_model_from_file without guarding against fopen failure. If f == NULL, fseek is UB. Do we really even need a *_from_filename in this API? I'd prefer if path resolution, error handling, etc is left to the caller.

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.

2 participants