mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
topology: decode: Fix decoding PCM formats and rates
Not checking _LAST format and rate, which are valid indexes in arrays, makes data loss while converting binary to standard ALSA configuration file. Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
c32498603a
commit
acbb0e3b17
1 changed files with 2 additions and 2 deletions
|
|
@ -549,7 +549,7 @@ int tplg_save_stream_caps(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
||||||
if (err >= 0 && sc->formats) {
|
if (err >= 0 && sc->formats) {
|
||||||
err = tplg_save_printf(dst, pfx, "\tformats '");
|
err = tplg_save_printf(dst, pfx, "\tformats '");
|
||||||
first = 1;
|
first = 1;
|
||||||
for (i = 0; err >= 0 && i < SND_PCM_FORMAT_LAST; i++) {
|
for (i = 0; err >= 0 && i <= SND_PCM_FORMAT_LAST; i++) {
|
||||||
if (sc->formats & (1ULL << i)) {
|
if (sc->formats & (1ULL << i)) {
|
||||||
s = snd_pcm_format_name(i);
|
s = snd_pcm_format_name(i);
|
||||||
err = tplg_save_printf(dst, NULL, "%s%s",
|
err = tplg_save_printf(dst, NULL, "%s%s",
|
||||||
|
|
@ -563,7 +563,7 @@ int tplg_save_stream_caps(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
||||||
if (err >= 0 && sc->rates) {
|
if (err >= 0 && sc->rates) {
|
||||||
err = tplg_save_printf(dst, pfx, "\trates '");
|
err = tplg_save_printf(dst, pfx, "\trates '");
|
||||||
first = 1;
|
first = 1;
|
||||||
for (i = 0; err >= 0 && i < SND_PCM_RATE_LAST; i++) {
|
for (i = 0; err >= 0 && i <= SND_PCM_RATE_LAST; i++) {
|
||||||
if (sc->rates & (1ULL << i)) {
|
if (sc->rates & (1ULL << i)) {
|
||||||
s = get_rate_name(i);
|
s = get_rate_name(i);
|
||||||
err = tplg_save_printf(dst, NULL, "%s%s",
|
err = tplg_save_printf(dst, NULL, "%s%s",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue