Skip to content

fix: initialization order for error reporting and ensure zero-initialized buffers#11

Open
sachintu47 wants to merge 2 commits into
mainfrom
fix_junk_prints
Open

fix: initialization order for error reporting and ensure zero-initialized buffers#11
sachintu47 wants to merge 2 commits into
mainfrom
fix_junk_prints

Conversation

@sachintu47
Copy link
Copy Markdown
Member

@sachintu47 sachintu47 commented May 12, 2026

fix: initialization order for error reporting and ensure zero-initialized buffers

@sachintu47 sachintu47 changed the title fix: initialization order for error reporting and ensure zero-initial… ized buffers May 12, 2026
@sachintu47 sachintu47 changed the title ized buffers fix: initialization order for error reporting and ensure zero-initialized buffers May 12, 2026
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 12, 2026

🤖 Augment PR Summary

Summary: Moves DBG_Opts initialization earlier in open_dataset() so error reporting is available before subsequent dataset setup steps.
Also: Ensures dataset read buffers are zero-initialized/cleared between reads and treats BPAM member read failures as hard errors (logging the actual bytes_read).

🤖 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
dfile->msgbufflen = DIO_MSG_BUFF_LEN;
dfile->logstream = logstream;
dfile->opts = calloc(1, sizeof(DBG_Opts));
init_opts(dfile->opts, dfile);
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

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

init_opts() snapshots dfile->debug into opts->debug, but LIBDIO_DEBUG is applied later, so opts->debug can stay disabled even when debugging is enabled. That can make any DBG_Opts-controlled debug output inconsistent with dfile->debug.

Severity: low

Fix This in Augment

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

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. 1 suggestion posted.

Fix All in Augment

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

Comment thread src/libdio.c
dfile->msgbufflen = DIO_MSG_BUFF_LEN;
dfile->logstream = logstream;
dfile->opts = calloc(1, sizeof(DBG_Opts));
init_opts(dfile->opts, dfile);
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

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

dfile->opts is allocated with calloc() but not checked before calling init_opts(), so an OOM here could lead to a NULL dereference inside init_opts. Consider handling dfile->opts == NULL similarly to the other allocation-failure paths in open_dataset().

Severity: medium

Fix This in Augment

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

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.

1 participant