[pcre-dev] [Bug 2308] Possible uninitialized memory usage in…

Αρχική Σελίδα
Delete this message
Συντάκτης: admin
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] [Bug 2308] Possible uninitialized memory usage in optimize_class_chars()
https://bugs.exim.org/show_bug.cgi?id=2308

--- Comment #4 from Philip Hazel <ph10@???> ---
I think this code is actually OK. The pcre2_compile() function generates a
class bitmap only for classes with at least two characters, so at least one
byte will be non-zero, leading to at least one execution of

char_list[len++] = (uint16_t) c;

And, as len starts out zero, char_list[0] will always be set. However, you
cannot tell this just from reading the code of the function. If by accident
every byte in the bits[] array were to be zero, char_list[0] would not be set.
Might it be sensible to add a line such as "if (len == 0) return FALSE;" just
to cover this? It would also, hopefully, stop static analyzers complaining.

--
You are receiving this mail because:
You are on the CC list for the bug.