Hi there,
In StateLoader::LoadFile one of the final blocks has the comment "If we get errors just skip the error and continue rather than leave everything in an unstable state." When the reloc is corrupted sure, but the logic in this block seems to ignore errors in some places it shouldn't. In particular, shouldn't we return false when the initial fseek fails [0] or when an fread fails [1]? It seems to me that continuing in these cases causes us to either read garbage or an uninitialised stack variable. Am I missing something here?
Thanks, Matt
[0]: https://github.com/polyml/polyml/blob/master/libpolyml/savestate.cpp#L1051 [1]: https://github.com/polyml/polyml/blob/master/libpolyml/savestate.cpp#L1058
It would probably be a good idea to handle all the errors consistently. I'm not sure why they aren't. If you'd like to submit a pull request I'd be happy to look at it.
David
On 31/03/2016 06:27, Matthew Fernandez wrote:
Hi there,
In StateLoader::LoadFile one of the final blocks has the comment "If we get errors just skip the error and continue rather than leave everything in an unstable state." When the reloc is corrupted sure, but the logic in this block seems to ignore errors in some places it shouldn't. In particular, shouldn't we return false when the initial fseek fails [0] or when an fread fails [1]? It seems to me that continuing in these cases causes us to either read garbage or an uninitialised stack variable. Am I missing something here?
Thanks, Matt
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
Thanks, David. PR at https://github.com/polyml/polyml/pull/47.
On 01/04/16 22:42, David Matthews wrote:
It would probably be a good idea to handle all the errors consistently. I'm not sure why they aren't. If you'd like to submit a pull request I'd be happy to look at it.
David
On 31/03/2016 06:27, Matthew Fernandez wrote:
Hi there,
In StateLoader::LoadFile one of the final blocks has the comment "If we get errors just skip the error and continue rather than leave everything in an unstable state." When the reloc is corrupted sure, but the logic in this block seems to ignore errors in some places it shouldn't. In particular, shouldn't we return false when the initial fseek fails [0] or when an fread fails [1]? It seems to me that continuing in these cases causes us to either read garbage or an uninitialised stack variable. Am I missing something here?
Thanks, Matt
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml