CODEONE: fix out-of-bounds crash in c1_c40text_cnt() not

accounting for extended ASCII shifts, ticket #300 (no. 4),
  props Andre Maute
This commit is contained in:
gitlost 2023-11-25 16:31:48 +00:00
parent dfc4049932
commit 77c1ef1139
4 changed files with 34 additions and 2 deletions

View file

@ -447,6 +447,10 @@ static int c1_c40text_cnt(const int current_mode, const int gs1, unsigned char i
return 2;
}
cnt = 1;
if (input & 0x80) {
cnt += 2;
input -= 128;
}
if ((current_mode == C1_C40 && c40_shift[input]) || (current_mode == C1_TEXT && text_shift[input])) {
cnt += 1;
}