Xteink-X4-crosspoint-reader/lib
IFAKA 73d1839ddd
fix: add bounds checks to Epub getter functions (#82)
## Problem
Three Epub getter functions can throw exceptions:
- `getCumulativeSpineItemSize()`: No bounds check before
`.at(spineIndex)`
- `getSpineItem()`: If spine is empty and index invalid, `.at(0)` throws
- `getTocItem()`: If toc is empty and index invalid, `.at(0)` throws

## Fix
- Add bounds check to `getCumulativeSpineItemSize()`, return 0 on error
- Add empty container checks to `getSpineItem()` and `getTocItem()`
- Use static fallback objects for safe reference returns on empty
containers

Changed `lib/Epub/Epub.cpp`.

## Test
- Defensive additions - follows existing bounds check patterns
- No logic changes for valid inputs
- Manual device testing appreciated
2025-12-21 13:36:30 +11:00
..
EpdFont Fix font readability by expanding blacks and trimming whites (#55) 2025-12-18 21:39:13 +11:00
Epub fix: add bounds checks to Epub getter functions (#82) 2025-12-21 13:36:30 +11:00
expat Add expat and swap out EPUB HTML parser (#2) 2025-12-06 20:57:24 +11:00
GfxRenderer fix: add NULL checks for frameBuffer in GfxRenderer (#79) 2025-12-21 13:34:58 +11:00
miniz Stream inflated EPUB HTMLs down to disk instead of inflating in memory (#4) 2025-12-08 00:39:17 +11:00
Serialization Public release 2025-12-03 22:06:45 +11:00
Utf8 Public release 2025-12-03 22:06:45 +11:00
ZipFile fix: add NULL check after malloc in readFileToMemory() (#81) 2025-12-21 13:35:37 +11:00
README Public release 2025-12-03 22:06:45 +11:00

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into the executable file.

The source code of each library should be placed in a separate directory
("lib/your_library_name/[Code]").

For example, see the structure of the following example libraries `Foo` and `Bar`:

|--lib
|  |
|  |--Bar
|  |  |--docs
|  |  |--examples
|  |  |--src
|  |     |- Bar.c
|  |     |- Bar.h
|  |  |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|  |
|  |--Foo
|  |  |- Foo.c
|  |  |- Foo.h
|  |
|  |- README --> THIS FILE
|
|- platformio.ini
|--src
   |- main.c

Example contents of `src/main.c` using Foo and Bar:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
  ...
}

```

The PlatformIO Library Dependency Finder will find automatically dependent
libraries by scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html