--- a/src/dsr/model/dsr-options.cc Thu Feb 27 09:45:55 2014 -0500
+++ b/src/dsr/model/dsr-options.cc Sun Mar 02 00:42:05 2014 -0800
@@ -1313,7 +1313,8 @@
m_dropTrace (packet);
return 0;
}
- if (numberAddress - segsLeft - 2 < 0) // The index is invalid
+ // -fstrict-overflow sensitive, see bug 1868
+ if (numberAddress - segsLeft < 2) // The index is invalid
{
NS_LOG_LOGIC ("Malformed header. Drop!");
m_dropTrace (packet);
--- a/src/internet/model/icmpv6-header.cc Thu Feb 27 09:45:55 2014 -0500
+++ b/src/internet/model/icmpv6-header.cc Sun Mar 02 00:42:05 2014 -0800
@@ -1910,10 +1910,11 @@
SetType (i.ReadU8 ());
SetLength (i.ReadU8 ());
- NS_ASSERT (GetLength () * 8 - 2 <= 32);
+ // -fstrict-overflow sensitive, see bug 1868
+ NS_ASSERT (GetLength () * 8 <= 32 + 2);
i.Read (mac, (GetLength () * 8) - 2);
- m_addr.CopyFrom (mac, (GetLength () * 8)-2);
+ m_addr.CopyFrom (mac, (GetLength () * 8) - 2);
return GetSerializedSize ();
}
--- a/src/internet/model/ipv4-header.cc Thu Feb 27 09:45:55 2014 -0500
+++ b/src/internet/model/ipv4-header.cc Sun Mar 02 00:42:05 2014 -0800
@@ -247,7 +247,8 @@
Ipv4Header::GetFragmentOffset (void) const
{
NS_LOG_FUNCTION (this);
- if ((m_fragmentOffset+m_payloadSize+5*4) > 65535)
+ // -fstrict-overflow sensitive, see bug 1868
+ if ( m_fragmentOffset + m_payloadSize > 65535 - 5*4 )
{
NS_LOG_WARN("Fragment will exceed the maximum packet size once reassembled");
}
--- a/src/lte/model/lte-mi-error-model.cc Thu Feb 27 09:45:55 2014 -0500
+++ b/src/lte/model/lte-mi-error-model.cc Sun Mar 02 00:42:05 2014 -0800
@@ -657,7 +657,8 @@
else
{
// second segmentation size: K- = maximum K in table such that K < K+
- Kminus = cbSizeTable[KplusId-1 > 0 ? KplusId-1 : 0];
+ // -fstrict-overflow sensitive, see bug 1868
+ Kminus = cbSizeTable[ KplusId > 1 ? KplusId - 1 : 0];
deltaK = Kplus - Kminus;
Cminus = floor ((((double) C * Kplus) - (double)B1) / (double)deltaK);
Cplus = C - Cminus;
--- a/src/mesh/model/dot11s/ie-dot11s-perr.cc Thu Feb 27 09:45:55 2014 -0500
+++ b/src/mesh/model/dot11s/ie-dot11s-perr.cc Sun Mar 02 00:42:05 2014 -0800
@@ -108,7 +108,12 @@
bool
IePerr::IsFull () const
{
- return (GetInformationFieldSize () + 2 /* ID + LENGTH*/+ 10 /* Size of Mac48Address + uint32_t (one unit)*/> 255);
+ // -fstrict-overflow sensitive, see bug 1868
+ return (GetInformationFieldSize ()
+ > 255
+ - 2 /* ID + LENGTH*/
+ - 10 /* Size of Mac48Address + uint32_t (one unit)*/
+ );
}
std::vector<HwmpProtocol::FailedDestination>
IePerr::GetAddressUnitVector () const
--- a/src/mesh/model/dot11s/ie-dot11s-preq.cc Thu Feb 27 09:45:55 2014 -0500
+++ b/src/mesh/model/dot11s/ie-dot11s-preq.cc Sun Mar 02 00:42:05 2014 -0800
@@ -423,7 +423,8 @@
{
return false;
}
- if ((GetInformationFieldSize () + 11) > 255)
+ // -fstrict-overflow sensitive, see bug 1868
+ if ( GetInformationFieldSize () > 255 - 11 )
{
return false;
}
@@ -432,7 +433,8 @@
bool
IePreq::IsFull () const
{
- return ((GetInformationFieldSize () + 11) > 255);
+ // -fstrict-overflow sensitive, see bug 1868
+ return ( GetInformationFieldSize () > 255 - 11 );
}
std::ostream &
operator << (std::ostream &os, const IePreq &a)