diff --git a/source/numem/io/stream/filestream.d b/source/numem/io/stream/filestream.d index 1f4420f..2b64b2b 100644 --- a/source/numem/io/stream/filestream.d +++ b/source/numem/io/stream/filestream.d @@ -70,7 +70,7 @@ override: } ptrdiff_t read(ref vector!ubyte buffer, size_t offset, size_t count) { - if (offset+count >= buffer.size()) return -2; + if (offset+count > buffer.size()) return -2; fPosition_ += buffer.size; return fread(buffer.data+offset, 1, count, file); @@ -91,7 +91,7 @@ override: ptrdiff_t write(ref vector!ubyte buffer, int offset, int count) { - if (offset+count >= buffer.size()) return -2; + if (offset+count > buffer.size()) return -2; // NOTE: Write and calculate the position delta // said delta is used to recalculate the length diff --git a/source/numem/io/stream/memstream.d b/source/numem/io/stream/memstream.d index 2518d1e..1cbe453 100644 --- a/source/numem/io/stream/memstream.d +++ b/source/numem/io/stream/memstream.d @@ -155,7 +155,7 @@ override: ptrdiff_t toWrite = count; // Out of range for source - if (offset+count >= buffer.size()) return -2; + if (offset+count > buffer.length) return -2; // Limit read to bounds if (fPosition_+count > fLength_)