Hello,

(As a side effect of digging into issue #13237):

When OpenExeFile is called with an empty filename argument, it apparently opens stdin and crashes immediately thereafter trying to seek in non-seekable stream. The filename is empty whenever GetLineInfo is called with the address that does not belong to valid module.
The attached patch fixes the crash.

Regards,
Sergei
Index: exeinfo.pp
===================================================================
--- exeinfo.pp	(revision 12784)
+++ exeinfo.pp	(working copy)
@@ -1044,6 +1044,8 @@
   fillchar(e,sizeof(e),0);
   e.bufsize:=sizeof(e.buf);
   e.filename:=fn;
+  if fn = '' then   // we don't want to read stdin
+    exit;
   assign(e.f,fn);
   {$I-}
    ofm:=filemode;
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to