[sane-devel] saned issues for remote scanner access

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 22 Feb 2004 10:48:06 +0100


Hi,

On Sat, Feb 21, 2004 at 11:40:09PM -0000, Jim George wrote:
> The system works well directly and through saned, however it fails when
> accessing saned remotely.  I have attached the output of the following
> command to see if this gives anyone any clue to help me?
> 
> SANE_DEBUG_SANEI_PAS4S2=255 saned -d128

If you ant to get debug output from the backend, use
SANE_DEBUG_GT68XX. SANE_DEBUG_SANEI_PA4S2 is for Mustek parallel port
scanners.

> [saned] process_request: got request 8

That's SANE_NET_CANCEL.

> [saned] decode_handle: cancel: error while decoding handle argument (h=0, Success)
> Segmentation fault

That's mostly for Julien:

The code in saned looks like this:

    h = decode_handle (w, "cancel");

and in decode_handle():

  if (w->status || (unsigned) h >= (unsigned) num_handles || !handle[h].inuse)
    {
      DBG (DBG_ERR,
         "decode_handle: %s: error while decoding handle argument "
	    "(h=%d, %s)\n", op, h, strerror (w->status));
      return -1;
    }      

Now again in the main part of saned:

    sane_cancel (handle[h].handle);

That's called with h = -1. Either that causes a segfault or the call
to sane_cancle of the gt68xx backend with some random handle causes
the segfault.

I guess saned should check for -1 here before calling sane_cancel.

I don't understand why the handle was wither not in use or <
num_handles, however.

Bye,
  Henning