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

Uninitialized format in error_test #209

Closed
yugr opened this issue Mar 21, 2017 · 1 comment
Closed

Uninitialized format in error_test #209

yugr opened this issue Mar 21, 2017 · 1 comment
Milestone

Comments

@yugr
Copy link

yugr commented Mar 21, 2017

error_value_test function in error_test.c does not zero-initialize sfinfo.format field before passing it to sf_open:

SF_INFO sfinfo ;
...
file = sf_open (filename, SFM_READ, &sfinfo) ;

This later triggeres uninitialized read in psf_open_file:

if (psf->file.mode == SFM_READ)
{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)

Valgrind report is

==22949== Conditional jump or move depends on uninitialised value(s)
==22949==    at 0x524E82D: psf_open_file (/build/libsndfile-1.0.25/src/sndfile.c:2591)
==22949==    by 0x40186E: error_value_test (/build/libsndfile-1.0.25/tests/error_test.c:86)
==22949==    by 0x40186E: main (/build/libsndfile-1.0.25/tests/error_test.c:236)

The issue has been found using Valgrind and debian_pkg_test.

@erikd erikd closed this as completed in 8dc7478 Mar 21, 2017
@erikd
Copy link
Member

erikd commented Mar 21, 2017

Thanks!

@evpobr evpobr added this to the v1.0.28 milestone Mar 26, 2017
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

No branches or pull requests

3 participants