Skip to content

Commit 01b00b0

Browse files
committed
Convert to Hex only on Encoding.UTF8.GetString possible exception
Has OutOfMemory exceptions can occure in native Encoding.UTF8.GetString, we should not convert result to hex values
1 parent 8a52783 commit 01b00b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/StackExchange.Redis/RedisValue.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,10 @@ private static bool TryParseDouble(ReadOnlySpan<byte> blob, out double value)
784784
{
785785
return Format.GetString(span);
786786
}
787-
catch
787+
catch (Exception e) when // Only catch exception throwed by Encoding.UTF8.GetString
788+
(e is DecoderFallbackException
789+
|| e is ArgumentException
790+
|| e is ArgumentNullException)
788791
{
789792
return ToHex(span);
790793
}

0 commit comments

Comments
 (0)