MATLAB: Does MATLAB 7.0.1 (R14SP1) running on MacOS 10.3 crash, when the symbol “~” is part of the filename argument to the IMWRITE function to write a PNG file

~crashfilenameimwritemacMATLABpantherpngtilda

On a MacOS 10.3, using "~" to indicate the home directory as part of the filename argument string to the IMWRITE command causes MATLAB to produces a crash as shown below, when writing PNG files:
------------------------------------------------------------------------
Bus error detected at Fri Nov 19 20:53:39 2004
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: 276626
Operating System: Darwin 7.6.0 Darwin Kernel Version 7.6.0: Sun Oct
10 12:05:27 PDT 2004; root:xnu/xnu-517.9.4.obj~1/RELEASE_PPC Power
Macintosh
Window System: The XFree86 Project, Inc (40300000), display :0.0
Current Visual: 0x22 (class 4, depth 24)
Virtual Machine: Java 1.4.2_05 with "Apple Computer, Inc." Java
HotSpot(TM) Client VM
(mixed mode)
Default Charset: US-ASCII
r0 = 0d6a2bb8 r8 = 00000000 r16 = f0ffcf10 r24 = 00000008
r1 = f0ffbf20 r9 = 00000000 r17 = 00001171 r25 = 023d66a8
r2 = 0d6a30e8 r10 = 00000000 r18 = f0ffcf70 r26 = 00000000
r3 = 023d66a8 r11 = a0004228 r19 = 00000000 r27 = 00000000
r4 = 023d66ac r12 = 84042248 r20 = 0de2bc20 r28 = 023d66ac
r5 = 000001b6 r13 = 00000000 r21 = f0ffd430 r29 = 00000500
r6 = 00000000 r14 = 00000000 r22 = 00000000 r30 = 00000000
r7 = 00000000 r15 = 00000010 r23 = 00000356 r31 = 0d6a29c0
cr = 44042248 lr = 0d6a30e8 xer = 00000004 ctr = 900036e0
vrsave = 00000000
Stack Trace:
[0] png.mexmac:png_destroy_write_struct + 44 bytes
[1] png.mexmac:WritePNG + 1844 bytes
[2] png.mexmac:mexFunction + 148 bytes
[3] libmex.dylib:mexRunMexFile + 116 bytes
[4] libmex.dylib:Mfh_mex::dispatch_file(int, mxArray_tag**, int,
mxArray_tag**) + 316 bytes
<snip>

Best Answer

This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:
We have verified that there is a bug in MATLAB 7.0.1 (R14SP1) running on MacOS 10.3 in the way that IMWRITE handles filenames that include the "~" character, denoting a user's home directory, when writing a PNG file.
To work around this issue, specify the full path name without using "~".