Cross-Platform build scripts for audio plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.1KB

  1. Description: fixing buffer read/write overruns in FLAC-code
  2. CVE-2017-8365, CVE-2017-8363, CVE-2017-8361
  3. Author: Erik de Castro Lopo
  4. Origin: upstream
  5. Applied-Upstream: https://github.com/erikd/libsndfile/commit/fd0484aba8e51d16af1e3a880f9b8b857b385eb3
  6. Last-Update: 2017-05-28
  7. ---
  8. This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  9. --- libsndfile.orig/src/common.h
  10. +++ libsndfile/src/common.h
  11. @@ -725,6 +725,7 @@
  12. SFE_FLAC_INIT_DECODER,
  13. SFE_FLAC_LOST_SYNC,
  14. SFE_FLAC_BAD_SAMPLE_RATE,
  15. + SFE_FLAC_CHANNEL_COUNT_CHANGED,
  16. SFE_FLAC_UNKOWN_ERROR,
  17. SFE_WVE_NOT_WVE,
  18. --- libsndfile.orig/src/flac.c
  19. +++ libsndfile/src/flac.c
  20. @@ -435,6 +435,19 @@
  21. switch (metadata->type)
  22. { case FLAC__METADATA_TYPE_STREAMINFO :
  23. + if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
  24. + { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
  25. + "Nothing to be but to error out.\n" ,
  26. + psf->sf.channels, metadata->data.stream_info.channels) ;
  27. + psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
  28. + return ;
  29. + } ;
  30. +
  31. + if (psf->sf.channels > 0 && psf->sf.samplerate != (int) metadata->data.stream_info.sample_rate)
  32. + { psf_log_printf (psf, "Warning: FLAC stream changed sample rates from %d to %d.\n"
  33. + "Carrying on as if nothing happened.",
  34. + psf->sf.samplerate, metadata->data.stream_info.sample_rate) ;
  35. + } ;
  36. psf->sf.channels = metadata->data.stream_info.channels ;
  37. psf->sf.samplerate = metadata->data.stream_info.sample_rate ;
  38. psf->sf.frames = metadata->data.stream_info.total_samples ;
  39. --- libsndfile.orig/src/sndfile.c
  40. +++ libsndfile/src/sndfile.c
  41. @@ -245,6 +245,7 @@
  42. { SFE_FLAC_INIT_DECODER , "Error : problem with initialization of the flac decoder." },
  43. { SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." },
  44. { SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." },
  45. + { SFE_FLAC_CHANNEL_COUNT_CHANGED, "Error : flac channel changed mid stream." },
  46. { SFE_FLAC_UNKOWN_ERROR , "Error : unknown error in flac decoder." },
  47. { SFE_WVE_NOT_WVE , "Error : not a WVE file." },