# HG changeset patch # User Olaf Till # Date 1307025073 -7200 # Node ID 1dfeacd003bbbba1cfb3acac7aa230b3f5901b35 # Parent 59f5c239b9cf63e7b7bc4d263b029287bbe8bbda Fix loading of function handles saved in binary format. Bug #33456. * src/ov-fcn-handle.cc (load_binary): Replace is.get() with is.read(). diff --git a/src/ov-fcn-handle.cc b/src/ov-fcn-handle.cc --- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -553,7 +553,10 @@ swap_bytes<4> (&tmp); OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1); - is.get (ctmp1, tmp+1, 0); + // is.get (ctmp1, tmp+1, 0); caused is.eof () to be true though + // effectively not reading over file end + is.read (ctmp1, tmp); + ctmp1[tmp] = 0; nm = std::string (ctmp1); if (! is) @@ -578,7 +581,10 @@ swap_bytes<4> (&tmp); OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1); - is.get (ctmp2, tmp+1, 0); + // is.get (ctmp2, tmp+1, 0); caused is.eof () to be true though + // effectively not reading over file end + is.read (ctmp2, tmp); + ctmp2[tmp] = 0; unwind_protect_safe frame; @@ -658,7 +664,7 @@ success = set_fcn (octaveroot, fpath); } - return success; + return success; } #if defined (HAVE_HDF5)