Files
crosspoint-reader-mod/chat-summaries/2026-02-19_port-upstream-1.1.0-rc-fixes-summary.md

38 lines
2.3 KiB
Markdown
Raw Normal View History

# Port Upstream 1.1.0-RC Fixes
**Date:** 2026-02-19
**Task:** Port 3 commits from upstream crosspoint-reader PR #992 (1.1.0-rc branch) into mod/master.
## Commits Ported
### 1. chore: Bump version to 1.1.0 (402e887) — Skipped
- mod/master already has `version = 1.1.1-rc`, which is ahead of upstream's 1.1.0.
### 2. fix: Crash on unsupported bold/italic glyphs (3e2c518)
- **File:** `lib/GfxRenderer/GfxRenderer.cpp`
- Added null-safety checks to `getSpaceWidth()` and `getTextAdvanceX()`.
- `getSpaceWidth()`: returns 0 if the space glyph is missing in the styled font variant.
- `getTextAdvanceX()`: falls back to `REPLACEMENT_GLYPH` (U+FFFD) if a glyph is missing, and treats as zero-width if the replacement is also unavailable.
- Prevents a RISC-V Load access fault (nullptr dereference) when indexing chapters with characters unsupported by bold/italic font variants.
### 3. fix: Increase PNGdec buffer for wide images (b8e743e)
- **Files:** `platformio.ini`, `lib/Epub/Epub/converters/PngToFramebufferConverter.cpp`
- Bumped `PNG_MAX_BUFFERED_PIXELS` from 6402 to 16416 (supports up to 2048px wide RGBA images).
- Added `bytesPerPixelFromType()` and `requiredPngInternalBufferBytes()` helper functions.
- Added a pre-decode safety check that aborts with a log error if the PNG scanline buffer would overflow PNGdec's internal buffer.
## Verification
- Build (`pio run -e default`) succeeded cleanly with no errors or warnings.
- RAM: 31.5%, Flash: 70.4%.
## 4. CSS-aware image sizing (PR #1002, commit c8ba4fe)
- **Files:** `lib/Epub/Epub/css/CssStyle.h`, `lib/Epub/Epub/css/CssParser.cpp`, `lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp`
- Added `imageHeight` field to `CssPropertyFlags` and `CssStyle` (our existing `width` field maps to upstream's `imageWidth`).
- Added CSS `height` property parsing into `imageHeight`.
- Added `imageHeight` and `width` to cache serialization; bumped `CSS_CACHE_VERSION` 2->3.
- Replaced viewport-fit-only image scaling in `ChapterHtmlSlimParser` with CSS-aware sizing: resolves CSS height/width (including inline styles), preserves aspect ratio, clamps to viewport, includes divide-by-zero guards.
- `platformio.ini` changes excluded from commit per user request (PNG buffer bump was already committed separately).
## Follow-up
- None required. Changes are straightforward upstream ports.