Change the async-IO extension to return SQLITE_IOERR_SHORT_READ when appropriate. This prevents a valgrind warning in the test suite.

FossilOrigin-Name: d9e3287900ae4aa7722ad0132bb8d6cd2755d3a6
diff --git a/ext/async/sqlite3async.c b/ext/async/sqlite3async.c
index 127942b..65399a5 100644
--- a/ext/async/sqlite3async.c
+++ b/ext/async/sqlite3async.c
@@ -667,7 +667,7 @@
 ){
   AsyncFileData *p = ((AsyncFile *)pFile)->pData;
   int rc = SQLITE_OK;
-  sqlite3_int64 filesize;
+  sqlite3_int64 filesize = 0;
   sqlite3_file *pBase = p->pBaseRead;
   sqlite3_int64 iAmt64 = (sqlite3_int64)iAmt;
 
@@ -706,6 +706,7 @@
       )){
         sqlite3_int64 nCopy;
         sqlite3_int64 nByte64 = (sqlite3_int64)pWrite->nByte;
+        filesize = MAX(filesize, pWrite->iOffset+nByte64);
 
         /* Set variable iBeginIn to the offset in buffer pWrite->zBuf[] from
         ** which data should be copied. Set iBeginOut to the offset within
@@ -728,6 +729,9 @@
 
 asyncread_out:
   async_mutex_leave(ASYNC_MUTEX_QUEUE);
+  if( rc==SQLITE_OK && filesize<(iOffset+iAmt) ){
+    rc = SQLITE_IOERR_SHORT_READ;
+  }
   return rc;
 }