mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-01 14:52:14 +01:00
21 lines
963 B
Diff
21 lines
963 B
Diff
Fix value range of ns in RandFst().
|
|
|
|
ns must not be zero. Otherwise the ns_dist creation
|
|
|
|
std::uniform_int_distribution<StateId> ns_dist(0, ns - 1);
|
|
|
|
might be invalid. This patch ensures that ns is >= 0.
|
|
|
|
diff -upr openfst-1.8.2.orig/src/include/fst/test/rand-fst.h openfst-1.8.2/src/include/fst/test/rand-fst.h
|
|
--- openfst-1.8.2.orig/src/include/fst/test/rand-fst.h 2023-07-16 20:46:34.154919412 +0200
|
|
+++ openfst-1.8.2/src/include/fst/test/rand-fst.h 2023-07-16 20:46:40.598277091 +0200
|
|
@@ -44,7 +44,7 @@ void RandFst(const int num_random_states
|
|
|
|
std::mt19937_64 rand(seed);
|
|
const StateId ns =
|
|
- std::uniform_int_distribution<>(0, num_random_states - 1)(rand);
|
|
+ std::uniform_int_distribution<>(1, num_random_states - 1)(rand);
|
|
std::uniform_int_distribution<size_t> arc_dist(0, num_random_arcs - 1);
|
|
std::uniform_int_distribution<Label> label_dist(0, num_random_labels - 1);
|
|
std::uniform_int_distribution<StateId> ns_dist(0, ns - 1);
|