Skip to content

Commit

Permalink
fix: buffer overflow in NGramModel.prob
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Dec 28, 2023
1 parent 29a6654 commit 563b6a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cython/_pocketsphinx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ cdef class NGramModel:
cdef const char **cwords
cdef int prob
bwords = [w.encode("utf-8") for w in words]
cwords = <const char **>malloc(len(bwords))
cwords = <const char **>malloc(len(bwords) * sizeof(char *))
for i, w in enumerate(bwords):
cwords[i] = w
prob = ngram_prob(self.lm, cwords, len(words))
Expand Down

0 comments on commit 563b6a8

Please sign in to comment.