You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varchar字段为null时报如下错误: System.AccessViolationException:“Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”
应该是这段代码没有判断为空或者长度为0导致复制溢出(Websocket模式下,其他模式正常)
IoTSharp.Data.Taos\Protocols\TDWebSocket\TaosWebSocketContext.cs
GetValuePtr的这段的代码中IntPtr rowptr = IntPtr.Add(rowdata, offset);这句报错
private WSDataRow GetValuePtr(int ordinal)
{
var col = lstpColInfoData[ordinal];
int offset = 0;
short len = 0;
IntPtr data = IntPtr.Zero;
IntPtr rowdata = col.pData;
if (col.info.IS_VAR_DATA_TYPE() )
{
offset = col.varmeta.offset[_index];
IntPtr rowptr = IntPtr.Add(rowdata, offset);
len = Marshal.ReadInt16(rowptr, 0);
data = IntPtr.Add(rowptr, sizeof(Int16));
}
varchar字段为null时报如下错误:
System.AccessViolationException:“Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”
应该是这段代码没有判断为空或者长度为0导致复制溢出(Websocket模式下,其他模式正常)
IoTSharp.Data.Taos\Protocols\TDWebSocket\TaosWebSocketContext.cs
GetValuePtr的这段的代码中IntPtr rowptr = IntPtr.Add(rowdata, offset);这句报错
private WSDataRow GetValuePtr(int ordinal)
{
var col = lstpColInfoData[ordinal];
int offset = 0;
short len = 0;
IntPtr data = IntPtr.Zero;
IntPtr rowdata = col.pData;
if (col.info.IS_VAR_DATA_TYPE() )
{
offset = col.varmeta.offset[_index];
IntPtr rowptr = IntPtr.Add(rowdata, offset);
len = Marshal.ReadInt16(rowptr, 0);
data = IntPtr.Add(rowptr, sizeof(Int16));
}
经分析,当varchar字段为空时offset=-1,rowdata=0x00000000,再复制就会导致指针错误,在if (col.info.IS_VAR_DATA_TYPE())前应该加个判断,如下
The text was updated successfully, but these errors were encountered: