[5568] in Athena Bugs

home help back first fref pref prev next nref lref last post

rt 6.4R: MATLAB, crash in sprintf routine

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Wed Jul 18 14:05:34 1990

Date: Wed, 18 Jul 90 14:05:10 -0400
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: sethf@ATHENA.MIT.EDU
Cc: bugs@ATHENA.MIT.EDU
In-Reply-To: bugs[5548]

   From: sethf@ATHENA.MIT.EDU
   Date: Mon, 16 Jul 90 22:52:22 EDT

   What were you trying to do?
	   Determine how MATLAB's sprintf routine worked, and whether a
   string was a legal argument. I typed
		   sprintf('Foo %s','foo')
   What's wrong:
	   Segmentation violation

   What should have happened:
	   A less drastic error message.

Sorry, but I disagree.  You told matlab to write into a constant
string, probably overwriting the memory reserved for that string.
There is no way for it to check that, and in fact, the same thing
would result if you did the same thing in a C program with the C
sprintf() function.

I consider segmentation faulting in response to what you did to fall
quite soundly within the bounds of "wreaking havoc."  They documented
the function that way *because* they know that it's not possible to
check for things such as what you did.

 Jonathan Kamens
 Project Athena Quality Assurance


home help back first fref pref prev next nref lref last post