zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit bb92bcccb79cf7f8e31fe62bc35ace5d7dd12d46
parent 491389ee9bd05c7f197bc8de72e46ed71dfe4d4b
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Fri, 26 May 2017 16:23:46 -0400

Fix Segfaults With Invalid .scl/.kbm Filenames

Diffstat:
Msrc/Misc/Microtonal.cpp | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/Misc/Microtonal.cpp b/src/Misc/Microtonal.cpp @@ -572,6 +572,9 @@ int Microtonal::loadscl(SclInfo &scl, const char *filename) char tmp[500]; OctaveTuning tmpoctave[MAX_OCTAVE_SIZE]; + if(!file) + return 2; + fseek(file, 0, SEEK_SET); //loads the short description @@ -623,6 +626,9 @@ int Microtonal::loadkbm(KbmInfo &kbm, const char *filename) float tmpPAfreq = 440.0f; char tmp[500]; + if(!file) + return 2; + fseek(file, 0, SEEK_SET); //loads the mapsize if(loadline(file, tmp) != 0 || sscanf(tmp, "%d", &x) == 0)