Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arithmetic overflow in word-aligner/da.h #69

Open
froiss opened this issue Mar 19, 2015 · 0 comments
Open

arithmetic overflow in word-aligner/da.h #69

froiss opened this issue Mar 19, 2015 · 0 comments

Comments

@froiss
Copy link

froiss commented Mar 19, 2015

In functions ComputeZ and ComputeDLogZ, line 33 and 50:

const unsigned num_top = n - floor;

floor may be greater than n, which makes num_top reach values close to 2^32.

It happens in real life when the following conditions are met:

  • fast_align is called with the flags --favor_diagonal and --optimize_tension, and
  • the parallel corpus contains source sentences that are longer than their matching target sentence.

In that situation, fast_align.cc's main sometimes invokes ComputeDLogZ with i > n. ComputeDLogZ then calls ComputeZ with i > m (which triggers an assert error if the asserts are commented out).

Note: This is obviously related to those two commits
clab/fast_align@5fe669e
clab/fast_align@adfadde
from the clab/fast_align repo, although I am not quite sure why the second reverted the first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant