diff --git a/0001-Fix-integer-overflow-when-parsing-SOURCE_DATE_EPOCH.patch b/0001-Fix-integer-overflow-when-parsing-SOURCE_DATE_EPOCH.patch new file mode 100644 index 0000000..a3f9ccf --- /dev/null +++ b/0001-Fix-integer-overflow-when-parsing-SOURCE_DATE_EPOCH.patch @@ -0,0 +1,68 @@ +From 750924c556fbb0c431e983ec57befb9a7f070685 Mon Sep 17 00:00:00 2001 +From: Marian Koncek +Date: Fri, 3 Jun 2022 12:43:45 +0200 +Subject: [PATCH] Fix integer overflow when parsing SOURCE_DATE_EPOCH + +Upstream: https://github.com/apache/ant/pull/186/commits + +--- + .../org/apache/tools/ant/taskdefs/Tstamp.java | 2 +- + src/tests/antunit/taskdefs/tstamp-test.xml | 31 +++++++++++++++++++ + 2 files changed, 32 insertions(+), 1 deletion(-) + +diff --git a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java +index aa1034e..ca10efe 100644 +--- a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java ++++ b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java +@@ -82,7 +82,7 @@ public class Tstamp extends Task { + try { + if (epoch != null) { + // Value of SOURCE_DATE_EPOCH will be an integer, representing seconds. +- d = new Date(Integer.parseInt(epoch) * 1000); ++ d = new Date(Long.parseLong(epoch) * 1000L); + log("Honouring environment variable " + ENV_SOURCE_DATE_EPOCH + " which has been set to " + epoch); + } + } catch(NumberFormatException e) { +diff --git a/src/tests/antunit/taskdefs/tstamp-test.xml b/src/tests/antunit/taskdefs/tstamp-test.xml +index 20c3227..1553d32 100644 +--- a/src/tests/antunit/taskdefs/tstamp-test.xml ++++ b/src/tests/antunit/taskdefs/tstamp-test.xml +@@ -75,4 +75,35 @@ public class IsEpochIn1969Here implements Condition { + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +-- +2.35.1 + diff --git a/ant.spec b/ant.spec index 796cbdb..e97d426 100644 --- a/ant.spec +++ b/ant.spec @@ -34,7 +34,7 @@ Name: ant Version: 1.10.12 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Java build tool Summary(it): Tool per la compilazione di programmi java Summary(fr): Outil de compilation pour java @@ -49,6 +49,7 @@ Source2: apache-ant-1.8.ant.conf Source3: ant.asciidoc Patch0: %{name}-build.xml.patch +Patch1: 0001-Fix-integer-overflow-when-parsing-SOURCE_DATE_EPOCH.patch BuildRequires: asciidoc BuildRequires: xmlto @@ -328,6 +329,7 @@ Javadoc pour %{name}. %prep %setup -q -n apache-ant-%{version} %patch0 -p0 +%patch1 -p1 # clean jar files find . -name "*.jar" | xargs -t rm @@ -640,6 +642,9 @@ LC_ALL=C.UTF-8 %{ant} test # ----------------------------------------------------------------------------- %changelog +* Fri Jun 03 2022 Marian Koncek - 1.10.12-5 +- Fix integer overflow when parsing SOURCE_DATE_EPOCH + * Fri Apr 22 2022 Mikolaj Izdebski - 1.10.12-4 - Fix FTBFS with JUnit 5.8.x