Skip to content

Commit

Permalink
Merge pull request robotology#2981 from randaz81/wav_files_fix
Browse files Browse the repository at this point in the history
wav files fix
  • Loading branch information
randaz81 authored Jun 28, 2023
2 parents 2066034 + 666f1f0 commit 99f5a8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/release/yarp_3_8/wav_files_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
wav_files_fix {#yarp-3.8}
---

#### `lib_YARP_sig`

* Fixed segfault when reading a mono .wav file from disk in `SoundFileWav.cpp`
4 changes: 2 additions & 2 deletions src/libYARP_sig/src/yarp/sig/SoundFileWav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ bool PcmWavHeader::parse_from_file(FILE *fp)
{
yCError(SOUNDFILE_WAV, "extra_size = %d\n", extra_size);
pcmExtraData.allocate(extra_size);
ret = fread(&pcmExtraData, extra_size, 1, fp);
ret = fread(pcmExtraData.get(), extra_size, 1, fp);
if (ret != 1) {
yCError(SOUNDFILE_WAV, "failed to read .wav file");
return false;
Expand All @@ -166,7 +166,7 @@ bool PcmWavHeader::parse_from_file(FILE *fp)
}
dummyData.clear();
dummyData.allocate(dummyLength);
ret = fread(&dummyData, dummyLength, 1, fp);
ret = fread(dummyData.get(), dummyLength, 1, fp);
if (ret != 1) {
yCError(SOUNDFILE_WAV, "failed to read .wav file");
return false;
Expand Down

0 comments on commit 99f5a8a

Please sign in to comment.