Re: Problems with Prisa 620S [snapscan] + BUG in xsane 0.76

From: Oliver Rauch (oliver.rauch@rauch-domain.de)
Date: Tue May 22 2001 - 09:02:50 PDT

  • Next message: Henning Meier-Geinitz: "Re: PNM device configuration"

    Ben Stanley wrote:
     
    > I read the sane.ps API documentation, and by running xsane under a
    > debugger it appears that the scanner is sending too much data. I added a
    > check into xsane-preview.c, preview_increment_image_y, which checks if
    > p->image_y >= p->image_height. If this is true, the buffer will be
    > overrun. Perhaps this is legal on the last iteration in the read, but I
    > think that a check of this kind needs to be made. Perhaps there is
    > another place in the code where it would be more appropriate. At least
    > my xsane reports an error now instead of seg faulting :-).
    >

    Hi ben,

    I will think about that.
    The first step is to make the backend return the correct values.
    I think xsane should not read more data than given in sane_get_parameters
    so may be it is better to cancel the scan than to read more image data.

    > BTW, a BUG in xsane in increment_image_y: if there is an error, and
    > xsane_back_gtk_error is called, then preview_read_image_data will be
    > called (by gtk io scheduler), resulting in a seg fault. It seems that
    > calling preview_scan_done before calling xsane_back_gtk_error fixes this
    > problem, although the value of errno must be saved before calling
    > preview_scan_done() for use in generating the error message.

    Hm, I will take a look at that.

    > and redirecting the output. I checked the size inquiry before the scan
    > data was read, and from the get_parameters call which occurs just after
    > the scan started. It seems that these two are not returning the same
    > number of lines. should they be? I can post log output if you want.

    The sane standard says that after sane_start has called
    sane_get_parameters has to return exact values. So the first call
    has to return correct values, everything else is a backend bug.

    > I'm a C++ programmer, and I find the C way of doing this stuff to be a
    > bit 'messy' by comparison, but them's the breaks when you use other
    > people's software.

    A good written C code is not messy, but in fact some backends are messy
    (but you also can write messy code in C++ ;-))

    I suggest you contact the backend author and discuss the problem with him.

    Bye
    Oliver

    -- 
    Homepage:	http://www.rauch-domain.de
    sane-umax:	http://www.rauch-domain.de/sane-umax
    xsane:		http://www.xsane.org
    E-Mail:		mailto:Oliver.Rauch@rauch-domain.de
    

    -- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com



    This archive was generated by hypermail 2b29 : Tue May 22 2001 - 10:34:25 PDT