[srecord-users] [PATCH 4/4] Fix -crop up to the last address
Brought to you by:
pmiller,
scottfinneran
|
From: Markus H. <mar...@we...> - 2014-08-12 09:45:42
|
Can be reproduced with this command:
srec_cat -generate 0xFFFFFFE0 0x100000000 -constant 0 -crop 0xFFFFFFF0 0x100000000 -o - -hex-dump
Giving this error:
srec_cat: srecord/record.cc:65: srecord::record::record(srecord::record::type_t, srecord::record::address_t, const data_t*, size_t): Assertion `length <= max_data_length' failed.
---
Makefile.in | 7 +++++--
srecord/input/filter/crop.cc | 4 ++--
test/02/t0257a.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 4 deletions(-)
create mode 100644 test/02/t0257a.sh
diff --git a/Makefile.in b/Makefile.in
index 952ee4b..eceef52 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3719,6 +3719,9 @@ t0255a: all test/02/t0255a.sh
t0256a: all test/02/t0256a.sh
PATH=`pwd`/bin:$$PATH $(SH) test/02/t0256a.sh
+t0257a: all test/02/t0257a.sh
+ PATH=`pwd`/bin:$$PATH $(SH) test/02/t0257a.sh
+
test/arglex_ambiguous/main.lo test/arglex_ambiguous/main.o: srecord/arglex.h \
srecord/arglex/tool.h srecord/defcon.h srecord/endian.h \
srecord/format_printf.h srecord/input.h srecord/output.h \
@@ -4160,7 +4163,7 @@ test_files = t0001a t0002a t0003a t0004a t0005a t0006a t0007a t0008a t0009a \
t0206a t0207a t0209a t0210a t0211a t0212a t0213a t0215a t0216a \
t0217a t0218a t0219a t0220a t0221a t0222a t0223a t0225a t0227a \
t0228a t0229a t0230a t0231a t0232a t0233a t0235a t0236a t0237a \
- t0238a t0239a t0250a t0251a t0253a t0254a t0255a t0256a
+ t0238a t0239a t0250a t0251a t0253a t0254a t0255a t0256a t0257a
sure: $(test_files)
@echo Passed All Tests
@@ -4824,7 +4827,7 @@ uninstall:
t0207a t0209a t0210a t0211a t0212a t0213a t0215a t0216a t0217a \
t0218a t0219a t0220a t0221a t0222a t0223a t0225a t0227a t0228a \
t0229a t0230a t0231a t0232a t0233a t0235a t0236a t0237a t0238a \
- t0239a t0250a t0251a t0253a t0254a t0255a t0256a \
+ t0239a t0250a t0251a t0253a t0254a t0255a t0256a t0257a \
the-default-target
# vim: set ts=8 sw=8 noet :
diff --git a/srecord/input/filter/crop.cc b/srecord/input/filter/crop.cc
index a2b79ba..4d432ac 100644
--- a/srecord/input/filter/crop.cc
+++ b/srecord/input/filter/crop.cc
@@ -116,8 +116,8 @@ srecord::input_filter_crop::read(srecord::record &record)
//
// Construct the return record from the data held.
//
- unsigned long lo = fragment.get_lowest();
- unsigned long hi = fragment.get_highest();
+ interval::data_t lo = fragment.get_lowest();
+ interval::data_t hi = fragment.get_highest();
record =
srecord::record
(
diff --git a/test/02/t0257a.sh b/test/02/t0257a.sh
new file mode 100644
index 0000000..0d88936
--- /dev/null
+++ b/test/02/t0257a.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# srecord - Manipulate EPROM load files
+# Copyright (C) 2009, 2011, 2012 Peter Miller
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+TEST_SUBJECT="crop up to the last address"
+. test_prelude
+
+cat > test.ok << 'fubar'
+S00600004844521B
+S315FFFFFFF000000000000000000000000000000000FD
+S5030001FB
+fubar
+if test $? -ne 0; then no_result; fi
+
+srec_cat -generate 0xFFFFFFE0 0x100000000 -constant 0 \
+ -crop 0xFFFFFFF0 0x100000000 -o test.out -header HDR
+if test $? -ne 0; then fail; fi
+
+diff test.ok test.out
+if test $? -ne 0; then fail; fi
+
+#
+# The things tested here, worked.
+# No other guarantees are made.
+#
+pass
+
+# vim: set ts=8 sw=4 et :
--
2.0.4
|