Commit Graph
1940 Commits
Author SHA1 Message Date
Samuel Thibault 6f8aeb4ebc Typo 2022-09-05 00:02:03 +02:00
Juho Hiltunen b52d1f3afd code cleanup: move strncpy0 to common.c 2022-09-04 07:12:39 +03:00
Juho Hiltunen c4d8976fbc code cleanup: Add new source file common.h for misc functions. 2022-09-03 21:19:37 +03:00
Juho Hiltunen 47b1b5baeb code cleanup: move TranslateWord3() and others o translateword.c
Use parameters instead of globals. Note the change from sizeof(word_phonemes) to size_word_phonemes.
2022-09-03 11:54:10 +03:00
Juho Hiltunen 5e7c105723 code cleanup: move TranslateLetter() and others to translateword.c 2022-09-03 11:46:16 +03:00
Juho Hiltunen fb06936c51 code cleanup: start moving translateWord3() to a new source file.
The file will be organized to have one callable function only. This
should make code structure simpler.

Existing code will be changed to use function parameters instead of
global variables.

Possible problems include too much dependencies with numbers.c.
2022-09-03 11:41:30 +03:00
Juho Hiltunen c4be2c90ad code cleanup: remove irrelevant comment 2022-09-02 21:10:10 +03:00
Juho Hiltunen 54963ebee2 code cleanup: remove unused int prev_clause_pause 2022-09-02 21:02:44 +03:00
Juho Hiltunen 0e07d929fd code cleanup: refactor checking phoneme_mode into a function 2022-09-01 20:50:27 +03:00
Juho Hiltunen 1443c970cd cmn: search for dictionary matches instead of translating characters.
cmn (Mandarin chinese) has been broken since 4825905.

This fix makes mandarin behave more like Cantonese. Instead of
translating characters, we search for dictionary matches.

The functionality of normal vs Chao tones should be investigated more.
Looks like latin characters as pinyin still uses Chao tones whereas
the characters in cmn_list and cmn_listx do not.

See #1044 for discussion. See also #1028 and #1163.
2022-08-31 21:15:29 +03:00
Juho Hiltunen 2ef9d75067 code cleanup: remove dead code related to language 'wo'
This is the only reference to the language.
2022-08-28 21:34:03 +03:00
Juho Hiltunen 8976875590 code cleanup: remove dead code related to Kiryarwanda
This is the only reference to the language.
2022-08-28 21:34:03 +03:00
Juho Hiltunen 3eb43c1ef5 code cleanup: remove dead code related to Tibetan
Language 'bo' has no data files. Tibetan might have been supported
before but clearly isn't any longer.
2022-08-28 20:40:58 +03:00
Juho Hiltunen 7492475728 code cleanup: make a function for checking tr->chars_ignore
ReadClause() is very long and should be shortened for code readability
2022-08-28 20:13:32 +03:00
Juho Hiltunen a161118976 code cleanup: move lookupwchar2 to readclause.c
It's used only in readclause.c

TODO: Rename so the meaning of the function is easier to understand.
2022-08-28 20:13:16 +03:00
Samuel Thibault 8789e1e8e1 Increase buffer size for thousands processing
E.g. yue does not have many thousands separators, so the value may be very
large, possibly as much as maxint.
2022-08-27 01:32:56 +02:00
Samuel Thibault 3c220e5831 Fix calling utf8_in2
utf8_in2, when working in backward mode, is assuming that we are giving
the address of the last byte of the previous character (see all other
calls to utf8_in2). Otherwise, utf8_in2 returns the size of the current
multibyte character instead of that of the previous multibyte character.
2022-08-26 22:51:44 +02:00
Samuel Thibault 4412de57fd Fix number processing buffer overflow fix
This first reverts "Fix number_buf buffer overflow"
(commit ada93e2db0)

This for loop is apparently actually expected to to skip over NUL
characters.

Fixes #1302

Instead, this limits number processing to 32 digits, as break_numbers does
not support more and would provide bogus result with further digits.

Also fix the signedness of break_numbers so that the 32th bit
actually effectively works.
2022-08-26 22:22:01 +02:00
Samuel Thibault ecec635b44 Cope with truncated utf8 input 2022-07-21 00:33:09 +02:00
Samuel Thibault 53348c5118 Avoid match1.del_fwd getting stale value 2022-07-21 00:25:45 +02:00
Samuel Thibault 60767a41c0 Avoid buffer underflow 2022-07-21 00:18:16 +02:00
Samuel Thibault ada93e2db0 Fix number_buf buffer overflow 2022-07-21 00:03:57 +02:00
Samuel Thibault 482ee1da05 Add missing check for EOF 2022-07-02 02:43:23 +02:00
Samuel Thibault f60a27a7cd Do not overflow ph_buf
With emojis, phoneme strings can be very long
2022-07-02 01:56:27 +02:00
Samuel Thibault 1da9ad10e8 Add tertiary translator
TranslateWord2 passes translator2 as tr to TranslateWord which may call
TranslateWord3, SpeakIndividualLetters, TranslateLetter, which was calling
SetTranslator2 again, thus freeing the very tr being used. Make that
latter use another translator.
2022-07-02 01:04:24 +02:00
Samuel Thibault 9decedb8c2 Fix missing checks for EOF 2022-06-30 12:41:18 +02:00
Valdis Vitolins 2e41cdde38 Merge pull request #1212 2022-06-27 14:43:50 +03:00
Samuel Thibault dfc322743d MAKE_MEM_UNDEFINED: Fix warning 2022-06-12 00:26:17 +02:00
Samuel Thibault f4133364d1 Add more const qualifiers 2022-06-11 16:20:19 +02:00
Samuel Thibault 6f58f75693 Add missing phoneme table reset
When there are language switches, when we rewind to the start of the
phoneme list we have to reset the phoneme table back.

This avoids some branching that depends on undefined values, caught by
valgrind in the case e.g. of an emoji substitution that contains a
language switch.

Ref #874
2022-06-09 13:20:43 +02:00
Samuel Thibault 3b009398c9 Add missing stresslevel field initialization 2022-06-09 12:21:05 +02:00
Samuel Thibault eed7db1575 Fix out-of-bound access
IsLetterGroup looks for heading \0, so the padding also needs to include
an \0.
2022-06-09 11:26:17 +02:00
Samuel Thibault 24e1eaa0cc Mark static arrays undefined when they are reused
So valgrind can potentially catch e.g. missing \0.
2022-06-09 09:48:43 +02:00
Samuel Thibault 7e608a3273 Make some buffers non-static
These don't actually need to survive function exit.
2022-06-09 09:46:19 +02:00
Samuel Thibault a660fc04cc Add more const qualifiers on static arrays
So we know they are just tables, get protected from overflows, and get shared between processes
2022-06-09 08:43:50 +02:00
Samuel Thibault 2d3a49b161 Make static arrays undefined on entry into LoadVoice
This would have caught #1200
2022-06-09 08:37:56 +02:00
Samuel Thibault afdf50bfd3 Add a note to avoid erroneous commits like e91d0a5
Fixes #1200
2022-06-09 08:12:45 +02:00
Sean Budd 139417e8e1 Revert "code cleanup: don't add a \0 to voices_language in LoadVoice()."
This reverts commit e91d0a5861.
2022-06-09 11:23:48 +10:00
Valdis Vitolins abd8ff5f71 Merge pull request #1158 2022-04-14 17:30:08 +03:00
Valdis Vitolins 77cc6c1a9c Merge pull request #1157 2022-04-14 17:29:55 +03:00
Valdis Vitolins bff48e078e Merge pull request #1156 2022-04-14 17:29:43 +03:00
Samuel Thibault 5087b05c52 Mark re-used "source" array as undefined
And fix the prefetches after \0.
2022-04-13 23:24:30 +02:00
Samuel Thibault 1228094127 Mark re-used phoneme_tab array as undefined
And make sure that the unfilled entries are NULL to catch any spurious
reference.

Also fix some missing phoneme table switch according to language
changes.
2022-04-13 23:24:13 +02:00
Samuel Thibault 199cbe4a1a Mark re-used phoneme_list as undefined
And fill the last phlist prepause and newword fields, otherwise they are
detected as undefined:

==483407== Conditional jump or move depends on uninitialised value(s)
==483407==    at 0x488E6AB: Generate (synthesize.c:1228)
==483407==    by 0x488FD94: SpeakNextClause (synthesize.c:1587)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==  Uninitialised value was created by a client request
==483407==    at 0x4884893: MakePhonemeList (phonemelist.c:155)
==483407==    by 0x4895712: TranslateClause (translate.c:2682)
==483407==    by 0x488FCCF: SpeakNextClause (synthesize.c:1569)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==
==483407== Conditional jump or move depends on uninitialised value(s)
==483407==    at 0x488E622: Generate (synthesize.c:1211)
==483407==    by 0x488FD94: SpeakNextClause (synthesize.c:1587)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==  Uninitialised value was created by a client request
==483407==    at 0x4884893: MakePhonemeList (phonemelist.c:155)
==483407==    by 0x4895712: TranslateClause (translate.c:2682)
==483407==    by 0x488FCCF: SpeakNextClause (synthesize.c:1569)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==

This is changing the ssml.test output, but with no audible difference,
so this is probably a real fix for it.
2022-04-13 23:24:04 +02:00
Samuel Thibault f1ce2ec423 Mark re-used ph_list2 array as undefined
And fix looking after end of array.
2022-04-13 23:23:51 +02:00
Valdis Vitolins f56c7ea185 Merge pull request #1154 2022-04-13 22:43:06 +03:00
Samuel Thibault 15804e57a2 Constify tables
So they are protected from overflows, and shared between processes
2022-04-10 22:48:40 +02:00
Samuel Thibault 3ce135ac2b Mark re-used buffers as undefined
These are global arrays reused several times. When using them msan and
valgrind thus believe they are always initialized, which reduces their
capacity to detect uninitialized values. We can however explicitly tell them
when they are reused, and thus to be considered as uninitialized.
2022-04-10 22:42:51 +02:00
Samuel Thibault a34d74ed43 Make envelope computation more robust
When pollint() returns 100.0, multiplying by 2.55 doesn't actually seem to
be getting 255 on i386. Multiplying by 255 and dividing by 100, however,
does (probably because float computation with small integer values are
guaranteed to have integer results).

Fixes #1151
2022-04-10 22:12:28 +02:00
Samuel Thibault 310e8fc768 Avoid using floating-point operation
This has varying behavior depending on toolchain and processor.

Fixes #1151
2022-04-10 20:48:43 +02:00