fbcon_draw: properly guard against lower boundary #2032

This commit is contained in:
nick black 2021-08-10 20:21:29 -04:00
parent a23e91e258
commit 21952acd29
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ relies on the font. Patches to correct/complete this table are very welcome!
| [Guake](https://github.com/Guake/guake) | | ? |? | | |
| [ITerm2](https://github.com/gnachman/iTerm2) | ✅ | ✅ |✅ |`TERM=xterm-256color` ||
| [Kitty](https://github.com/kovidgoyal/kitty) | ✅ | ✅ |✅ |`TERM=xterm-kitty` | See below. |
| [kmscon](https://github.com/dvdhrm/kmscon) | | ❌ | ❌ |`TERM=xterm-256color` | No RGB color AFAICT, nor any distinct terminfo entry. No actual `ccc` implementation. |
| [kmscon](https://github.com/dvdhrm/kmscon) | | ❌ | ❌ |`TERM=xterm-256color` | No RGB color AFAICT, nor any distinct terminfo entry. No actual `ccc` implementation. Sets `COLORTERM=kmscon`.|
| [Konsole](https://invent.kde.org/utilities/konsole) | ❌ | ❌ |? |`TERM=konsole-direct` | |
| Linux console | ❌ | ✅ |see [below](#the-linux-console) |`TERM=linux` `COLORTERM=24bit` | 8 (512 glyph fonts) or 16 (256 glyph fonts) colors max, but RGB values are downsampled to a 256-index palette. See below. |
| [mlterm](https://github.com/arakiken/mlterm) | ✅ | ❌ |? |`TERM=mlterm-256color` | Do not set `COLORTERM`. `mlterm-direct` gives strange results. |

View File

@ -173,7 +173,7 @@ int fbcon_draw(const tinfo* ti, const struct ncpile *p, sprixel* s, fbuf* f, int
(void)p;
(void)f; // we don't write to the stream
int wrote = 0;
for(unsigned l = 0 ; l < (unsigned)s->pixy && l < ti->pixy ; ++l){
for(unsigned l = 0 ; l < (unsigned)s->pixy && l + y * ti->cellpixy < ti->pixy ; ++l){
// FIXME pixel size isn't necessarily 4B, line isn't necessarily psize*pixx
size_t offset = ((l + y * ti->cellpixy) * ti->pixx + x * ti->cellpixx) * 4;
uint8_t* tl = ti->linux_fbuffer + offset;