Skip to content

Crash when epub contains large CSS file #947

@sam-lord

Description

@sam-lord

Affected Version

v1.0.0

Describe the Bug

Some poorly formed epub files contain extra CSS files, in my case the full CSS for a website (>200kb, styles buttons, modals, etc).

Opening an epub file like this will crash the reader. It would be better to skip large CSS files, since they're not likely to be relevant to the book. I can't include the ebook I'm testing with for copyright reasons, but the logs show that there's core.css (actual styles for the book) & style.css (styles for... the website of the publisher??).

I've tested skipping large files and it worked, the book opens just fine.

Steps to Reproduce

  1. Create an epub with a large (200kb+) CSS file in the zip
  2. Transfer to the x4
  3. Open with the browse files menu
  4. x4 reboots

Expected Behavior

The book should open successfully, ignoring any large CSS files since they won't be relevant to the display of text in a book.

Relevant Log Output/Screenshots

12:43:20] [DBG] [COF] Entering guide state.
[12:43:20] [DBG] [COF] Found text reference in guide: OEBPS/cover.xhtml
[12:43:20] [ERR] [ZIP] Decompressed 5049 bytes into 30112 bytes
[12:43:20] [DBG] [EBP] Successfully parsed content.opf
[12:43:20] [DBG] [EBP] Parsing CSS file: OEBPS/core.css
[12:43:20] [ERR] [ZIP] Decompressed 3209 bytes into 15021 bytes
[12:43:21] [DBG] [CSS] Parsed 185 rules from 15021 bytes
[12:43:21] [DBG] [EBP] Parsing CSS file: OEBPS/style.css
[12:43:21] [ERR] [ZIP] Decompressed 35095 bytes into 259292 bytes
abort() was called at PC 0x4210b903 on core 0
Core  0 register dump:
MEPC    : 0x4038242a  RA      : 0x40387a44  SP      : 0x3fcacf50  GP      : 0x3fc8f000
TP      : 0x3f807ebc  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130
S0/FP   : 0x3fcacf7c  S1      : 0x3fcacf7c  A0      : 0x3fcacf88  A1      : 0x3fcacf6a
A2      : 0x00000000  A3      : 0x3fcacfb5  A4      : 0x00000001  A5      : 0x3fca6000
A6      : 0x7a797877  A7      : 0x76757473  S2      : 0x3fcad094  S3      : 0x3fcae9d8
S4      : 0x07512354  S5      : 0x50001aa0  S6      : 0x00000100  S7      : 0x000005db
S8      : 0x3c567000  S9      : 0x3c567000  S10     : 0x3c161000  S11     : 0x0000002a
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938
MSTATUS : 0x00001801  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000
MHARTID : 0x00000000
Stack memory:
3fcacf50: 0x3fcae9d8 0x00000200 0x3fcacf68 0x4038d178 0x00000000 0x00000000 0x3fca0030 0x3fc91b34
3fcacf70: 0x3fcacf7c 0x3fc91b50 0x3fcacf68 0x30313234 0x33303962 0x00000000 0x726f6261 0x20292874
3fcacf90: 0x20736177 0x6c6c6163 0x61206465 0x43502074 0x34783020 0x62303132 0x20333039 0x63206e6f
3fcacfb0: 0x2065726f 0x00000030 0x40380000 0xdfcf89a7 0x3c161000 0x500019ec 0x00000064 0x4210b906
3fcacfd0: 0x00000100 0x50001aa0 0x07512354 0x3fca68d4 0x00001800 0x00000064 0x00000064 0x4210b968
3fcacff0: 0x3fcad094 0x500019ec 0x00000064 0x4210b1cc 0x3fcad094 0x500019ec 0x00000030 0x4210b29e
3fcad010: 0x00000100 0x50001aa0 0x50001f60 0x4200182e 0x00001800 0x00000070 0x00000070 0x0000002f
3fcad030: 0x3fcad094 0x0000020e 0x00000070 0x0000002f 0x3fcad094 0x0000020e 0x50001f5c 0x42048c5e
3fcad050: 0x50001ecb 0x50001eca 0x3fcad094 0x69742d63 0x00000100 0x50001aa0 0x3fcad1b4 0xc70f6907
3fcad070: 0x3fca6000 0x3fcae9d8 0x50001a88 0x42049144 0x00001800 0x00000063 0x50001a70 0x50001aa0
3fcad090: 0x50001aa0 0x500019ec 0x0000002f 0x0000002f 0x3fcad182 0x3fcad234 0x3fcad134 0xdfcf89a7
3fcad0b0: 0x3fcae9d8 0x00000200 0x00000000 0x0001bc00 0x3fcad182 0x3fcad234 0x3fcad188 0x3fca6000
3fcad0d0: 0x00000000 0x3fcae9d8 0x3fcad18c 0x42049302 0x00000000 0x00000001 0x00000000 0x00000000
3fcad0f0: 0x00000000 0x00000200 0x00000000 0x42031800 0x00000000 0x00000200 0x00000000 0x42032000
3fcad110: 0x00000000 0x00000200 0x00000000 0x4202f000 0x00000000 0x3fcadc00 0x00000000 0xdfcf8900
3fcad130: 0x00000000 0x50001b30 0x00000062 0x00000062 0x3fcae9d8 0x00000200 0x00000000 0xdfcf89a7
3fcad150: 0x0000010d 0x3fcad234 0x0000007d 0x3fcadc84 0x00000000 0x00000000 0x3fcad18c 0x420495e0
3fcad170: 0x3c56469b 0x00000001 0x3fcadc94 0x3fca6000 0x0000d284 0x00000000 0x00000000 0x3fcad182
3fcad190: 0x3fcad184 0x3fcad188 0x3fcad434 0x3fcad1b4 0x3fcad838 0x3fcad183 0x3fcad204 0x3fcad21c
3fcad1b0: 0x3fcae9d8 0x00000001 0x00000000 0x00000000 0x00000000 0x00000200 0x00000000 0x42031800
3fcad1d0: 0x00000000 0x00000200 0x00000000 0x42032000 0x00000000 0x00000200 0x00000000 0x4202f000
3fcad1f0: 0x00000000 0x3fcadc00 0x00000000 0xdfcf8900 0x00000000 0x3fcad20c 0x00000007 0x70736964
3fcad210: 0x0079616c 0x74680068 0x006e6f00 0x3fcad224 0x00000004 0x656e6f6e 0x74750000 0x3531206f
3fcad230: 0x00007870 0x61652073 0x692d6573 0x756f2d6e 0x7d0a0d74 0x732e0a0d 0x63736275 0x65626972
3fcad250: 0x67616e2d 0x61732e20 0x656c706d 0x73656d2d 0x65676173 0x67616e2e 0x6820612d 0x0a0d2c32
3fcad270: 0x6275732e 0x69726373 0x6e2d6562 0x2e206761 0x706d6173 0x6d2d656c 0x61737365 0x6e2e6567
3fcad290: 0x622d6761 0x20326820 0x200a0d7b 0x74202020 0x2d747865 0x67696c61 0x6c203a6e 0x3b746665
3fcad2b0: 0x20200a0d 0x616d2020 0x6e696772 0x66656c2d 0x30203a74 0x0d7d0a0d 0x75732e0a 0x72637362
3fcad2d0: 0x2d656269 0x2067616e 0x6d61732e 0x2d656c70 0x7373656d 0x2e656761 0x2d67616e 0x642e2061
3fcad2f0: 0x742d636f 0x656c7469 0x2e0a0d2c 0x73627573 0x62697263 0x616e2d65 0x732e2067 0x6c706d61
3fcad310: 0x656d2d65 0x67617373 0x616e2e65 0x20622d67 0x636f642e 0x7469742d 0x7b20656c 0x20200a0d
3fcad330: 0x69642020 0x616c7073 0x6e203a79 0x0d656e6f 0x0a0d7d0a 0x6275732e 0x69726373 0x6e2d6562
ELF file SHA256: a567958b02d689f1
Rebooting...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcrashConditions that cause crosspoint to crashtriageBug to be triaged

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions