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

From: Ben Stanley (bds02@uow.edu.au)
Date: Tue May 22 2001 - 15:23:51 PDT

  • Next message: Ben Stanley: "Re: Problems with Prisa 620S [snapscan] + BUG in xsane 0.76"

    Oliver Rauch wrote:

    >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.
    >
    I think that is the right thing to do (in fact that's what I did). It
    would be wrong to just allocate more memory and keep going - this just
    hides bugs in the backend. I think that the front end should detect the
    error and *not crash*. But it's ok to abort.

    >>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++ ;-))
    >
    Agreed. I've seen enough bad C++ (and bad code in general!) marking
    student assignments... Yuck!!!

    I'm looking into your other email regarding checking the returned number
    of lines.

    Thanks Oliver.
    Ben.

    --
    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 - 15:22:56 PDT