iso8583
iso8583 copied to clipboard
Failed to pack message: panic: runtime error: slice bounds out of range [:32] with capacity 24
Right now I'm doing the pack() of my message, but apparently there is a limit of fields that doesn't allow me to do it. Is there a way to change this limit? This is the error:
panic: runtime error: slice bounds out of range [:32] with capacity 24
goroutine 1 [running]: github.com/moov-io/iso8583/field.(*Bitmap).Pack(0xc000096228) ./vendor/github.com/moov-io/iso8583/field/bitmap.go:63 +0x135 github.com/moov-io/iso8583.(*Message).Pack(0xc00010fe20) ./vendor/github.com/moov-io/iso8583/message.go:144 +0x4c7 main.main()
This is probably related with https://github.com/moov-io/iso8583/issues/172
@adamdecaf it is more oriented to the limit amount of fields allowed, because the limit is 24.
As far as I see, the issue here is that we support max 3 bitmaps in the message. Am I right that in your message @evofr20, you have more than 3 bitmaps (fields with index 193+)?
const maxBitmaps = 3
...
// we create bitmap with max 3*8 bytes
bitmap: utils.NewBitmap(64 * maxBitmaps)
I see here two solutions:
- check the length and return an error
- and/or remove
maxBitmapsand just work with any bitmap length
@evofr20, were you able to solve your issue? if so, what was the solution?
We reworked the bitmap and there is no more length limit. Bitmap will expand automatically when needed.
Closing this issue due to its age and the lack of additional information. Please feel free to reopen with the necessary details if it remains relevant with updates to the bitmap we released in https://github.com/moov-io/iso8583/releases/tag/v0.15.0