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

TypeError: unhashable type: 'RepeatedScalarFieldContainer' #30

Open
dmiller423 opened this issue Jun 19, 2024 · 3 comments
Open

TypeError: unhashable type: 'RepeatedScalarFieldContainer' #30

dmiller423 opened this issue Jun 19, 2024 · 3 comments

Comments

@dmiller423
Copy link

dmiller423 commented Jun 19, 2024

Scanning elf containing obvious protobuf's

Traceback (most recent call last):
  File "c:\path_to\pbtk\gui.py", line 462, in run
    for name, contents in self.extractor['func'](input_):
  File "c:\path_to\pbtk\extractors\from_binary.py", line 78, in walk_binary
    yield descpb_to_proto(proto)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\path_to\pbtk\utils\descpb_to_proto.py", line 45, in descpb_to_proto
    out += parse_msg(desc, scopes, desc.syntax).strip('\n')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\path_to\pbtk\utils\descpb_to_proto.py", line 60, in parse_msg
    blocks[nested_msg.name] = parse_msg(nested_msg, scopes, syntax)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\path_to\pbtk\utils\descpb_to_proto.py", line 79, in parse_msg
    out += fmt_field(field, scopes, blocks, syntax)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\path_to\pbtk\utils\descpb_to_proto.py", line 168, in fmt_field
    line = '%s %s %s = %s;\n' % (labels[field.label], type_, field.name, fmt_value(field.number, field.options, optarr=default))
                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\path_to\pbtk\utils\descpb_to_proto.py", line 126, in fmt_value
    opts.append('%s = %s' % (option.name, fmt_value(value, desc=option)))
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\path_to\pbtk\utils\descpb_to_proto.py", line 118, in fmt_value
    val = desc.enum_type.values_by_number[val].name
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
TypeError: unhashable type: 'RepeatedScalarFieldContainer'
@Davis-3450
Copy link

I got the same issue

@dmiller423
Copy link
Author

It doesn't support many types of fields, but you'd think scalars would be simple ... basically an array of integers would be a 'RepeatedScalar' Field ? who knows I used protodump and it worked w.o any hassle

@Davis-3450
Copy link

Davis-3450 commented Jul 27, 2024

Little update if that works for you or anyone else.

One month ago, I found a fix, but I forgot to share it, here's my fork with the fix I made.

This worked for the error that I got which was very similar if not the same, it's based on this which fixed this issue: #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants