Add address sanitizer and undefined behavior sanitizer (#951)

This commit is contained in:
Fangjun Kuang
2024-05-31 13:17:01 +08:00
committed by GitHub
parent a38881817c
commit f1cff83ef9
56 changed files with 354 additions and 132 deletions

View File

@@ -71,7 +71,7 @@ class OfflinePunctuationCtTransformerImpl : public OfflinePunctuationImpl {
for (int32_t i = 0; i != num_segments; ++i) {
int32_t this_start = i * segment_size; // inclusive
int32_t this_end = this_start + segment_size; // exclusive
if (this_end > token_ids.size()) {
if (this_end > static_cast<int32_t>(token_ids.size())) {
this_end = token_ids.size();
}
@@ -155,7 +155,7 @@ class OfflinePunctuationCtTransformerImpl : public OfflinePunctuationImpl {
std::vector<std::string> words_punct;
for (int32_t i = 0; i != static_cast<int32_t>(punctuations.size()); ++i) {
if (i >= tokens.size()) {
if (i >= static_cast<int32_t>(tokens.size())) {
break;
}
std::string &w = tokens[i];