I'm not doing this, since I'm not familiar with the regex module.
But this untested patch could be used as a starting point.

Also to be considered: What is the glibc spelling of a macro
equivalent to _GL_ATTRIBUTE_COUNTED_BY?


diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index e24ef97989..83a2b004dd 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -534,7 +534,8 @@ struct re_state_table_entry
 {
   Idx num;
   Idx alloc;
-  re_dfastate_t **array;
+  re_dfastate_t **array
+    _GL_ATTRIBUTE_COUNTED_BY (num);
 };
 
 /* Array type used in re_sub_match_last_t and re_sub_match_top_t.  */
@@ -623,12 +624,14 @@ struct re_fail_stack_t
 {
   Idx num;
   Idx alloc;
-  struct re_fail_stack_ent_t *stack;
+  struct re_fail_stack_ent_t *stack
+    _GL_ATTRIBUTE_COUNTED_BY (num);
 };
 
 struct re_dfa_t
 {
-  re_token_t *nodes;
+  re_token_t *nodes
+    _GL_ATTRIBUTE_COUNTED_BY (nodes_len);
   size_t nodes_alloc;
   size_t nodes_len;
   Idx *nexts;




Reply via email to