Runtime error: slice bounds out of range when ingesting Powershell logs

I am trying to ingest Powershell logs using winlogbeat 7.12 using the following configuration:

- name: WEC-Powershell
  tags: [forwarded]
    - script: Windows-PowerShell
      lang: javascript
      id: security
      file: ${path.home}/module/security/config/winlogbeat-security.js

But when I do this I get the following error when starting winlogbeat and winlogbeat immediately crashes

2021-03-29T13:24:10.447-0700	INFO	beater/eventlogger.go:129	EventLog[WEC-Powershell] Stop processing.
panic: runtime error: slice bounds out of range [:18506] with capacity 16384

goroutine 1187 [running]:, 0x100003c, 0xc006d04cd0, 0xa, 0x2000074, 0x0, 0xc001068000, 0x4000, 0x4000, 0x333bb60, ...)
	/go/src/ +0x405, 0xc000000000, 0xc001068000, 0x4000, 0x4000, 0xc0042070c0, 0x333bb60, 0xc00095d140, 0xc004207640, 0x40)
	/go/src/ +0x112, 0x333bb60, 0xc00095d140, 0x69, 0x0)
	/go/src/ +0xa7*winEventLog).Read(0xc0002d3400, 0x0, 0x0, 0x0, 0x0, 0x0)
	/go/src/ +0x295*eventLogger).run(0xc000909b30, 0xc0001cd140, 0x33584c0, 0xc00050a280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/ +0x46e*Winlogbeat).processEventLog(0xc00019a1c0, 0xc000da3310, 0xc000909b30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/ +0xd6
created by*Winlogbeat).Run
	/go/src/ +0x35a