Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2000:
[Freeciv-Dev] Re: Could not start the game (PR#275)
Home

[Freeciv-Dev] Re: Could not start the game (PR#275)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: nazarov@xxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Could not start the game (PR#275)
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Thu, 2 Mar 2000 17:43:36 +1100 (EST)

Igor Nazarov wrote:

> I installed the program following the instructions from INSTALL, and 
> everything seemed almost fine (if dont take into acount plenty of
> warnings).
> The server and client run just fine till the moment I decided to start the
> game. Then the server produced the following output and quit.

Thankyou!  This bug has actually appeared a few times (bugs 165, 168;
and see http://arch.freeciv.org/freeciv-200002/msg00083.html), but
it seemed so strange it was almost hard to believe.  Your report 
increased my motivation to find the bug, and the error mesage 
you gave helped me to do so.

The bug is that in the removed line below, *(c-1) is checked, but
sometimes (to do with multi-line strings) 'c' points to the start 
of allocated memory, so doing 'c-1' is undefined.  (Though the
error message is actually for the next string after the multi-line 
string where this happens to give problems.)

This patches fixes the problem, and also another buglet: previously 
you couldn't have strings ending with backslash, because even escaping 
the backslash, the string-ending double-quote would be treated as
backslash-escaped.

Regards,
-- David

diff -u -r --exclude-from exclude freeciv-cvs/common/inputfile.c 
fc-adv/common/inputfile.c
--- freeciv-cvs/common/inputfile.c      Sun Sep  5 12:40:46 1999
+++ fc-adv/common/inputfile.c   Thu Mar  2 17:13:06 2000
@@ -648,7 +649,12 @@
   for(;;) {
     int pos;
     
-    while(*c && (*c!='\"' || *(c-1)=='\\')) {
+    while(*c != '\0' && *c != '\"') {
+      /* skip over escaped chars, including backslash-doublequote,
+        and backslash-backslash: */
+      if (*c == '\\' && *(c+1) != '\0') {  
+       c++;
+      }
       c++;
     }
     if (*c == '\"') 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: Could not start the game (PR#275), David Pfitzner <=