Commit 907cd68e authored by tmikolov's avatar tmikolov

bugfix - the vector computation was done before check for out-of-vocabulary...

bugfix - the vector computation was done before check for out-of-vocabulary words was performed, which resulted in accessing memory outside of the allocated block
parent 4896886f
...@@ -97,13 +97,13 @@ int main(int argc, char **argv) ...@@ -97,13 +97,13 @@ int main(int argc, char **argv)
b3 = b; b3 = b;
for (a = 0; a < N; a++) bestd[a] = 0; for (a = 0; a < N; a++) bestd[a] = 0;
for (a = 0; a < N; a++) bestw[a][0] = 0; for (a = 0; a < N; a++) bestw[a][0] = 0;
for (a = 0; a < size; a++) vec[a] = (M[a + b2 * size] - M[a + b1 * size]) + M[a + b3 * size];
TQ++; TQ++;
if (b1 == words) continue; if (b1 == words) continue;
if (b2 == words) continue; if (b2 == words) continue;
if (b3 == words) continue; if (b3 == words) continue;
for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st4)) break; for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st4)) break;
if (b == words) continue; if (b == words) continue;
for (a = 0; a < size; a++) vec[a] = (M[a + b2 * size] - M[a + b1 * size]) + M[a + b3 * size];
TQS++; TQS++;
for (c = 0; c < words; c++) { for (c = 0; c < words; c++) {
if (c == b1) continue; if (c == b1) continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment