-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11137 from keymanapp/fix/developer/11092-memory-b…
…uffer-overflow-in-compiler fix(developer): handle buffer boundaries in four cases
- Loading branch information
Showing
9 changed files
with
136 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_character_range_too_long.kmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
store(&NAME) 'error_character_range_too_long' | ||
store(&VERSION) '9.0' | ||
|
||
begin unicode > use(main) | ||
|
||
group(main) using keys | ||
|
||
c maximum store length is 4096 UTF-16 code units, including U+0000 terminator | ||
c #define GLOBAL_BUFSIZE 4096 // compfile.h | ||
c so we need 0x101E - 0x0020 + 1 = 0x0FFF --> 4095 words | ||
c See #11136 for calculation adjustment TODO | ||
|
||
store(x) U+0020 .. U+101E | ||
|
||
any(x) + 'x' > 'x' context |
16 changes: 16 additions & 0 deletions
16
developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_extended_string_too_long.kmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
store(&NAME) 'error_extended_string_too_long' | ||
store(&VERSION) '9.0' | ||
|
||
begin unicode > use(main) | ||
|
||
group(main) using keys | ||
|
||
c | ||
c maximum store length is 4096 UTF-16 code units, including U+0000 terminator | ||
c #define GLOBAL_BUFSIZE 4096 // compfile.h | ||
c so we need 0x101B - 0x0020 + 1 = 0x0FFD --> 4092 words, + 4 = 4096 = too long | ||
c See #11136 for calculation adjustment TODO | ||
|
||
store(x) U+0020 .. U+101B | ||
|
||
outs(x) 'abcd' + 'x' > 'x' context |
18 changes: 18 additions & 0 deletions
18
developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_outs_too_long.kmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
store(&NAME) 'error_outs_too_long' | ||
store(&VERSION) '9.0' | ||
|
||
begin unicode > use(main) | ||
|
||
group(main) using keys | ||
|
||
c maximum store length is 4096 UTF-16 code units, including U+0000 terminator | ||
c #define GLOBAL_BUFSIZE 4096 // compfile.h | ||
c so we need 0x101C - 0x0020 + 1 = 0x0FFD --> 4093 words | ||
c + 1, for 'a' in the rule below = 4094, which triggers the buffer boundary check. | ||
c Noting that this is conservative and losing 2 possible chars, but not fixing | ||
c in compiler.cpp at this time. | ||
c See #11136 for calculation adjustment TODO | ||
|
||
store(x) U+0020 .. U+101C | ||
|
||
'a' outs(x) + 'x' > 'x' context |
17 changes: 17 additions & 0 deletions
17
...oper/src/kmc-kmn/test/fixtures/invalid-keyboards/error_virtual_key_expansion_too_long.kmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
store(&NAME) 'error_virtual_key_expansion_too_long' | ||
store(&VERSION) '9.0' | ||
|
||
begin unicode > use(main) | ||
|
||
group(main) using keys | ||
|
||
c maximum store length is 4096 UTF-16 code units, including U+0000 terminator | ||
c #define GLOBAL_BUFSIZE 4096 // compfile.h | ||
c so we need 0x101E - 0x0020 + 1 = 0x0FFF --> 4095 words | ||
c each vk is 5 words long UC_SENTINEL CODE_EXTENDED shift key CODE_EXTENDEDEND (some long history here!) | ||
c we start filling the buffer with 4066 words and then the remaining 30 bytes = 6 VKs A-F | ||
c See #11136 for calculation adjustment TODO | ||
|
||
store(x) U+0020 .. U+1000 [K_A] .. [K_F] | ||
|
||
any(x) + 'x' > 'x' context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters