Skip to content

Commit

Permalink
eg-sampler: Fix segfault on old_sample null deref
Browse files Browse the repository at this point in the history
Fixes a segmentation fault in eg-sampler when a sample is loaded for the first
time. Dereferencing old_sample->path causes the NULL pointer segfault.

Resolved by always simplifying code to always write_set_file,
even if the filename is the same.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
  • Loading branch information
harryhaaren authored and drobilla committed May 21, 2018
1 parent fc33234 commit dc9ff12
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions plugins/eg-sampler.lv2/sampler.c
Expand Up @@ -220,13 +220,11 @@ work_response(LV2_Handle instance,
old_sample };
self->schedule->schedule_work(self->schedule->handle, sizeof(msg), &msg);

if (strcmp(old_sample->path, new_sample->path)) {
// Send a notification that we're using a new sample
lv2_atom_forge_frame_time(&self->forge, self->frame_offset);
write_set_file(&self->forge, &self->uris,
new_sample->path,
new_sample->path_len);
}
// Send a notification that we're using a new sample
lv2_atom_forge_frame_time(&self->forge, self->frame_offset);
write_set_file(&self->forge, &self->uris,
new_sample->path,
new_sample->path_len);

return LV2_WORKER_SUCCESS;
}
Expand Down

0 comments on commit dc9ff12

Please sign in to comment.