From fb9103aeafc27d56ded7049842dabdb220fc3bdb Mon Sep 17 00:00:00 2001 From: Olivia Date: Mon, 19 Dec 2016 16:23:42 +0100 Subject: [PATCH] Fixing bytes struct reference issue. --- src/ImageSharp/Formats/Jpg/Components/Bits.cs | 6 +++++- src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Formats/Jpg/Components/Bits.cs b/src/ImageSharp/Formats/Jpg/Components/Bits.cs index 0eebef132..d7449f4a3 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Bits.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Bits.cs @@ -45,7 +45,11 @@ namespace ImageSharp.Formats { JpegDecoderCore.ErrorCodes errorCode; - byte c = decoder.Bytes.ReadByteStuffedByte(decoder.InputStream, out errorCode); + // Grab the decode bytes, use them and then set them + // back on the decoder. + var decoderBytes = decoder.Bytes; + byte c = decoderBytes.ReadByteStuffedByte(decoder.InputStream, out errorCode); + decoder.Bytes = decoderBytes; if (errorCode != JpegDecoderCore.ErrorCodes.NoError) { diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index 90c005096..3991c4e0e 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -236,7 +236,7 @@ namespace ImageSharp.Formats } /// - /// Gets the byte buffer. + /// Gets or sets the byte buffer. /// public Bytes Bytes { @@ -244,6 +244,11 @@ namespace ImageSharp.Formats { return this.bytes; } + + set + { + this.bytes = value; + } } ///