Commit Graph
5064 Commits
Author SHA1 Message Date
Samuel Thibault 26a675543c Properly maintain margin in ph_list2
TranslateWord2 uses phonemes in ph_list2. Apart from the breakable loops, it
may statically require up to 7 phonemes. Then TranslateClause always
uses 2 phonemes. We thus have to keep these margins along the loops to
avoid any overflow.

Fixes #1073
2022-03-15 04:08:51 +01:00
Samuel Thibault 7b9c99cec7 Add more heading margin in TranslateClause
Valgrind reports:

==3642987== Conditional jump or move depends on uninitialised value(s)
==3642987==    at 0x491F268: TranslateNumber_1 (numbers.c:1785)
==3642987==    by 0x4923C35: TranslateNumber (numbers.c:2080)
==3642987==    by 0x49556DC: TranslateWord3 (translate.c:644)
==3642987==    by 0x4957FCE: TranslateWord (translate.c:1100)
==3642987==    by 0x4959344: TranslateWord2 (translate.c:1361)
==3642987==    by 0x496116E: TranslateClause (translate.c:2613)
==3642987==    by 0x494FF7A: SpeakNextClause (synthesize.c:1569)
==3642987==    by 0x4939B9D: Synthesize (speech.c:457)
==3642987==    by 0x493AE6A: sync_espeak_Synth (speech.c:570)
==3642987==    by 0x493B286: espeak_ng_Synthesize (speech.c:678)
==3642987==    by 0x4916925: espeak_Synth (espeak_api.c:90)
==3642987==    by 0x10CF5D: main (espeak-ng.c:691)
==3642987==  Uninitialised value was created by a stack allocation
==3642987==    at 0x495BD9F: TranslateClause (translate.c:1941)

Indeed, TranslateNumber_1 looks back up to three bytes before, with
IsDigit09(word[-3])), so we have to increase the heading margin to three
spaces.
2022-03-15 04:08:51 +01:00
Samuel Thibault cd33c4042a MatchRule: Do not go back before the pre-ptr
pre_ptr is already one byte before the current letter, so we do not want
to subtract 1 again. Otherwise this would for instance underflow word_iz
of addPluralSuffixes.
2022-03-15 04:08:51 +01:00
Samuel Thibault 005a590786 addPluralSuffixes: Use space as heading separator
Otherwise asan reports this during make check:

testing en ibm mit ibms mits IBM MIT APH CES ITX IBMs MIT's APHs CES's ITXs
==3733154==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe420233ef at pc 0x7f2e8a30aef1 bp 0x7ffe42022c80 sp 0x7ffe42022c78
READ of size 1 at 0x7ffe420233ef thread T0
    #0 0x7f2e8a30aef0 in utf8_in2 src/libespeak-ng/translate.c:281
    #1 0x7f2e8a2a6db1 in MatchRule src/libespeak-ng/dictionary.c:2058
    #2 0x7f2e8a2a89e9 in TranslateRules src/libespeak-ng/dictionary.c:2301
    #3 0x7f2e8a30cc77 in addPluralSuffixes src/libespeak-ng/translate.c:393
    #4 0x7f2e8a30e2c9 in TranslateWord3 src/libespeak-ng/translate.c:684
    #5 0x7f2e8a31210b in TranslateWord src/libespeak-ng/translate.c:1100
    #6 0x7f2e8a313ef2 in TranslateWord2 src/libespeak-ng/translate.c:1361
    #7 0x7f2e8a31f4e2 in TranslateClause src/libespeak-ng/translate.c:2623
    #8 0x7f2e8a305010 in SpeakNextClause src/libespeak-ng/synthesize.c:1569
    #9 0x7f2e8a2e390e in Synthesize src/libespeak-ng/speech.c:457
    #10 0x7f2e8a2e552a in sync_espeak_Synth src/libespeak-ng/speech.c:570
    #11 0x7f2e8a2e5d1f in espeak_ng_Synthesize src/libespeak-ng/speech.c:678
    #12 0x7f2e8a2af2fd in espeak_Synth src/libespeak-ng/espeak_api.c:90
    #13 0x5618104c9137 in main src/espeak-ng.c:691
    #14 0x7f2e8953d7fc in __libc_start_main ../csu/libc-start.c:332
    #15 0x5618104c6569 in _start (/home/samy/ens/projet/1/speech/espeak-ng-git/src/.libs/espeak-ng+0x6569)

Address 0x7ffe420233ef is located in stack of thread T0 at offset 47 in frame
    #0 0x7f2e8a30cb3b in addPluralSuffixes src/libespeak-ng/translate.c:380

  This frame has 3 object(s):
    [32, 36) 'word_zz' (line 381)
    [48, 52) 'word_iz' (line 382) <== Memory access at offset 47 underflows this variable
    [64, 68) 'word_ss' (line 383)

