MATLAB: Does the CONVENC function from Communications Toolbox 3.0.1 (R14SP1) fail when the message input is a non-double type

codeCommunications Toolboxconvencconvolutionconvolutionalcrashencodingreed-solomonsegv

When I execute the following code:
trellis = poly2trellis(7,[ 171 133 ]);
msg = uint16 ([1 0 1]);
convenc (msg, trellis)
I receive the following segmentation violation:
------------------------------------------------------------------------
Segmentation violation detected at Tue Jan 25 13:56:13 2005
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 1)
Processor ID: x86 Family 15 Model 2 Stepping 4, GenuineIntel
Virtual Machine: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: ibm-5348_P100-1997
Register State:
EAX = 00000010 EBX = 00000002
ECX = 0e08b010 EDX = 00000000
ESI = 000b0080 EDI = 00000001
EBP = 00cdd7a4 ESP = 00cdd770
EIP = 095e1123 FLG = 00010202
Stack Trace:
[0] convcore.dll:_ConvEncode(0x0d276e60 "àD'\r", 0, 0x00cdd7e0 "8ÜÍ", 0x787d4f97) + 291 bytes
[1] convcore.dll:_mexFunction(2, 0x00cddee0, 7, 0x00cddf40) + 67 bytes
[2] libmex.dll:_mexRunMexFile(2, 0x00cddee0, 7, 0x00cddf40) + 103 bytes
[3] libmex.dll:public: virtual void __thiscall Mfh_mex::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(2, 0x00cddee0, 7, 0x00cddf40) + 157 bytes
[4] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(2, 0x00cddee0, 7, 0x00cddf40) + 273 bytes
[5] m_interpreter.dll:int __cdecl mdDispatch(int,char const *,int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_MATLAB_fn * *)(1758, 0x0d9e39ac "convcore", 2, 0x00cddee0) + 88 bytes
(snip)
However, when I do not typecast the msg input to uint16, the crash does not occur. Why?

Best Answer

We have verified that there is a bug in Communications Toolbox 3.0.1 (R14SP1) in the way that the CONVENC function handles non-double precision inputs. To work around this issue, typecast the input to double precision. For example,
trellis = poly2trellis(7,[ 171 133 ]);
msg = uint16 ([1 0 1]);
convenc (double(msg), trellis)