CVS update: /ccvs/src/

[email protected] 17 Mar 2005 18:42:06 -0000
Newsgroups gmane.comp.version-control.cvs.cvs
Message-ID <[email protected]>
User: dprice  
Date: 05/03/17 10:42:06

Modified:
 /ccvs/src/
  ChangeLog, admin.c, commit.c, log.c, mkmodules.c, rcs.c

Log:
 Merge changes from 1.11.x.

File Changes:

Directory: /ccvs/src/
=====================

File [changed]: ChangeLog
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/ChangeLog?r1=1.3159&r2=1.3160
Delta lines:  +19 -0
--------------------
--- ChangeLog	17 Mar 2005 17:15:19 -0000	1.3159
+++ ChangeLog	17 Mar 2005 18:42:03 -0000	1.3160
@@ -1,3 +1,22 @@
+2005-03-17  Derek Price  <[email protected]>
+
+	* commit.c (checkaddfile): Avoid dereferencing a NULL pointer in
+	response to a rare error.
+	* admin.c (admin_fileproc), log.c (log_expand_revlist), mkmodules.c
+	(checkout_file), rcs.c (RCS_getdate, RCS_deltas, RCS_findlock_or_tip,
+	RCS_tag2rev): Avoid dereferencing NULL pointer.
+	(Thanks to report from Alen Zukich <[email protected]>.)
+
+2005-03-17  Derek Price  <[email protected]>
+
+	* rcs.c (RCS_reparsercsfile): Avoid memory leak.
+	(Thanks to report from Alen Zukich <[email protected]>.)
+
+2005-03-17  Derek Price  <[email protected]>
+
+	* log.c (log_expand_revlist): Suppress message and not error handling
+	when really_quiet.
+
 2005-03-16  Mark D. Baushke  <[email protected]>
 
 	* buffer.c (fd_buffer_shutdown): Replace (int *) 0 with NULL.

File [changed]: admin.c
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/admin.c?r1=1.105&r2=1.106
Delta lines:  +7 -0
-------------------
--- admin.c	7 Mar 2005 20:15:58 -0000	1.105
+++ admin.c	17 Mar 2005 18:42:03 -0000	1.106
@@ -878,6 +878,13 @@
 		{
 		    tag = xstrdup (arg + 2);
 		    rev = RCS_head (rcs);
+		    if (!rev)
+		    {
+			error (0, 0, "No head revision in archive file `%s'.",
+			       rcs->path);
+			status = 1;
+			continue;
+		    }
 		}
 		else
 		{

File [changed]: commit.c
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/commit.c?r1=1.250&r2=1.251
Delta lines:  +3 -0
-------------------
--- commit.c	16 Mar 2005 22:07:46 -0000	1.250
+++ commit.c	17 Mar 2005 18:42:03 -0000	1.251
@@ -2231,6 +2231,9 @@
 	    fixbranch (rcs, sbranch);
 
 	    head = RCS_getversion (rcs, NULL, NULL, 0, NULL);
+	    if (!head)
+		error (1, 0, "No head revision in archive file `%s'.",
+		       rcs->print_path);
 	    magicrev = RCS_magicrev (rcs, head);
 
 	    /* If this is not a new branch, then we will want a dead

File [changed]: log.c
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/log.c?r1=1.101&r2=1.102
Delta lines:  +17 -5
--------------------
--- log.c	16 Mar 2005 22:07:46 -0000	1.101
+++ log.c	17 Mar 2005 18:42:03 -0000	1.102
@@ -1053,9 +1053,20 @@
 	    /* If both first and last are NULL, it means that we want
 	       just the head of the default branch, which is RCS_head.  */
 	    nr->first = RCS_head (rcs);
+	    if (!nr->first)
+	    {
+		if (!really_quiet)
+		    error (0, 0, "No head revision in archive `%s'.",
+		           rcs->path);
+		nr->last = NULL;
+		nr->fields = 0;
+	    }
+	    else
+	    {
 	    nr->last = xstrdup (nr->first);
 	    nr->fields = numdots (nr->first) + 1;
 	}
+	}
 	else if (r->branchhead)
 	{
 	    char *branch;
@@ -1074,8 +1085,9 @@
 		    free (branch);
 		}
 	    }