and indeed, RULE_NOVOWELS keeps looking back until it finds a spacing
character, so we have to provide it with one.
2022-03-15 03:40:52 +01:00
Samuel Thibault 0119efec28 MatchRule: Do not go back before the pre-ptr
pre_ptr is already one byte before the current letter, so we do not want
to subtract 1 again. Otherwise this would for instance underflow word_iz
of addPluralSuffixes.
2022-03-15 03:39:12 +01:00
Samuel Thibault 156b0fd45f Add usan CI run
Now that all usan errors are fixed.

Ref #220
2022-03-15 03:17:38 +01:00
Samuel Thibault 06221157e0 Merge branch 'n_ph_list2' into CI-usan 2022-03-15 03:11:25 +01:00
Samuel Thibault b81aac83a6 Merge branch 'translatenumber' into CI-usan 2022-03-15 03:11:19 +01:00
Samuel Thibault a932e86b11 Merge branch 'uninitialized' into CI-usan 2022-03-15 03:11:11 +01:00
Samuel Thibault eb9c7347c2 Merge branch 'integer-shift' into CI-usan 2022-03-15 03:10:55 +01:00
Samuel Thibault 910311ede1 Merge branch 'no-negative-index' into CI-usan 2022-03-15 03:10:46 +01:00
Samuel Thibault 165be6cc3a Merge branch 'wrapv' into CI-usan 2022-03-15 03:10:37 +01:00
Samuel Thibault 4dd1e04d8a Make polint use 0-based indexing
This avoids having to make LoadEnvelope2 pass &env_x[-1], which is very
strongly frowned upon by sanitizers such as usan.
2022-03-15 03:03:41 +01:00
Samuel Thibault 5ae18f9d4a Properly maintain margin in ph_list2
TranslateWord2 uses phonemes in ph_list2. Apart from the breakable loops, it
may statically require up to 7 phonemes. Then TranslateClause always
uses 2 phonemes. We thus have to keep these margins along the loops to
avoid any overflow.

Fixes #1073
2022-03-15 02:49:41 +01:00
Samuel Thibault eb512f66e1 Add more heading margin in TranslateClause
Valgrind reports:

==3642987== Conditional jump or move depends on uninitialised value(s)
==3642987==    at 0x491F268: TranslateNumber_1 (numbers.c:1785)
==3642987==    by 0x4923C35: TranslateNumber (numbers.c:2080)
==3642987==    by 0x49556DC: TranslateWord3 (translate.c:644)
==3642987==    by 0x4957FCE: TranslateWord (translate.c:1100)
==3642987==    by 0x4959344: TranslateWord2 (translate.c:1361)
==3642987==    by 0x496116E: TranslateClause (translate.c:2613)
==3642987==    by 0x494FF7A: SpeakNextClause (synthesize.c:1569)
==3642987==    by 0x4939B9D: Synthesize (speech.c:457)
==3642987==    by 0x493AE6A: sync_espeak_Synth (speech.c:570)
==3642987==    by 0x493B286: espeak_ng_Synthesize (speech.c:678)
==3642987==    by 0x4916925: espeak_Synth (espeak_api.c:90)
==3642987==    by 0x10CF5D: main (espeak-ng.c:691)
==3642987==  Uninitialised value was created by a stack allocation
==3642987==    at 0x495BD9F: TranslateClause (translate.c:1941)

Indeed, TranslateNumber_1 looks back up to three bytes before, with
IsDigit09(word[-3])), so we have to increase the heading margin to three
spaces.
2022-03-15 02:35:11 +01:00
Samuel Thibault f6d3c947de Fix uninitialized phonemes_repeat array
valgrind reports

==3632264== Conditional jump or move depends on uninitialised value(s)
==3632264==    at 0x4846688: strcmp (vg_replace_strmem.c:924)
==3632264==    by 0x490EC12: LookupDictList (dictionary.c:2889)
==3632264==    by 0x49554C6: TranslateWord3 (translate.c:588)
==3632264==    by 0x4957FCE: TranslateWord (translate.c:1100)
==3632264==    by 0x4959344: TranslateWord2 (translate.c:1361)
==3632264==    by 0x4961390: TranslateClause (translate.c:2621)
==3632264==    by 0x494FF7A: SpeakNextClause (synthesize.c:1569)
==3632264==    by 0x4939B9D: Synthesize (speech.c:457)
==3632264==    by 0x493AE6A: sync_espeak_Synth (speech.c:570)
==3632264==    by 0x493B286: espeak_ng_Synthesize (speech.c:678)
==3632264==    by 0x4916925: espeak_Synth (espeak_api.c:90)
==3632264==    by 0x10CF5D: main (espeak-ng.c:691)

