hp-scan segfaults when lineart selected

Bug #1349418 reported by Tim Waugh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
In Progress
Undecided
Unassigned

Bug Description

When using "hp-scan -r 2400 -m lineart", hp-scan segfaults.

It seems to happen inside python-pillow due to incorrect parameters:

hp-scan[30127]: debug: PPL=20400 lines=28064 depth=1 BPL=2550 pad=0 total=71563200

  lines=28064
  pixels_per_line=20400
  total=71563200
  buf = bytearray(total)
  im = Image.frombuffer('RGBA', (pixels_per_line, lines), buf, 'raw', 'RGBA', 0, 1).convert('L')
(segfaults, or gives a traceback with newer versions of python-pillow)

Based on the idea that 'RGBA' is the wrong parameter -- isn't the scanner giving us bw bitmap data? -- I tried this change:

diff -up hplip-3.14.6/scan.py.lineart hplip-3.14.6/scan.py
--- hplip-3.14.6/scan.py.lineart 2014-07-23 12:30:52.361517852 +0100
+++ hplip-3.14.6/scan.py 2014-07-23 12:32:17.052940000 +0100
@@ -977,8 +977,8 @@ try:
                         try:
                             pixels_per_line = bytes_per_line * 8 # Calculation of pixels_per_line for Lineart must be 8 time of bytes_per_line
                                                                           # Otherwise, scanned image will be corrupted (slanted)
- im = Image.frombuffer('RGBA', (pixels_per_line, lines), buffer.read(),
- 'raw', 'RGBA', 0, 1).convert('L')
+ im = Image.frombuffer('1', (pixels_per_line, lines), buffer.read(),
+ 'raw', '1', 0, 1).convert('L')
                         except ValueError:
                             log.error("Did not read enough data from scanner (I/O Error?)")
                             sys.exit(1)

But that also fails and seem to consume a large amount of memory in doing so.

HPLIP 3.14.6 on Fedora 20.

Original bug report:
  https://bugzilla.redhat.com/show_bug.cgi?id=1076954

Revision history for this message
goutam (goutamkk) wrote :

Hi Tim,

Thank you for reporting this issue. We will take a look at it.
Can you tell us on which device you are able to produce this issue ?

Thanks,
goutam

Changed in hplip:
status: New → In Progress
Revision history for this message
Tim Waugh (twaugh) wrote :

From the original bug report:

"Printer is an HP Deskjet 3510, connected both as USB 2 and wifi. I'd like to use the faster connection, but the choices presented by hp-scan don't indicate which is USB, and which is Wifi."

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.