Ignore:
Timestamp:
Apr 19, 2025, 8:08:37 PM (4 months ago)
Author:
David Azarewicz
Message:

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/synth/emux/soundfont.c

    r703 r772  
    704704        struct soundfont_sample_info sample_info;
    705705        struct snd_sf_sample *sp;
    706         long off;
    707706
    708707        /* patch must be opened */
     
    714713                return -EINVAL;
    715714
     715        if (count < (long)sizeof(sample_info)) {
     716                return -EINVAL;
     717        }
    716718        if (copy_from_user(&sample_info, data, sizeof(sample_info)))
    717719                return -EFAULT;
    718 
    719         off = sizeof(sample_info);
    720 
    721         if (sample_info.size != (count-off)/2)
     720        data += sizeof(sample_info);
     721        count -= sizeof(sample_info);
     722
     723        // SoundFont uses S16LE samples.
     724        if (sample_info.size * 2 != count)
    722725                return -EINVAL;
    723726
     
    747750                rc = sflist->callback.sample_new
    748751                        (sflist->callback.private_data, sp, sflist->memhdr,
    749                          data + off, count - off);
     752                         data, count);
    750753                if (rc < 0) {
    751754                        sf_sample_delete(sflist, sf, sp);
     
    960963        if (copy_from_user(&patch, data, sizeof(patch)))
    961964                return -EFAULT;
    962        
    963965        count -= sizeof(patch);
    964966        data += sizeof(patch);
     967
     968        if ((patch.len << (patch.mode & WAVE_16_BITS ? 1 : 0)) != count)
     969                return -EINVAL;
    965970
    966971        sf = newsf(sflist, SNDRV_SFNT_PAT_TYPE_GUS|SNDRV_SFNT_PAT_SHARED, NULL);
Note: See TracChangeset for help on using the changeset viewer.