MB-19306: Do not let fdb_get_byoffset() access out of bounds memory
MB-19306: Do not let fdb_get_byoffset() access out of bounds memory

10:18:34 WARNING: ThreadSanitizer: heap-use-after-free (pid=226090)
10:18:34   Read of size 1 at 0x7d8000618000 by main thread:
10:18:34     #0 memcpy <null> (fdb_functional_test+0x000000462790)
10:18:34     #1 _docio_read_length(docio_handle*, unsigned long, docio_length*, err_log_callback*, bool) /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/docio.cc:794 (fdb_functional_test+0x0000004faad5)
10:18:34     #2 docio_read_doc /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/docio.cc:1214 (fdb_functional_test+0x0000004fba3f)
10:18:34     #3 fdb_get_byoffset /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/forestdb.cc:3483 (fdb_functional_test+0x00000051313c)
10:18:34     #4 invalid_get_byoffset_test() crtstuff.c (fdb_functional_test+0x0000004e16cd)
10:18:34     #5 main crtstuff.c (fdb_functional_test+0x0000004e264b)
10:18:34
10:18:34   Previous write of size 8 at 0x7d8000618000 by main thread:
10:18:34     [failed to restore the stack]

Change-Id: I59af475900ad30f24190e2710a8e67c9689c0d3a
Reviewed-on: http://review.couchbase.org/63111
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Sundararaman Sridharan <333a3f71d3ad6e01fc953c4fa06bc1f3cd014910@couchbase.com>
Reviewed-by: Chiyoung Seo <fcffc23db27b19ee4ebba46695ee6b50e09216a2@couchbase.com>

hisundar/forestdb,couchbase/forestdb,hisundar/forestdb,wurikiji/forestdb,couchbase/forestdb,wurikiji/forestdb