-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Right now we are using streams for moving the icals around, but for the preprocessors, we are still just converting them to Strings, which may overload the device's memory. We've had this issue with ICSx⁵ (bitfireAT/icsx5#716), and it's quite a specific issue, but I've managed to reproduce with the following test code:
package at.bitfire.synctools.icalendar
import org.junit.Test
import java.io.StringReader
import java.util.UUID
class ICalendarParserInstrumentedTest {
@Test
fun testParse_SuperLargeFiles() {
val parser = ICalendarParser()
val reader = StringReader(
("""
BEGIN:VCALENDAR
PRODID:-//xyz Corp//NONSGML PDA Calendar Version 1.0//EN
VERSION:2.0
""".trimIndent() +
(0 until Int.MAX_VALUE).joinToString { idx ->
"""
BEGIN:VEVENT
DTSTAMP:19960704T120000Z
UID:${UUID.randomUUID()}
ORGANIZER:mailto:[email protected]
DTSTART:19960918T143000Z
DTEND:19960920T220000Z
STATUS:CONFIRMED
CATEGORIES:CONFERENCE
SUMMARY:Event $idx
DESCRIPTION:Event $idx description
END:VEVENT
""".trimIndent()
} + "END:VCALENDAR")
)
parser.parse(reader)
// no exception called
}
}Edit: test not correct, breaks with joinToString