Re:( XSane parameters or buffer bug

From: mh (crapsite@gmx.net)
Date: Thu May 10 2001 - 09:55:28 PDT

  • Next message: Henning Meier-Geinitz: "Re: saned won't run under inetd"

    Oliver Rauch, Don, 10 Mai 2001 :
    > mh wrote:
    >
    > > I don't know whether one should call it a bug in XSane; at least it could be
    > > easily solved by calling sane_get_parameters() after sane_start() has been
    > > called. (Oliver?)
    >
    > XSane does call sane_get parameters after sane_start:
    [...]
    > So if xsane gets wrong parameters it is the fault of the backend.
    >
    > I also do not see an error in the scanning routine.
    > May be there could happen something in the transformation routines
    > (jpeg/tiff/png/...).

    Hmm, you call sane_get_parameters() after sane_start() (sorry for my wrong
    description, I obviously didn't recall correctly:).
    But you calculate the xsane.gamma_value_blue (..red, green..)
    values before a call to sane_start(), using params.depth (which, in case of the
    old plustek backend was 0)?
    This caused a segfault in xsane_read_image_data() in the lines

    if (!xsane.scanner_gamma_color) /* do gamma correction by xsane */
    {
      buf8ptr = buf8;
      for (i=0; i < len; ++i)
      {
        if (xsane.pixelcolor == 0)
        {
          *buf8ptr = xsane.gamma_data_red[(int) (*buf8ptr)]; //PROBLEM
          buf8ptr++;
          xsane.pixelcolor++;
        }
        else if (xsane.pixelcolor == 1)
      {
    .......

    If the backend doesn't return correct values before a call to sane_start(),
    xsane.gamma_data_red (...blue,...green) might have the wrong (array-)size or
    even be 0, because you don't update these values after sane_start().

    Or am I wrong again?

    Michael

    --
    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 : Thu May 10 2001 - 10:36:02 PDT