-	    if (nr->first == NULL && !really_quiet)
+	    if (!nr->first)
 	    {
+		if (!really_quiet)
 		error (0, 0, "warning: no branch `%s' in `%s'",
 		       r->first, rcs->print_path);
 		nr->last = NULL;

File [changed]: mkmodules.c
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/mkmodules.c?r1=1.91&r2=1.92
Delta lines:  +10 -0
--------------------
--- mkmodules.c	16 Mar 2005 22:00:49 -0000	1.91
+++ mkmodules.c	17 Mar 2005 18:42:03 -0000	1.92
@@ -875,7 +875,17 @@
 	free (rcs);
 	return 1;
     }
+
     rcsnode = RCS_parsercsfile (rcs);
+    if (!rcsnode)
+    {
+	/* Probably not necessary (?); RCS_parsercsfile already printed a
+	   message.  */
+	error (0, 0, "Failed to parse `%s'.", rcs);
+	free (rcs);
+	return 1;
+    }
+
     retcode = RCS_checkout (rcsnode, NULL, NULL, NULL, NULL, temp, NULL, NULL);
     if (retcode != 0)
     {

File [changed]: rcs.c
Url: https://ccvs.cvshome.org/source/browse/ccvs/src/rcs.c?r1=1.338&r2=1.339
Delta lines:  +29 -0
--------------------
--- rcs.c	17 Mar 2005 17:15:19 -0000	1.338
+++ rcs.c	17 Mar 2005 18:42:03 -0000	1.339
@@ -563,6 +563,13 @@
 
 	if (STREQ (key, "comment"))
 	{
+	    if (rdata->comment)
+	    {
+		error (0, 0,
+		       "warning: duplicate key `%s' in RCS file `%s'",
+		       key, rcsfile);
+		free (rdata->comment);
+	    }
 	    rdata->comment = rcsbuf_valcopy (&rcsbuf, value, 0, NULL);
 	    continue;
 	}
@@ -2249,6 +2256,12 @@
 	* the 0 in some other position -- <[email protected]>
 	*/ 
 	pa = strrchr (rev, '.');
+	if (!pa)
+	    /* This might happen, for instance, if an RCS file only contained
+	     * revisions 2.x and higher, and REV == "1".
+	     */
+	    error (1, 0, "revision `%s' does not exist", tag);
+
 	pb = xmalloc (strlen (rev) + 3);
 	*pa++ = 0;
 	(void) sprintf (pb, "%s.%d.%s", rev, RCS_MAGIC_BRANCH, pa);
@@ -4742,6 +4755,13 @@
        that in other ways if at all anyway (e.g. rcslock.pl).  */
 
     p = findnode (rcs->versions, RCS_getbranch (rcs, rcs->branch, 0));
+    if (!p)
+    {
+	error (0, 0, "RCS file `%s' does not contain its default revision.",
+	       rcs->path);
+	return NULL;
+    }
+
     return p->data;
 }
 
@@ -5594,7 +5614,13 @@
 
     freedeltatext (dtext);
     if (status != 0)
+    {
+	/* If delta has not been added to a List, then freeing the Node key
+	 * won't free delta->version.
+	 */
+	if (delta->version) free (delta->version);
 	free_rcsvers_contents (delta);
+    }
 
     return status;
 }
@@ -7392,6 +7418,9 @@
 		if (vers->branches == NULL)
 		    error (1, 0, "missing expected branches in %s",
 			   rcs->print_path);
+		if (!cpversion)
+		    error (1, 0, "Invalid revision number in `%s'.",
+		           rcs->print_path);
 		*cpversion = '.';
 		++cpversion;
 		cpversion = strchr (cpversion, '.');