ext/alsa/gstalsasink.c: Fix for integer overflow. Makes #156001 not crash. Probably masks the real bug.

Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
Fix for integer overflow. Makes #156001 not crash. Probably masks
the real bug.
This commit is contained in:
Ronald S. Bultje 2004-12-18 15:09:27 +00:00
parent d49b1dbf6c
commit 62787bcd62
2 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2004-12-18 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
Fix for integer overflow. Makes #156001 not crash. Probably masks
the real bug.
2004-12-17 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/ac3parse/gstac3parse.c: (plugin_init):

View file

@ -440,9 +440,15 @@ sink_restart:
/* there are empty samples in front of us, fill them with silence */
int samples = MIN (bytes, sample_diff) *
(element->numpads == 1 ? this->format->channels : 1);
int size =
samples * snd_pcm_format_physical_width (this->format->format) /
8;
int width = snd_pcm_format_physical_width (this->format->format);
int size = samples * width / 8;
if (size / (width / 8) != samples) {
GST_WARNING_OBJECT (this,
"Integer overflow for size=%d/samples=%d - broken stream",
size, samples);
goto no_difference;
}
GST_INFO_OBJECT (this,
"Allocating %d bytes (%ld samples) now to resync: sample %lu expected, but got %ld",
size, MIN (bytes, sample_diff), expected, samplestamp);