iso8583 icon indicating copy to clipboard operation
iso8583 copied to clipboard

Failed to pack message: panic: runtime error: slice bounds out of range [:32] with capacity 24

Open evofr20 opened this issue 3 years ago • 4 comments
trafficstars

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()

evofr20 avatar May 24 '22 21:05 evofr20

This is probably related with https://github.com/moov-io/iso8583/issues/172

adamdecaf avatar May 26 '22 15:05 adamdecaf

@adamdecaf it is more oriented to the limit amount of fields allowed, because the limit is 24.

evofr20 avatar May 26 '22 23:05 evofr20

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:

  1. check the length and return an error
  2. and/or remove maxBitmaps and just work with any bitmap length

alovak avatar Jun 09 '22 16:06 alovak

@evofr20, were you able to solve your issue? if so, what was the solution?

alovak avatar Oct 11 '22 08:10 alovak

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

alovak avatar Jun 29 '23 18:06 alovak