-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Warnint 64to32 6186 v23.2 #11705
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
Warnint 64to32 6186 v23.2 #11705
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1107,9 +1107,9 @@ static bool GetAppBuffer(const TcpStream *stream, const uint8_t **data, uint32_t | |
| "got data at %"PRIu64". GAP of size %"PRIu64, | ||
| offset, blk->offset, blk->offset - offset); | ||
| *data = NULL; | ||
| *data_len = blk->offset - offset; | ||
| *data_len = (uint32_t)(blk->offset - offset); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not actually sure if we can't get a gap > 4GiB... It seems unlikely for sure. I guess we'd get all confused anyway due to sequence number wrapping around.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How could we tell that the GAP is over 4Gbytes with TCP ?
Indeed |
||
|
|
||
| /* block starts before offset, but ends after */ | ||
| /* block starts before offset, but ends after */ | ||
| } else if (offset > blk->offset && offset <= (blk->offset + blk->len)) { | ||
| SCLogDebug("get data from offset %"PRIu64". SBB %"PRIu64"/%u", | ||
| offset, blk->offset, blk->len); | ||
|
|
@@ -1199,7 +1199,7 @@ static inline uint32_t AdjustToAcked(const Packet *p, | |
| /* see if the buffer contains unack'd data as well */ | ||
| if (app_progress <= last_ack_abs && app_progress + data_len > last_ack_abs) { | ||
| uint32_t check = data_len; | ||
| adjusted = last_ack_abs - app_progress; | ||
| adjusted = (uint32_t)(last_ack_abs - app_progress); | ||
| BUG_ON(adjusted > check); | ||
| SCLogDebug("data len adjusted to %u to make sure only ACK'd " | ||
| "data is considered", adjusted); | ||
|
|
@@ -1429,7 +1429,7 @@ static int GetRawBuffer(const TcpStream *stream, const uint8_t **data, uint32_t | |
| uint64_t delta = offset - (*iter)->offset; | ||
| if (delta < mydata_len) { | ||
| *data = mydata + delta; | ||
| *data_len = mydata_len - delta; | ||
| *data_len = (uint32_t)(mydata_len - delta); | ||
| *data_offset = offset; | ||
| } else { | ||
| SCLogDebug("no data (yet)"); | ||
|
|
@@ -1513,7 +1513,8 @@ void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, const uint64_ | |
| } | ||
|
|
||
| if (progress > STREAM_RAW_PROGRESS(stream)) { | ||
| uint32_t slide = progress - STREAM_RAW_PROGRESS(stream); | ||
| DEBUG_VALIDATE_BUG_ON(progress - STREAM_RAW_PROGRESS(stream) > UINT32_MAX); | ||
| uint32_t slide = (uint32_t)(progress - STREAM_RAW_PROGRESS(stream)); | ||
| stream->raw_progress_rel += slide; | ||
| stream->flags &= ~STREAMTCP_STREAM_FLAG_TRIGGER_RAW; | ||
|
|
||
|
|
@@ -1525,7 +1526,8 @@ void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, const uint64_ | |
| target = GetAbsLastAck(stream); | ||
| } | ||
| if (target > STREAM_RAW_PROGRESS(stream)) { | ||
| uint32_t slide = target - STREAM_RAW_PROGRESS(stream); | ||
| DEBUG_VALIDATE_BUG_ON(target - STREAM_RAW_PROGRESS(stream) > UINT32_MAX); | ||
| uint32_t slide = (uint32_t)(target - STREAM_RAW_PROGRESS(stream)); | ||
| stream->raw_progress_rel += slide; | ||
| } | ||
| stream->flags &= ~STREAMTCP_STREAM_FLAG_TRIGGER_RAW; | ||
|
|
@@ -1796,7 +1798,7 @@ static int StreamReassembleRawDo(const TcpSession *ssn, const TcpStream *stream, | |
| /* see if the buffer contains unack'd data as well */ | ||
| if (progress + mydata_len > re) { | ||
| uint32_t check = mydata_len; | ||
| mydata_len = re - progress; | ||
| mydata_len = (uint32_t)(re - progress); | ||
| BUG_ON(check < mydata_len); | ||
| SCLogDebug("data len adjusted to %u to make sure only ACK'd " | ||
| "data is considered", mydata_len); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs in it's own commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and own issue and SV test with https://redmine.openinfosecfoundation.org/issues/7311