mirror of
https://github.com/mborgerding/kissfft.git
synced 2026-08-30 22:07:01 -04:00
Fix Medium Severity Coverity finding:
CWE-252 (Ignoring number of bytes read) (https://cwe.mitre.org/data/definitions/252.html)
This commit is contained in:
+8
-1
@@ -26,9 +26,16 @@ void fft_file(FILE * fin,FILE * fout,int nfft,int isinverse)
|
|||||||
bufout = (kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx) * nfft );
|
bufout = (kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx) * nfft );
|
||||||
st = kiss_fft_alloc( nfft ,isinverse ,0,0);
|
st = kiss_fft_alloc( nfft ,isinverse ,0,0);
|
||||||
|
|
||||||
while ( fread( buf , sizeof(kiss_fft_cpx) * nfft ,1, fin ) > 0 ) {
|
while (1) {
|
||||||
|
size_t nread = fread(buf, sizeof(kiss_fft_cpx), nfft, fin);
|
||||||
|
if (nread == (size_t)nfft) {
|
||||||
kiss_fft( st , buf ,bufout);
|
kiss_fft( st , buf ,bufout);
|
||||||
fwrite( bufout , sizeof(kiss_fft_cpx) , nfft , fout );
|
fwrite( bufout , sizeof(kiss_fft_cpx) , nfft , fout );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (nread != 0)
|
||||||
|
fprintf(stderr,"short read on complex input\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
free(st);
|
free(st);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user