From aeb08744cb7c6f042400a4e4958f6c7b8659feef Mon Sep 17 00:00:00 2001 From: GiovanniNova <89094883+GiovanniNova@users.noreply.github.com> Date: Tue, 21 Mar 2023 11:13:48 -0300 Subject: [PATCH] Fixes #567, ReadShort now casts to and returns an ushort --- src/UglyToad.PdfPig/Images/JpegHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UglyToad.PdfPig/Images/JpegHandler.cs b/src/UglyToad.PdfPig/Images/JpegHandler.cs index eb4c70af..74d7dd11 100644 --- a/src/UglyToad.PdfPig/Images/JpegHandler.cs +++ b/src/UglyToad.PdfPig/Images/JpegHandler.cs @@ -129,7 +129,7 @@ throw new InvalidOperationException(); } - private static short ReadShort(Stream stream, byte[] buffer) + private static ushort ReadShort(Stream stream, byte[] buffer) { var read = stream.Read(buffer, 0, 2); @@ -138,7 +138,7 @@ throw new InvalidOperationException("Failed to read a short where expected in the JPEG stream."); } - return (short)((buffer[0] << 8) + buffer[1]); + return (ushort)((buffer[0] << 8) + buffer[1]); } } }