diff src/org/tmatesoft/hg/internal/DataAccess.java @ 399:fdc1db8f7f61 smartgit3

Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 25 Feb 2012 19:31:57 +0100
parents 5e95b0da26f2
children 528b6780a8bd
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/DataAccess.java	Thu Feb 23 15:31:57 2012 +0100
+++ b/src/org/tmatesoft/hg/internal/DataAccess.java	Sat Feb 25 19:31:57 2012 +0100
@@ -32,6 +32,7 @@
 	public boolean isEmpty() {
 		return true;
 	}
+	// TODO throws IOException (few subclasses have non-trivial length() operation)
 	public int length() {
 		return 0;
 	}
@@ -68,6 +69,10 @@
 		readBytes(b, 0, 4);
 		return b[0] << 24 | (b[1] & 0xFF) << 16 | (b[2] & 0xFF) << 8 | (b[3] & 0xFF);
 	}
+
+	/**
+	 * Read 8 bytes as long value, big-endian.
+	 */
 	public long readLong() throws IOException {
 		byte[] b = new byte[8];
 		readBytes(b, 0, 8);