Skip to content

fix trailing space stripping for different encodings#10

Merged
sachintu47 merged 3 commits into
ispf_integrationfrom
strip_space
May 11, 2026
Merged

fix trailing space stripping for different encodings#10
sachintu47 merged 3 commits into
ispf_integrationfrom
strip_space

Conversation

@sachintu47
Copy link
Copy Markdown
Member

@sachintu47 sachintu47 commented May 11, 2026

@sachintu47
Copy link
Copy Markdown
Member Author

augment review

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 11, 2026

🤖 Augment PR Summary

Summary: This PR makes trailing-space stripping safer and encoding-aware when exporting dataset records to a temp file.

Changes:

  • Adds get_space_char() (via <_Ccsid.h>) to trim using ASCII (0x20) vs EBCDIC (0x40) spaces, and disables trimming for unknown/multi-byte encodings
  • Fixes record buffering/binary detection in read_dataset_internal() to scan/copy only the record bytes (rc) rather than the length-prefix-adjusted size
  • Adds bounds checks for length-prefixed buffers and trims trailing spaces before writing to the temp file
  • Clamps the final fixed-length write to the remaining buffer size to avoid out-of-bounds reads

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/libdio.c Outdated
Comment thread src/libdio.c Outdated
Comment thread src/libdio.c
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@sachintu47 sachintu47 marked this pull request as ready for review May 11, 2026 09:00
Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/libdio.c Outdated
Comment thread src/libdio.c
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/libdio.c
Comment thread src/libdio.c Outdated
Comment thread src/libdio.c
@sachintu47 sachintu47 marked this pull request as draft May 11, 2026 10:23
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

1 similar comment
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@sachintu47 sachintu47 marked this pull request as ready for review May 11, 2026 12:14
Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/libdio.c
while (i < dfile->bufflen) {
if (write(temp_fd, &data[i], dfile->reclen) != dfile->reclen) {
int actual_len = dfile->reclen;
if (i + actual_len > dfile->bufflen) {
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 11, 2026

Choose a reason for hiding this comment

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

In the fixed-length (no length prefix) path, clamping actual_len to the remaining buffer will silently write a partial final record if bufflen isn’t a multiple of reclen, which can mask buffer corruption and produce output that downstream code can’t parse reliably. Should this case be treated as an error (similar to the length-prefixed branch) instead of emitting a truncated record?

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Member

@IgorTodorovskiIBM IgorTodorovskiIBM left a comment

Choose a reason for hiding this comment

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

LGTM

@sachintu47 sachintu47 merged commit cbfc185 into ispf_integration May 11, 2026
1 of 2 checks passed
@sachintu47 sachintu47 deleted the strip_space branch May 11, 2026 13:20
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