1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-29 10:18:30 +00:00

Improve portability and allow for building with GCC 4.9 and above.

This backports some upstream fixes.

PR:		197909
Submitted by:	Fabian Keil <fk@fabiankeil.de> (maintainer)
This commit is contained in:
Gerald Pfeifer 2015-03-22 01:24:46 +00:00
parent b18cecc458
commit d877915549
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=381884
3 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From c91f7bbf3e0eedb080319ba3cfed7b47597b5aeb Mon Sep 17 00:00:00 2001
From: Yawning Angel <yawning@torproject.org>
Date: Sun, 20 Apr 2014 16:52:06 +0000
Subject: Fix a potential bug found by clang's scan-build.
With all current uses of Ctr, the conditional I was missing is never
triggered since the paramenters are guaranteed to be sane, but this is
not guaranteed to be true in the future.
scan-build also points out a bunch of things in easylogging++ and gtest
but they don't look to be real problems.
---
ChangeLog | 2 ++ [diff removed]
src/schwanenlied/crypto/ctr.h | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/schwanenlied/crypto/ctr.h b/src/schwanenlied/crypto/ctr.h
index 79bb71b..92d932d 100644
--- src/schwanenlied/crypto/ctr.h
+++ src/schwanenlied/crypto/ctr.h
@@ -91,6 +91,8 @@ class Ctr {
return false;
if (ctr_len == 0)
return false;
+ if ((iv == nullptr && iv_len != 0) || (iv != nullptr && iv_len == 0))
+ return false;
if (ctr_len + iv_len != ecb_impl_.block_length())
return false;
@@ -100,7 +102,8 @@ class Ctr {
return false;
iv_size_ = iv_len;
- ::std::memcpy(&ctr_[0], iv, iv_len);
+ if (iv != nullptr)
+ ::std::memcpy(&ctr_[0], iv, iv_len);
::std::memcpy(&ctr_[iv_len], ctr, ctr_len);
has_state_ = true;
--
2.3.0

View File

@ -0,0 +1,31 @@
From 85dd63b32a0b77c57cbae224f7862a5fb9c069a8 Mon Sep 17 00:00:00 2001
From: Yawning Angel <yawning@torproject.org>
Date: Sat, 14 Jun 2014 22:42:35 +0000
Subject: Fix build on GCC 4.9.0.
Just potentially uninitialized warnings in the 3rd party command line
option parsing code, probably spurious and should be ignored but,
initialize them for now.
---
src/ext/optionparser.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ext/optionparser.h b/src/ext/optionparser.h
index 17bf6ad..64e2dfc 100644
--- src/ext/optionparser.h
+++ src/ext/optionparser.h
@@ -1554,9 +1554,9 @@ inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, c
do // loop over short options in group, for long options the body is executed only once
{
- int idx;
+ int idx = 0;
- const char* optarg;
+ const char* optarg = 0;
/******************** long option **********************/
if (handle_short_options == false || try_single_minus_longopt)
--
2.3.0

View File

@ -0,0 +1,30 @@
From 9c164b2afb666d0bcd26ba3eeb6da07a9fff551c Mon Sep 17 00:00:00 2001
From: Yawning Angel <yawning@torproject.org>
Date: Sat, 14 Jun 2014 23:09:08 +0000
Subject: Suppress more useless warnings.
Apparently I forgot to check the IAT code when I switched to building
wiht -Wextra, since no one should use it.
---
src/schwanenlied/pt/scramblesuit/client.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/schwanenlied/pt/scramblesuit/client.cc b/src/schwanenlied/pt/scramblesuit/client.cc
index e967b7b..c6e1a20 100644
--- src/schwanenlied/pt/scramblesuit/client.cc
+++ src/schwanenlied/pt/scramblesuit/client.cc
@@ -468,8 +468,10 @@ bool Client::schedule_iat_transmit() {
// Lazy timer initialization
if (iat_timer_ev_ == nullptr) {
event_callback_fn cb = [](evutil_socket_t sock,
- short witch,
+ short which,
void* arg) {
+ (void)sock;
+ (void)which;
reinterpret_cast<Client*>(arg)->on_iat_transmit();
};
iat_timer_ev_ = evtimer_new(base_, cb, this);
--
2.3.0