Skip to content

improper setfile member now causes segfault - #95

Draft
mterenzi wants to merge 1 commit into
nextfrom
abort-invalid-setfile
Draft

improper setfile member now causes segfault#95
mterenzi wants to merge 1 commit into
nextfrom
abort-invalid-setfile

Conversation

@mterenzi

Copy link
Copy Markdown

Implements the ticket's agreed approach: a setfile line that can't be stat()ed or
loaded now aborts the reload, and mtbl_fileset_init() returns NULL with errno
set instead of coming up with a silently empty fileset.

Before / after, using an mtbl as a setfile:
Dumped 0 entries. (exit 0)
Segmentation fault (exit 139)

Three things worth considering:

  1. dnstable doesn't check the NULL, so it segfaults in mtbl_source_get_prefix
    rather than saying anything pointing the user to the real issue.

  2. setfile_updated() commits the mtime before the reload runs
    (libmy/my_fileset.c:63), so a failed reload records a revision it never applied
    and the next call returns true. Probably fine though?

  3. fs_load() assigns errno after the fact because mtbl_reader_init() doesn't
    set it on the not-an-mtbl paths. Works, but setting it at the source in
    reader.c would be more robust. That's a much bigger change than what the ticket needs though.

@mterenzi mterenzi self-assigned this Sep 11, 2026
@mterenzi
mterenzi requested a review from shw700 September 11, 2026 19:29
@mterenzi
mterenzi marked this pull request as draft September 14, 2026 16:00
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