From d831218b985c1ab66bc4e52f6b79142eb0fa79b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Oct 2019 11:00:24 -0700 Subject: GLK: Fix reading beyond the end of a file --- engines/glk/streams.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp index 37cac4437a..d6d62ddbec 100644 --- a/engines/glk/streams.cpp +++ b/engines/glk/streams.cpp @@ -989,7 +989,7 @@ int IOStream::getChar() { ensureOp(filemode_Read); int res; if (!_unicode) { - res = _inStream->readByte(); + res = (_inStream->pos() >= _inStream->size()) ? -1 : _inStream->readByte(); } else if (_textFile) { res = getCharUtf8(); } else { -- cgit v1.2.3