And indeed tr->phonemes_repeat may not necessarily be initialized.
2022-03-15 02:25:45 +01:00
Richard Calvi b5f81a40b4 Removed trailing whitespace 2022-03-13 19:32:19 +09:00
Richard Calvi d8c60d97ba Added new language variant: en-us-nyc, a vintage New York City accent 2022-03-12 22:06:58 +09:00
Samuel Thibault 0b29e0080f Make sure to update apt before installing deps 2022-03-12 12:06:37 +01:00
Samuel Thibault 3b8eeb2f7b Pass -fwrapv option to compiler
espeak source code uses signed integer wrapping (e.g. wavephase in
wavegen.c's Wavegen). It happens that this is undefined behavior, so a
compiler would be free optimize away various situations... Fortunately gcc
has an -fwrapv option to make signed integer wrapping defined.

Options would be needed for other compilers.
2022-03-11 18:38:37 +01:00
Samuel Thibault b106fd5c91 Avoid shifting integers
shifting negative integers has an undefined behavior, so we have to
avoid it entirely. Using * 256 and / 256 provides the expected behavior
while being correctly optimized by the compiler.
2022-03-11 18:23:19 +01:00
Valdis Vitolins 43d07abec4 Merge pull request #1088 2022-03-11 18:31:53 +02:00
Valdis Vitolins bfcf9aa579 Update changelog 2022-03-11 18:30:30 +02:00
Andrii Logan Zvorygin e2f6c75258 Update Pyash with workaround for tones 2022-03-11 18:28:23 +02:00
Valdis Vitolins ea9941643d Change Travis CI status to Github Actions 2022-03-11 18:18:26 +02:00
Samuel Thibault caccd5ad73 Add CI 2022-03-11 14:08:29 +01:00
Valdis Vitolins 0af34dc061 Merge pull request #1079 2022-03-08 09:44:14 +02:00
Jakub Kulík 4b090ad8a1 Add support for Solaris 2022-03-01 11:56:48 +01:00
Alexander Epaneshnikov c352597757 android: limit max speech rate to 449 WPM
this is the maximum espeak-ng's speech rate without using libsonic
2022-02-20 16:56:23 +03:00
Samuel Thibault 977bff9a06 event_notify: Remove spurious 50ms delay
event_notify currently introduces an arbitrary 50ms delay between speech
requests. This is usually unnoticed since it's small. But when
cancelling a long series of events, they add up to potentially seconds
of delays, while the user was precisely requesting to just cancel
everything as fast as possible.

This 50ms delay was probably meant to work around some issues elsewhere.
If they are still there, they should be fixed, not worked around.
2022-02-13 02:54:00 +01:00
Ulrich Müller 889092c9d6 tests: Add unit test for ieee80.c
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
2022-02-10 17:53:19 +01:00
Ulrich Müller c7eb52fe14 src/libespeak-ng: Replace ieee80.c by a free software implementation
https://github.com/espeak-ng/espeak-ng/issues/1072

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
2022-02-10 17:53:19 +01:00
Andiv06 6c1043b610 Improve the pronunciation of Kazakh 2022-02-08 07:35:12 +02:00
Ineiev c3651b74e0 clean: remove files linked from dictsource/extra
The links persisted when ./configure run with extended dictionaries
disabled.
2022-02-03 20:22:09 +02:00
Valdis Vitolins f78bb1bec5 en: fix issue #1069: Ligature ſt is st, not ft 2022-01-25 20:23:31 +02:00
Valdis Vitolins 86bc55c5c4 Revert fixes for Russian from ineiev@gnu.org
This reverts commit 433d219eca.
2022-01-18 21:33:48 +02:00
Valdis Vitolins 3e76c18ed8 Update changelog 2022-01-18 20:12:12 +02:00
Ineiev 2ecff9fd40 ru: add pronunciation for common acronym, сша 2022-01-18 20:09:12 +02:00
Ineiev aa663ad7f7 ru: improve definitions for l and l; 2022-01-18 20:09:12 +02:00
Ineiev 55fa5ea5d3 ru: use s. and z. instead of S and Z 2022-01-18 20:09:12 +02:00
Ineiev b5115298b4 ru: improve source for y 2022-01-18 20:09:12 +02:00
Ineiev e105e98747 ru: add palatalized velars 2022-01-18 20:09:12 +02:00
Ineiev 404fad7445 ru: add a few combinations with mute letters 2022-01-18 20:09:12 +02:00
Ineiev 8f6b5f77b9 ru: fix comment 2022-01-18 20:09:12 +02:00
Ineiev 209c49aa21 ru: add a few more prepositions, remove duplicate rule 2022-01-18 20:09:11 +02:00
Ineiev d8f56d14a3 sr, ru: use t from Serbian in Russian 2022-01-18 20:09:11 +02:00
Ineiev 433d219eca ru: fix name of vcd pal nas pzd 2022-01-18 20:09:11 +02:00
Juho Hiltunen 0577cd90a6 code cleanup: remove unused variable markers_used 2022-01-03 21:14:18 +02:00
Valdis Vitolins 8b4fcb9391 Merge pull request #5 2022-01-03 12:08:52 +02:00
Valdis Vitolins d9509e1e93 Update changelog 2022-01-03 12:08:37 +02:00