[PATCH 1/2] MAMDA: LLVM 5.1 Fixes - pointer dereference


Philip Preston
 

XCode 5.1 update includes LLVM 5.1 (CLang 3.4) which now fires a number of build errors.

Number of files dealing with partid on multi participant feeds do not dereference the pointer to the last dot char, before comparing to the null terminating character. Compiler throws an error comparison of pointer against int.

Signed-off-by: Phil Preston <philippreston@mac.com>
---
mamda/c_cpp/src/cpp/MamdaMultiParticipantManager.cpp | 2 +-
mamda/c_cpp/src/cpp/MamdaUtils.cpp | 2 +-
mamda/c_cpp/src/cpp/orderbooks/MamdaBookAtomicListener.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mamda/c_cpp/src/cpp/MamdaMultiParticipantManager.cpp b/mamda/c_cpp/src/cpp/MamdaMultiParticipantManager.cpp
index 3a5b72f..0f6dfe7 100644
--- a/mamda/c_cpp/src/cpp/MamdaMultiParticipantManager.cpp
+++ b/mamda/c_cpp/src/cpp/MamdaMultiParticipantManager.cpp
@@ -367,7 +367,7 @@ namespace Wombat

if (lastDot)
{
- if (lastDot+1 != '\0')
+ if (*(lastDot+1) != '\0')
partId = lastDot +1;
}

diff --git a/mamda/c_cpp/src/cpp/MamdaUtils.cpp b/mamda/c_cpp/src/cpp/MamdaUtils.cpp
index ffc85f4..71f5866 100644
--- a/mamda/c_cpp/src/cpp/MamdaUtils.cpp
+++ b/mamda/c_cpp/src/cpp/MamdaUtils.cpp
@@ -62,7 +62,7 @@ namespace Wombat

if (lastDot!= NULL)
{
- if (lastDot+1 != '\0')
+ if (*(lastDot+1) != '\0')
{
partId = lastDot+1;
}
diff --git a/mamda/c_cpp/src/cpp/orderbooks/MamdaBookAtomicListener.cpp b/mamda/c_cpp/src/cpp/orderbooks/MamdaBookAtomicListener.cpp
index 40a07f2..c6beaea 100644
--- a/mamda/c_cpp/src/cpp/orderbooks/MamdaBookAtomicListener.cpp
+++ b/mamda/c_cpp/src/cpp/orderbooks/MamdaBookAtomicListener.cpp
@@ -534,7 +534,7 @@ namespace Wombat
const char* lastDot = strrchr (symbol, '.');
if (lastDot!= NULL)
{
- if (lastDot+1 != '\0')
+ if (*(lastDot+1) != '\0')
{
partId = lastDot+1;
mPartId = partId;
--
1.8.5.2 (Apple Git-48)


Damian Maguire <DMaguire@...>
 

Cheers Phil, 

I've stuck this into bugzilla for tracking, BZ84. I've also added a quick comment about some additional info we need, so would be good to get that when you get a chance. Nice excuse for me to upgrade my dev environment to 3.4 anyway ;-)

Cheers, 

D

Damian Maguire – Senior R&D and OpenMAMA Specialist
IntercontinentalExchange | NYSE Technologies
24-26 Adelaide Exchange | Belfast, BT2 8GD
Tel: +44 2890 822 282 (ext: 452161) | Mob: +44 7540 204 077

From: Philip Preston <philippreston@...>
Date: Wednesday, April 2, 2014 8:56 PM
To: OpenMAMA Dev List <openmama-dev@...>
Subject: [Openmama-dev] [PATCH 1/2] MAMDA: LLVM 5.1 Fixes - pointer dereference

XCode 5.1 update includes LLVM 5.1 (CLang 3.4) which now fires a number of build errors.

Number of files dealing with partid on multi participant feeds do not dereference the pointer to the last dot char, before comparing to the null terminating character.  Compiler throws an error comparison of pointer against int.

Signed-off-by: Phil Preston <philippreston@...>

This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.