bugfix: Fix invalid data handling in deserialization

When loading from sysfile, it is possible that the 'size'
read is junk data when there was no persisted blobs, and is too large causing
'length_error' or 'bad_alloc' to be raised. Improve handling by

1) Returning empty string if 'size' specified is 0 or too large.
2) Ignoring all but system_error which is thrown from sysfile read operation.
3) Not commiting the empty blob when no persisted data is found.
4) Adding more unit tests.

Resolves openbmc/phosphor-ipmi-blobs-binarystore#1

Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: Iee16cf5254242856efe6bcca59ef2ca7c4f09c7c
diff --git a/sys_file.hpp b/sys_file.hpp
index 5a2bb85..63110d2 100644
--- a/sys_file.hpp
+++ b/sys_file.hpp
@@ -34,8 +34,10 @@
      * @param pos The byte pos into the file to read from
      * @param count How many bytes to read
      * @returns The data read in a vector, whose size might be smaller than
-     *          count if there is not enough to read.
+     *          count if there is not enough to read. Might be empty if the
+     *          count specified is too large to even fit in a std::string.
      * @throws std::system_error if read operation cannot be completed
+     *         std::bad_alloc if cannot construct string with 'count' size
      */
     virtual std::string readAsStr(size_t pos, size_t count) const = 0;