Merge "Fix debug output."
diff --git a/Debug.cpp b/Debug.cpp
index fb97069..d304d21 100644
--- a/Debug.cpp
+++ b/Debug.cpp
@@ -222,7 +222,11 @@
 
         for (word = 0; word < bytesPerLine; ) {
 
-            const size_t startIndex = word+(alignment-(alignment?1:0));
+            size_t align_offset = alignment-(alignment?1:0);
+            if (remain > 0 && (size_t)remain <= align_offset) {
+                align_offset = remain - 1;
+            }
+            const size_t startIndex = word+align_offset;
 
             for (index = 0; index < alignment || (alignment == 0 && index < bytesPerLine); index++) {