diff --git a/SConscript b/SConscript index 0e75488488e1872d94ecaaf4c0c0ca241ce67156..c42215d5d5a7c06eb13dd1f9e511d9c9c3284a0b 100644 --- a/SConscript +++ b/SConscript @@ -17,24 +17,23 @@ import os Import('env') -myenv=env.Clone(); -myenv.Replace(debug=ARGUMENTS.get("debug",0)) -myenv.Append(CFLAGS=" -DUSE_ELFIO=1 ") -myenv.Append(CXXFLAGS=" -DUSE_ELFIO=1 ") -if int(myenv['debug']) == 1: +env.Replace(debug=ARGUMENTS.get("debug",0)) +env.Append(CFLAGS=" -DUSE_ELFIO=1 ") +env.Append(CXXFLAGS=" -DUSE_ELFIO=1 ") +if int(env['debug']) == 1: print "Setting debug mode" - myenv.Append(CFLAGS=" -g ") - myenv.Append(CXXFLAGS=" -g ") - myenv.Append(LINKFLAGS=" -g ") + env.Append(CFLAGS=" -g ") + env.Append(CXXFLAGS=" -g ") + env.Append(LINKFLAGS=" -g ") else: print "Setting release mode" - myenv.Append(CFLAGS=" -O3 ") - myenv.Append(CXXFLAGS=" -O3 ") - myenv.Append(LINKFLAGS=" -O3 ") + env.Append(CFLAGS=" -O3 ") + env.Append(CXXFLAGS=" -O3 ") + env.Append(LINKFLAGS=" -O3 ") -lib=myenv.SConscript("src/SConscript") +lib=env.SConscript("src/SConscript") Return('lib') diff --git a/SConstruct b/SConstruct index 017706270c32abcd02a0cf2297f54562a686ea3a..2d629934d8ce356ebde5eb90da51f0deac4fd5b1 100644 --- a/SConstruct +++ b/SConstruct @@ -19,6 +19,9 @@ env=Environment() Export('env') + +env.Replace(debug=ARGUMENTS.get("debug",0)) + lib=SConscript("SConscript") Return('lib') diff --git a/src/ehp.cpp b/src/ehp.cpp index 55ac747406f0c50b8d7e6fdb79d895e489a18a1a..8b8d8a04c7aa2e8e18b33479ae94b2639619fda1 100644 --- a/src/ehp.cpp +++ b/src/ehp.cpp @@ -243,10 +243,12 @@ bool eh_frame_util_t<ptrsize>::read_sleb128 ( auto byte=uint8_t(0); do { + if ( position > max ) + return false; byte = data [position]; - position++; result |= ((byte & 0x7f)<< shift); shift += 7; + position++; } while( (byte & 0x80) != 0); /* sign bit of byte is second high order bit (0x40) */