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.

43 lines
1.5KB

  1. Description: fixed yet another buffer read overflow in FLAC code
  2. CVE-2017-8362
  3. Author: Erik de Castro Lopo
  4. Origin: upstream
  5. Applied-Upstream: https://github.com/erikd/libsndfile/commit/ef1dbb2df1c0e741486646de40bd638a9c4cd808
  6. Last-Update: 2017-05-28
  7. ---
  8. This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  9. --- libsndfile.orig/src/flac.c
  10. +++ libsndfile/src/flac.c
  11. @@ -169,6 +169,14 @@
  12. const int32_t* const *buffer = pflac->wbuffer ;
  13. unsigned i = 0, j, offset, channels, len ;
  14. + if (psf->sf.channels != (int) frame->header.channels)
  15. + { psf_log_printf (psf, "Error: FLAC frame changed from %d to %d channels\n"
  16. + "Nothing to do but to error out.\n" ,
  17. + psf->sf.channels, frame->header.channels) ;
  18. + psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
  19. + return 0 ;
  20. + } ;
  21. +
  22. /*
  23. ** frame->header.blocksize is variable and we're using a constant blocksize
  24. ** of FLAC__MAX_BLOCK_SIZE.
  25. @@ -202,7 +210,6 @@
  26. return 0 ;
  27. } ;
  28. -
  29. len = SF_MIN (pflac->len, frame->header.blocksize) ;
  30. if (pflac->remain % channels != 0)
  31. @@ -436,7 +443,7 @@
  32. { case FLAC__METADATA_TYPE_STREAMINFO :
  33. if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
  34. { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
  35. - "Nothing to be but to error out.\n" ,
  36. + "Nothing to do but to error out.\n" ,
  37. psf->sf.channels, metadata->data.stream_info.channels) ;
  38. psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
  39. return ;