rnnoise icon indicating copy to clipboard operation
rnnoise copied to clipboard

Fix file pointer not initialized in rnnoise_model_from_buffer

Open henkelmax opened this issue 4 months ago • 1 comments

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.

https://github.com/xiph/rnnoise/blob/70f1d256acd4b34a572f999a05c87bf00b67730d/src/denoise.c#L236-L241

https://github.com/xiph/rnnoise/blob/70f1d256acd4b34a572f999a05c87bf00b67730d/src/denoise.c#L272

henkelmax avatar Aug 10 '25 20:08 henkelmax

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.

orvitpng avatar Aug 11 '25 10:08 orvitpng