Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5683,18 +5683,20 @@ private bool TryReadSqlStringValue(SqlBuffer value, byte type, int length, Encod
{
char[] cc = null;
bool buffIsRented = false;
if (!TryReadPlpUnicodeChars(ref cc, 0, length >> 1, stateObj, out length, supportRentedBuff: true, rentedBuff: ref buffIsRented))
{
return false;
}
if (length > 0)
{
s = new string(cc, 0, length);
}
else
bool result = TryReadPlpUnicodeChars(ref cc, 0, length >> 1, stateObj, out length, supportRentedBuff: true, rentedBuff: ref buffIsRented);

if (result)
{
s = "";
if (length > 0)
{
s = new string(cc, 0, length);
}
else
{
s = "";
}
}

if (buffIsRented)
{
// do not use clearArray:true on the rented array because it can be massively larger
Expand All @@ -5705,6 +5707,11 @@ private bool TryReadSqlStringValue(SqlBuffer value, byte type, int length, Encod
ArrayPool<char>.Shared.Return(cc, clearArray: false);
cc = null;
}

if (!result)
{
return false;
}
}
else
{
Expand Down