Bug 157718 - input data trigers a core dump from calendar(1) [regression]
Summary: input data trigers a core dump from calendar(1) [regression]
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Edwin Groothuis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-09 00:50 UTC by jhs
Modified: 2018-11-25 22:05 UTC (History)
2 users (show)

See Also:
bugmeister: mfc-stable10?
bugmeister: mfc-stable9?
bugmeister: mfc-stable8?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jhs 2011-06-09 00:50:09 UTC
	calendar should not core dump

How-To-Repeat: 	
	fetch http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/usr.bin/calendar/core_dump_input.ignore
	fetch http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/usr.bin/calendar/core_dump_shell.ignore
	./core_dump_shell.ignore
	calendar -f  core_dump_input.ignore

	(BTW ignore my strange names ending .ignore, its just a prefix to
	  stop my customise shell installing things in my src/
Comment 1 Jaakko Heinonen freebsd_committer freebsd_triage 2011-06-09 16:39:43 UTC
On 2011-06-09, Julian H. Stacey wrote:
> I have verified calendar core dumps on these:
> 	8.2-RELEASE amd64 
> 	8.2-RELEASE i386 
> & not on these:
> 	4.11-RELEASE i386
> 	6.2-RELEASE i386
> 	6.3-RELEASE i386
> 	7.3-RELEASE i386
> So there's a regression error to be found & corrected.

It looks like this regression is caused by r212035:

------------------------------------------------------------------------
r212035 | edwin | 2010-08-31 01:45:32 +0300 (Tue, 31 Aug 2010) | 3 lines

For calendars which don't match the solar-based Gregorian calendar,
be able to specify a year string in an entry.

------------------------------------------------------------------------

edwin@ Cc'd.

> >Description:
> 	calendar should not core dump
> >How-To-Repeat:
> 	
> 	fetch http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/usr.bin/calendar/core_dump_input.ignore
> 	fetch http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/usr.bin/calendar/core_dump_shell.ignore
> 	./core_dump_shell.ignore
> 	calendar -f  core_dump_input.ignore
> 
> 	(BTW ignore my strange names ending .ignore, its just a prefix to
> 	  stop my customise shell installing things in my src/

-- 
Jaakko
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2011-07-11 11:57:48 UTC
Responsible Changed
From-To: freebsd-bugs->edwin

I'll chase it.
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-07-11 23:01:54 UTC
Author: edwin
Date: Mon Jul 11 22:01:39 2011
New Revision: 223939
URL: http://svn.freebsd.org/changeset/base/223939

Log:
  Fix run-time breakage when encoutering invalid input-data.
  
  PR:		bin/157718

Modified:
  head/usr.bin/calendar/parsedata.c

Modified: head/usr.bin/calendar/parsedata.c
==============================================================================
--- head/usr.bin/calendar/parsedata.c	Mon Jul 11 20:43:59 2011	(r223938)
+++ head/usr.bin/calendar/parsedata.c	Mon Jul 11 22:01:39 2011	(r223939)
@@ -818,6 +818,8 @@ showflags(int flags)
 static const char *
 getmonthname(int i)
 {
+	if (i <= 0 || i > 12)
+		return ("");
 	if (nmonths[i - 1].len != 0 && nmonths[i - 1].name != NULL)
 		return (nmonths[i - 1].name);
 	return (months[i - 1]);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 Edwin Groothuis freebsd_committer freebsd_triage 2011-07-11 23:02:12 UTC
State Changed
From-To: open->patched

Fixed in head, MFC later.
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2018-01-08 04:14:45 UTC
For the following conditions
Product: Base System, Documentation Status: New, Open, In Progress, UNCONFIRMED 
Assignee: Former FreeBSD committer 

Reset to default assignee. Reset status to "Open".
Comment 6 Yuri Pankov freebsd_committer freebsd_triage 2018-11-25 22:05:15 UTC
Fixed in all supported branches by base r223939.