Fix lineFromReadBuffer() so it no longer tries to skip backwards
past the start of the read buffer.

Fixes internal bug #2183785.

Change-Id: I2a371e88a6816f4c1e237ae4cdb8baade4de66c9
diff --git a/src/org/apache/http/impl/io/AbstractSessionInputBuffer.java b/src/org/apache/http/impl/io/AbstractSessionInputBuffer.java
index eb007a9..9ac9b26 100644
--- a/src/org/apache/http/impl/io/AbstractSessionInputBuffer.java
+++ b/src/org/apache/http/impl/io/AbstractSessionInputBuffer.java
@@ -238,10 +238,14 @@
         int off = this.bufferpos;
         int len;
         this.bufferpos = pos + 1;
-        if (pos > 0 && this.buffer[pos - 1] == HTTP.CR) {
+        // BEGIN android-changed
+        // The first test below was fixed to not try to skip beyond the
+        // start of the live part of the buffer.
+        if (pos > off && this.buffer[pos - 1] == HTTP.CR) {
             // skip CR if found
             pos--;
         }
+        // END android-changed
         len = pos - off;
         if (this.ascii) {
             charbuffer.append(this.buffer, off, len);