#367 Crash in fast_logmath_add

next release
Tom Meyer

On some Android devices (Samsung S4 & Samsung Gear at least), values with d > 256 are being looked up in the last line of fast_logmath_add, in pocketsphinx/src/libpocketsphinx/tied_mgau_common.h:
return r - (((uint8 *)t->table)[d]);
This only crashes on some devices, but the documentation for this function says it shouldn't happen:
* We can do some extra-fast log addition since we know that
* mixw+ascr is always less than 256 and hence x-y is also always less
* than 256. This relies on some cooperation from logmath_t which
* will never produce a logmath table smaller than 256 entries.

I don't understand the code fully, so have not found a fix for the root cause, but in the meantime have patched it by clipping d to the table size:
if (d >= t->table_size) {
d = t->table_size-1;


  • Nickolay V. Shmyrev


    Thanks for the repot

    WHat version are you talking about, what CPU revision? Did you try the latest demo?

    Could you provide corresponding raw recordings?

    • Nickolay V. Shmyrev

      Hi. I found a possible cause of this behavior finally. You probably do not remember but did you use PTM model?

  • Nickolay V. Shmyrev

    • status: open --> closed
  • Nickolay V. Shmyrev

    Should be fixed now.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks