Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
evofr20 opened this issue May 24, 2022 · 5 comments
Assignees
Labels
bug Something isn't working hacktoberfest-accepted

Comments

@evofr20
Copy link

evofr20 commented May 24, 2022

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 evofr20 changed the title Filed to pack message: panic: runtime error: slice bounds out of range [:32] with capacity 24 Failed to pack message: panic: runtime error: slice bounds out of range [:32] with capacity 24 May 24, 2022
@adamdecaf adamdecaf added the bug Something isn't working label May 26, 2022
@adamdecaf
Copy link
Member

This is probably related with #172

@evofr20
Copy link
Author

evofr20 commented May 26, 2022

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

@alovak
Copy link
Contributor

alovak commented Jun 9, 2022

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

@mfdeveloper508 mfdeveloper508 self-assigned this Jul 1, 2022
@mfdeveloper508 mfdeveloper508 linked a pull request Jul 1, 2022 that will close this issue
@alovak
Copy link
Contributor

alovak commented Oct 11, 2022

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

@alovak
Copy link
Contributor

alovak commented Jun 29, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest-accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants