Changeset 25ecb73


Ignore:
Timestamp:
Feb 6, 2018, 10:32:59 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
5775f13
Parents:
560fc50
Message:

src/io/source_wavread.c: add some input validation (closes: #158)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_wavread.c

    r560fc50 r25ecb73  
    190190  bytes_read += fread(buf, 1, 2, s->fid);
    191191  bitspersample = read_little_endian(buf, 2);
     192
     193  if ( channels == 0 ) {
     194    AUBIO_ERR("source_wavread: Failed opening %s (number of channels can not be 0)\n", s->path);
     195    goto beach;
     196  }
     197
     198  if ( sr == 0 ) {
     199    AUBIO_ERR("source_wavread: Failed opening %s (samplerate can not be 0)\n", s->path);
     200    goto beach;
     201  }
     202
     203  if ( byterate == 0 ) {
     204    AUBIO_ERR("source_wavread: Failed opening %s (byterate can not be 0)\n", s->path);
     205    goto beach;
     206  }
     207
     208  if ( bitspersample == 0 ) {
     209    AUBIO_ERR("source_wavread: Failed opening %s (bitspersample can not be 0)\n", s->path);
     210    goto beach;
     211  }
    192212#if 0
    193213  if ( bitspersample != 16 ) {
Note: See TracChangeset for help on using the changeset viewer.