id3v2: ignore RVA2 tags with more than 64 peak bits

The spec for this does not say nor imply how this should be
interpreted.  The previous code would try to shift by 64 bits,
which is undefined.

Coverity 1195119

https://bugzilla.gnome.org/show_bug.cgi?id=727955
This commit is contained in:
Vincent Penquerc'h 2014-04-10 12:03:05 +01:00
parent 985ed4847f
commit e2a9f0ef4e

View file

@ -656,11 +656,16 @@ parse_relative_volume_adjustment_two (ID3TagsWorking * work)
}
}
peak = peak << (64 - GST_ROUND_UP_8 (peak_bits));
peak_val =
gst_guint64_to_gdouble (peak) / gst_util_guint64_to_gdouble (G_MAXINT64);
GST_LOG ("RVA2 frame: id=%s, chan=%u, adj=%.2fdB, peak_bits=%u, peak=%.2f",
id, chan, gain_dB, (guint) peak_bits, peak_val);
if (peak_bits > 0) {
peak = peak << (64 - GST_ROUND_UP_8 (peak_bits));
peak_val =
gst_guint64_to_gdouble (peak) /
gst_util_guint64_to_gdouble (G_MAXINT64);
GST_LOG ("RVA2 frame: id=%s, chan=%u, adj=%.2fdB, peak_bits=%u, peak=%.2f",
id, chan, gain_dB, (guint) peak_bits, peak_val);
} else {
peak_val = 0;
}
if (chan == ID3V2_RVA2_CHANNEL_MASTER && strcmp (id, "track") == 0) {
gain_tag_name = GST_TAG_TRACK_GAIN;