Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64110 #1236

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

sashashura
Copy link
Contributor

No description provided.

@sashashura sashashura requested a review from seladb as a code owner November 12, 2023 17:50
Copy link

codecov bot commented Nov 12, 2023

Codecov Report

Merging #1236 (2fef455) into dev (0c95dfb) will decrease coverage by 0.01%.
Report is 2 commits behind head on dev.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##              dev    #1236      +/-   ##
==========================================
- Coverage   82.74%   82.73%   -0.01%     
==========================================
  Files         159      159              
  Lines       20302    20310       +8     
  Branches     7679     7681       +2     
==========================================
+ Hits        16798    16803       +5     
- Misses       2882     2885       +3     
  Partials      622      622              
Flag Coverage Δ
alpine317 72.38% <0.00%> (-0.02%) ⬇️
centos7 74.54% <0.00%> (-0.02%) ⬇️
fedora37 72.34% <0.00%> (-0.07%) ⬇️
macos-11 61.36% <50.00%> (+<0.01%) ⬆️
macos-12 61.41% <50.00%> (+<0.01%) ⬆️
macos-ventura 61.39% <50.00%> (-0.01%) ⬇️
mingw32 70.26% <0.00%> (-0.04%) ⬇️
mingw64 70.26% <0.00%> (-0.06%) ⬇️
npcap 83.26% <80.00%> (-0.04%) ⬇️
ubuntu1804 75.01% <33.33%> (+<0.01%) ⬆️
ubuntu2004 73.12% <0.00%> (-0.07%) ⬇️
ubuntu2204 72.23% <0.00%> (-0.02%) ⬇️
ubuntu2204-icpx 59.27% <25.00%> (-0.02%) ⬇️
unittest 82.73% <83.33%> (-0.01%) ⬇️
windows-2019 83.29% <80.00%> (-0.02%) ⬇️
windows-2022 83.31% <80.00%> (-0.01%) ⬇️
winpcap 83.28% <80.00%> (+<0.01%) ⬆️
zstd 73.77% <50.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
Packet++/header/GreLayer.h 95.83% <100.00%> (+2.08%) ⬆️
Packet++/src/IPv4Layer.cpp 90.07% <100.00%> (ø)
Packet++/src/IPv6Layer.cpp 76.56% <0.00%> (ø)

... and 3 files with indirect coverage changes

Comment on lines 293 to 301
{
if (GREv0Layer::isDataValid(payload, payloadLen))
m_NextLayer = new GREv0Layer(payload, payloadLen, this, m_Packet);
}
else if (greVer == GREv1)
m_NextLayer = new GREv1Layer(payload, payloadLen, this, m_Packet);
{
if (GREv1Layer::isDataValid(payload, payloadLen))
m_NextLayer = new GREv1Layer(payload, payloadLen, this, m_Packet);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit nicer to do:

if (greVer == GREv0 && GREv0Layer::isDataValid(payload, payloadLen))
	m_NextLayer = new GREv0Layer(payload, payloadLen, this, m_Packet);
else if (greVer == GREv1 && GREv1Layer::isDataValid(payload, payloadLen))
	m_NextLayer = new GREv1Layer(payload, payloadLen, this, m_Packet);
else
	m_NextLayer = new PayloadLayer(payload, payloadLen, this, m_Packet);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it means if it is GREv0 and invalid, it will go to new PayloadLayer.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we always want to have a next layer... the default is PayloadLayer if there is no better option...

Comment on lines 245 to 253
{
if (GREv0Layer::isDataValid(payload, payloadLen))
m_NextLayer = new GREv0Layer(payload, payloadLen, this, m_Packet);
}
else if (greVer == GREv1)
m_NextLayer = new GREv1Layer(payload, payloadLen, this, m_Packet);
{
if (GREv1Layer::isDataValid(payload, payloadLen))
m_NextLayer = new GREv1Layer(payload, payloadLen, this, m_Packet);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@seladb seladb merged commit a0ecc6d into seladb:dev Nov 14, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants