diff options
| author | Philip Kaludercic | 2021-09-23 18:12:41 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2021-09-23 19:10:38 +0200 |
| commit | c44190ca5b9873fceae8aee7034ce8e89c42d4dd (patch) | |
| tree | 43a7d5ec8023ef2c7476ced38886ad78df92cf24 /src | |
| parent | 13d930deddd2e0529a0fb0f2fb93dd621d6d35be (diff) | |
| download | emacs-c44190ca5b9873fceae8aee7034ce8e89c42d4dd.tar.gz emacs-c44190ca5b9873fceae8aee7034ce8e89c42d4dd.zip | |
Fix string-distance for two empty strings
* fns.c (Fstring_distance): Avoid using uninitialized memory.
* test/src/fns-tests.el (test-string-distance): Add test cases.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 2 |
1 files changed, 1 insertions, 1 deletions
| @@ -322,7 +322,7 @@ Letter-case is significant, but text properties are ignored. */) | |||
| 322 | 322 | ||
| 323 | USE_SAFE_ALLOCA; | 323 | USE_SAFE_ALLOCA; |
| 324 | ptrdiff_t *column = SAFE_ALLOCA ((len1 + 1) * sizeof (ptrdiff_t)); | 324 | ptrdiff_t *column = SAFE_ALLOCA ((len1 + 1) * sizeof (ptrdiff_t)); |
| 325 | for (y = 1; y <= len1; y++) | 325 | for (y = 0; y <= len1; y++) |
| 326 | column[y] = y; | 326 | column[y] = y; |
| 327 | 327 | ||
| 328 | if (use_byte_compare) | 328 | if (use_byte_compare) |