[Bug 1868] Optimized builds are sensitive to -fstrict-overflow
This commit is contained in:
@@ -1313,7 +1313,8 @@ uint8_t DsrOptionSR::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Address
|
||||
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);
|
||||
|
||||
@@ -1910,10 +1910,11 @@ uint32_t Icmpv6OptionLinkLayerAddress::Deserialize (Buffer::Iterator start)
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
@@ -247,7 +247,8 @@ uint16_t
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -657,7 +657,8 @@ LteMiErrorModel::GetTbDecodificationStats (const SpectrumValue& sinr, const std:
|
||||
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;
|
||||
|
||||
@@ -108,7 +108,12 @@ IePerr::AddAddressUnit (HwmpProtocol::FailedDestination unit)
|
||||
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
|
||||
|
||||
@@ -423,7 +423,8 @@ IePreq::MayAddAddress (Mac48Address originator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((GetInformationFieldSize () + 11) > 255)
|
||||
// -fstrict-overflow sensitive, see bug 1868
|
||||
if ( GetInformationFieldSize () > 255 - 11 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -432,7 +433,8 @@ IePreq::MayAddAddress (Mac48Address originator)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user