Package: avrdude
Version: 6.1-2
Severity: important
Tags: patch

Avrdude is crashing on a zero eeprom size:

avrdude -pm128rfa1 -c arduino -P/dev/ttyUSB5 -b57600 -e -U \
    flash:w:foo.hex:a -U \
    eeprom:w:foo.eep:a

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1ea701
avrdude: erasing chip
avrdude: reading input file "foo.hex"
avrdude: input file foo.hex auto detected as Intel Hex
avrdude: writing flash (60774 bytes):

Writing | ################################################## | 100% 14.50s

avrdude: 60774 bytes of flash written
avrdude: verifying flash memory against foo.hex:
avrdude: load data flash data from input file foo.hex:
avrdude: input file foo.hex auto detected as Intel Hex
avrdude: input file foo.hex contains 60774 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 11.19s

avrdude: verifying ...
avrdude: 60774 bytes of flash verified
avrdude: reading input file "foo.eep"
avrdude: input file foo.eep auto detected as Intel Hex
avrdude: writing eeprom (0 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 0 bytes of eeprom written
avrdude: verifying eeprom memory against foo.eep:
avrdude: load data eeprom data from input file foo.eep:
avrdude: input file foo.eep auto detected as Intel Hex
avrdude: input file foo.eep contains 0 bytes
avrdude: reading on-chip eeprom data:

Reading |                                                    | 0% 
0.00sMakefile:88: recipe for target 'flash' failed
make: *** [flash] Floating point exception (core dumped)

This is fixed by upstream revision 1340. Tested patch attached.
Cheers,
 -- Guido

-- System Information:
Debian Release: 8.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'unstable'), 
(500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-rc6 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages avrdude depends on:
ii  libc6         2.19-18
ii  libelf1       0.159-4.2
ii  libftdi1      0.20-2
ii  libncurses5   5.9+20140913-1+b1
ii  libreadline6  6.3-8+b3
ii  libtinfo5     5.9+20140913-1+b1
ii  libusb-0.1-4  2:0.1.12-25

avrdude recommends no packages.

Versions of packages avrdude suggests:
pn  avrdude-doc  <none>

-- no debconf information
>From 921d13272d55f8bc1baaf9f86b9fc2b6ee960ca9 Mon Sep 17 00:00:00 2001
Message-Id: <921d13272d55f8bc1baaf9f86b9fc2b6ee960ca9.1434100250.git....@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org>
Date: Fri, 12 Jun 2015 10:51:02 +0200
Subject: [PATCH] Avoid division by zero on empty size

---
 .../Avoid-division-by-zero-on-empty-size.patch     | 25 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 debian/patches/Avoid-division-by-zero-on-empty-size.patch

diff --git a/debian/patches/Avoid-division-by-zero-on-empty-size.patch b/debian/patches/Avoid-division-by-zero-on-empty-size.patch
new file mode 100644
index 0000000..62e7992
--- /dev/null
+++ b/debian/patches/Avoid-division-by-zero-on-empty-size.patch
@@ -0,0 +1,25 @@
+From: =?utf-8?q?Guido_G=C3=BCnther?= <a...@sigxcpu.org>
+Date: Fri, 12 Jun 2015 10:49:52 +0200
+Subject: Avoid division by zero on empty size
+
+Basically a cherry-pick of revision 1340 in SVN fixing a
+floating point exception.
+
+Bug: http://savannah.nongnu.org/bugs/?40142
+---
+ avr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/avr.c b/avr.c
+index 3b4c872..a04b2da 100644
+--- a/avr.c
++++ b/avr.c
+@@ -1238,7 +1238,7 @@ void report_progress (int completed, int total, char *hdr)
+ {
+   static int last = 0;
+   static double start_time;
+-  int percent = (completed * 100) / total;
++  int percent = (total > 0) ? ((completed * 100) / total) : 100;
+   struct timeval tv;
+   double t;
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 999888d..b742fde 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Fix-paths-in-the-man-page.patch
 0002-FT245R-correct-reset-ftdi_syncbb.patch
 0003-Fix-Linux-GPIO-pindefs-typo.patch
+Avoid-division-by-zero-on-empty-size.patch
-- 
2.1.4

Reply via email to