[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

storeio and libstore bugs

From: Marcus Brinkmann
Subject: storeio and libstore bugs
Date: Mon, 11 Mar 2002 01:51:35 +0100
User-agent: Mutt/1.3.27i


when reading past the end of a storeio provided file, you get EIO because
offset is equal to the size of the underlying store, but the only offset
check is in dev_rw:

  if (offs < 0 || offs > dev->store->size)
    return EINVAL;
  else if (offs + len > dev->store->size)
    len = dev->store->size - offs;

First, it is strange that offs = dev->store->size is explicitely allowed.
Note that in this case, len will be 0, and storeio is doing a lot of
unnecessary work.  It will eventually fail in store_read because it can not
find a store run for suhc large an offset:

  addr = store_find_first_run (store, addr, &run, &runs_end, &base, &index);
  if (addr < 0 || run->start < 0)
    return EIO;                 /* Reading from a hole.  */

Now, I have looked into it a bit, but I am unsure where the guard should be
put.  All those layers confuse me a bit.

BTW, I have fixed a couple of bugs in the concat store.  It has never worked!
Now it does, and encoding/decoding, too.  Other stores that don't have an
open function (mvol, ileave) can not work anymore, too, because the argp
parser checks that the store has an open function.  Should we add open
functions for all the stores lacking them?


`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]