gbranden pushed a commit to branch master
in repository groff.
commit cd999c60023ef7d4cc48b46561856e93a0abf711
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Sep 17 20:12:57 2026 -0500
[libbib]: Fix Savannah #68682 (2/2).
* src/libs/libbib/index.cpp
(index_search_item_iterator::index_search_item_iterator): Add
`found_list` to initializer list, making it a null pointer, because
the file name index might not be valid. Thus, bracket the entire
function body on the condition `ind->is_valid()`.
Fixes <https://savannah.gnu.org/bugs/?68682> (2/2).
---
ChangeLog | 10 ++++++++++
src/libs/libbib/index.cpp | 16 +++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6258f0ad0..771bd87bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-09-17 G. Branden Robinson <[email protected]>
+
+ * src/libs/libbib/index.cpp
+ (index_search_item_iterator::index_search_item_iterator): Add
+ `found_list` to initializer list, making it a null pointer,
+ because the file name index might not be valid. Thus, bracket
+ the entire function body on the condition `ind->is_valid()`.
+
+ Fixes <https://savannah.gnu.org/bugs/?68682> (2/2).
+
2026-09-17 G. Branden Robinson <[email protected]>
* src/libs/libbib/index.cpp
diff --git a/src/libs/libbib/index.cpp b/src/libs/libbib/index.cpp
index e9d4d9e84..a53da8e68 100644
--- a/src/libs/libbib/index.cpp
+++ b/src/libs/libbib/index.cpp
@@ -364,16 +364,18 @@ search_item *make_index_search_item(const char *filename,
int fid)
index_search_item_iterator::index_search_item_iterator(index_search_item *ind,
const char *q)
: indx(ind), out_of_date_files_iter(0 /* nullptr */),
- next_out_of_date_file(0 /* nullptr */), temp_list(0 /* nullptr */),
- buf(0 /* nullptr */), buflen(0),
+ next_out_of_date_file(0 /* nullptr */), found_list(0 /* nullptr */),
+ temp_list(0 /* nullptr */), buf(0 /* nullptr */), buflen(0),
searcher(q, strlen(q), ind->ignore_fields, ind->header.truncate),
query(strsave(q))
{
- found_list = indx->search(q, strlen(q), &temp_list);
- if (!found_list) {
- found_list = &minus_one;
- warning("all keys would have been discarded in constructing index '%1'",
- indx->name);
+ if (ind->is_valid()) {
+ found_list = indx->search(q, strlen(q), &temp_list);
+ if (!found_list) {
+ found_list = &minus_one;
+ warning("all keys would have been discarded in constructing index '%1'",
+ indx->name);
+ }
}
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit