Closed campbellr closed 4 months ago
I've opened https://github.com/moov-io/ach/pull/1388 to fix this bug. Can you try out the branch on your file and see if parsing works?
Yes, that MR seems to do the trick, thanks for the quick fix!
Fix released in https://github.com/moov-io/ach/releases/tag/v1.35.1
ACH Version
master
What were you trying to do?
We sometimes receive large ACH files where:
the entire file exceeds the
bufio.MaxTokenSize
ach.Reader
runs into problems parsing the file because it uses aScanner
that splits on newlines, and has a 64k maximum buffer/token size.Because
ach.Reader.Read
doesn't actually check the result ofScanner.Scan()
(orScanner.Err()
), it attempts to parse an arbitrary 64k chunk of data as an ACH record (or series of records) and fails.What did you expect to see?
ach.Reader
should be able to consume arbitrarily large ACH files, with or without newline-delimited records (at least until we run out of memory).I think using a custom
SplitFunc
(that breaks 94 byte records and/or newlines -- to handle "broken" lines that aren't padded to 94 characters) for theScanner
instead of the defaultScanLines
would be more reliable.What did you see?
ach.Reader fails to properly parse the file with some cryptic message about
How can we reproduce the problem?
Attempt to read an ACH file that:
bufio.MaxScanTokenSize
)