mirror of
https://github.com/google/liblc3.git
synced 2026-05-29 16:15:50 +00:00
tools: Fix malformed skip of LC3 binary header
This commit is contained in:
+3
-2
@@ -48,7 +48,8 @@ int lc3bin_read_header(FILE *fp,
|
|||||||
struct lc3bin_header hdr;
|
struct lc3bin_header hdr;
|
||||||
|
|
||||||
if (fread(&hdr, sizeof(hdr), 1, fp) != 1
|
if (fread(&hdr, sizeof(hdr), 1, fp) != 1
|
||||||
|| hdr.file_id != LC3_FILE_ID)
|
|| hdr.file_id != LC3_FILE_ID
|
||||||
|
|| hdr.header_size < sizeof(hdr))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
*nchannels = hdr.channels;
|
*nchannels = hdr.channels;
|
||||||
@@ -56,7 +57,7 @@ int lc3bin_read_header(FILE *fp,
|
|||||||
*srate_hz = hdr.srate_100hz * 100;
|
*srate_hz = hdr.srate_100hz * 100;
|
||||||
*nsamples = hdr.nsamples_low | (hdr.nsamples_high << 16);
|
*nsamples = hdr.nsamples_low | (hdr.nsamples_high << 16);
|
||||||
|
|
||||||
fseek(fp, SEEK_SET, hdr.header_size);
|
fseek(fp, hdr.header_size, SEEK_SET);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user