From: Erik de Castro Lopo Date: Sun, 16 Apr 2017 07:54:17 +0000 (+1000) Subject: src/rf64.c: Fix varargs related bug X-Git-Tag: accepted/tizen/4.0/unified/20171219.072304~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3c845ca9054436333981cc034842e379de9ad87;p=platform%2Fupstream%2Flibsndfile.git src/rf64.c: Fix varargs related bug C's functionality isn't type checked so that passing an `sf_count_t` (64 bits) by mistake in place of a `unit32_t` can cause errors. This would be fine if it was an error on every architecture and platform, but its not. This particular problem only manifested on armhf and some other Arm architectures. It was not an issue on 32 bit x86. I have now fixed variants of this same bug several times. Change-Id: Ie0024ce14affeb6034071aa80c339da915f8b7e1 Closes: https://github.com/erikd/libsndfile/issues/229 --- diff --git a/src/rf64.c b/src/rf64.c index c373bb0..a42d474 100644 --- a/src/rf64.c +++ b/src/rf64.c @@ -737,7 +737,7 @@ rf64_write_header (SF_PRIVATE *psf, int calc_length) pad_size = psf->dataoffset - 16 - psf->header.indx ; if (pad_size >= 0) - psf_binheader_writef (psf, "m4z", PAD_MARKER, pad_size, make_size_t (pad_size)) ; + psf_binheader_writef (psf, "m4z", PAD_MARKER, (unsigned int) pad_size, make_size_t (pad_size)) ; if (wpriv->rf64_downgrade && (psf->filelength < RIFF_DOWNGRADE_BYTES)) psf_binheader_writef (psf, "tm8", data_MARKER, psf->datalength) ;