Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SIONfwd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cstao-public
SIONlib
SIONfwd
Commits
d20a9afc
Commit
d20a9afc
authored
Feb 11, 2021
by
Benedikt Steinbusch
Browse files
Options
Downloads
Patches
Plain Diff
fix out of bounds exception on 0 length pread and pwrite messages
parent
599587ba
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#59540
passed
Feb 11, 2021
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
src/server.cxx
+2
-2
2 additions, 2 deletions
src/server.cxx
src/test-client.c
+8
-0
8 additions, 0 deletions
src/test-client.c
with
14 additions
and
2 deletions
CHANGELOG.md
+
4
−
0
View file @
d20a9afc
...
@@ -12,4 +12,8 @@
...
@@ -12,4 +12,8 @@
-
`boost::variant`
has been replaced by
`std::variant`
and Boost is no longer needed as a dependency
-
`boost::variant`
has been replaced by
`std::variant`
and Boost is no longer needed as a dependency
-
If no explicit choice is made via
`CMAKE_POSITION_INDEPENDENT_CODE`
, the client library defaults to being built as position independent code
-
If no explicit choice is made via
`CMAKE_POSITION_INDEPENDENT_CODE`
, the client library defaults to being built as position independent code
### Fixed
-
Pread and pwrite messages of length 0 were handled incorrectly by the server, leading to an out of bounds exception
[
Unreleased
]:
https://gitlab.version.fz-juelich.de/SIONlib/SIONfwd/-/compare/v1.0.0...main
[
Unreleased
]:
https://gitlab.version.fz-juelich.de/SIONlib/SIONfwd/-/compare/v1.0.0...main
This diff is collapsed.
Click to expand it.
src/server.cxx
+
2
−
2
View file @
d20a9afc
...
@@ -362,7 +362,7 @@ struct CommunicatorReceiver {
...
@@ -362,7 +362,7 @@ struct CommunicatorReceiver {
std
::
vector
<
char
>
buf
=
(
args
.
nbyte
()
>
0
)
?
communicator_
.
receive_data
(
args
.
nbyte
())
:
std
::
vector
<
char
>
{};
std
::
vector
<
char
>
buf
=
(
args
.
nbyte
()
>
0
)
?
communicator_
.
receive_data
(
args
.
nbyte
())
:
std
::
vector
<
char
>
{};
ssize_t
written
=
0
;
ssize_t
written
=
0
;
while
(
true
)
{
while
(
true
)
{
ssize_t
k
=
pwrite
(
args
.
fd
(),
&
buf
.
at
(
written
),
args
.
nbyte
()
-
written
,
args
.
offset
()
+
written
);
ssize_t
k
=
pwrite
(
args
.
fd
(),
(
args
.
nbyte
()
>
0
)
?
&
buf
.
at
(
written
)
:
nullptr
,
args
.
nbyte
()
-
written
,
args
.
offset
()
+
written
);
if
(
k
==
-
1
)
{
if
(
k
==
-
1
)
{
if
(
errno
!=
EINTR
)
{
if
(
errno
!=
EINTR
)
{
written
=
-
1
;
written
=
-
1
;
...
@@ -385,7 +385,7 @@ struct CommunicatorReceiver {
...
@@ -385,7 +385,7 @@ struct CommunicatorReceiver {
std
::
vector
<
char
>
buf
(
args
.
nbyte
());
std
::
vector
<
char
>
buf
(
args
.
nbyte
());
ssize_t
read
=
0
;
ssize_t
read
=
0
;
while
(
true
)
{
while
(
true
)
{
ssize_t
k
=
pread
(
args
.
fd
(),
&
buf
.
at
(
read
),
args
.
nbyte
()
-
read
,
args
.
offset
()
+
read
);
ssize_t
k
=
pread
(
args
.
fd
(),
(
args
.
nbyte
()
>
0
)
?
&
buf
.
at
(
read
)
:
nullptr
,
args
.
nbyte
()
-
read
,
args
.
offset
()
+
read
);
if
(
k
==
-
1
)
{
if
(
k
==
-
1
)
{
if
(
errno
!=
EINTR
)
{
if
(
errno
!=
EINTR
)
{
read
=
-
1
;
read
=
-
1
;
...
...
This diff is collapsed.
Click to expand it.
src/test-client.c
+
8
−
0
View file @
d20a9afc
...
@@ -26,6 +26,10 @@ int main(int argc, char *argv[]) {
...
@@ -26,6 +26,10 @@ int main(int argc, char *argv[]) {
fprintf
(
stderr
,
"wrote %"
PRId64
" bytes to %d
\n
"
,
written
,
fd
);
fprintf
(
stderr
,
"wrote %"
PRId64
" bytes to %d
\n
"
,
written
,
fd
);
assert
(
written
==
strlen
(
wbuf
));
assert
(
written
==
strlen
(
wbuf
));
written
=
sionfwd_pwrite
(
fd
,
wbuf
,
0
,
0
);
fprintf
(
stderr
,
"wrote %"
PRId64
" bytes to %d
\n
"
,
written
,
fd
);
assert
(
written
==
0
);
int
status
=
sionfwd_flush
(
fd
);
int
status
=
sionfwd_flush
(
fd
);
fprintf
(
stderr
,
"flushed file descriptor %d
\n
"
,
fd
);
fprintf
(
stderr
,
"flushed file descriptor %d
\n
"
,
fd
);
assert
(
status
==
0
);
assert
(
status
==
0
);
...
@@ -51,6 +55,10 @@ int main(int argc, char *argv[]) {
...
@@ -51,6 +55,10 @@ int main(int argc, char *argv[]) {
assert
(
read
==
strlen
(
wbuf
));
assert
(
read
==
strlen
(
wbuf
));
assert
(
strcmp
(
wbuf
,
rbuf
)
==
0
);
assert
(
strcmp
(
wbuf
,
rbuf
)
==
0
);
read
=
sionfwd_pread
(
fd
,
rbuf
,
0
,
0
);
fprintf
(
stderr
,
"read %"
PRId64
" bytes from %d
\n
"
,
read
,
fd
);
assert
(
read
==
0
);
status
=
sionfwd_close
(
fd
);
status
=
sionfwd_close
(
fd
);
fprintf
(
stderr
,
"closed file descriptor %d with status %d
\n
"
,
fd
,
status
);
fprintf
(
stderr
,
"closed file descriptor %d with status %d
\n
"
,
fd
,
status
);
assert
(
status
==
0
);
assert
(
status
==
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment