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

wrong _pfp__path() when traversing an array #144

Open
michaelmera opened this issue Aug 11, 2021 · 0 comments · May be fixed by #145
Open

wrong _pfp__path() when traversing an array #144

michaelmera opened this issue Aug 11, 2021 · 0 comments · May be fixed by #145
Assignees
Labels
bug needs-triage A fresh user-reported issue that needs triage (i.e. is not a concrete-issue)

Comments

@michaelmera
Copy link

Describe the bug

Calling _pfp__path() on any DOM element contained in an array of non-primitive items returns the wrong result. The result is truncated at the array level and the name of the array items are sometime of the form None[i], even when the array has a name.

To Reproduce

    def test_path_for_array_items(self):
        dom = self._test_parse_build(
            "\x00\x00\x11\x11\x22\x22",
            """
                typedef struct _two_chars {
                    char x;
                    char y;
                } two_chars;

                struct {
                    two_chars the_array[3];
                } missing;
            """
        )

        self.assertEqual(dom.missing.the_array[1]._pfp__path(), "missing.the_array[1]")      # but get "None[1]"
        self.assertEqual(dom.missing.the_array[1].x._pfp__path(), "missing.the_array[1].x")  # but get "None[1].x"
        self.assertEqual(dom.missing.the_array[1].y._pfp__path(), "missing.the_array[1].y")  # but get "None[1].y"

Expected Behavior

The complete path should be retrieved, and it should include the correct name for the array.

@michaelmera michaelmera added bug needs-triage A fresh user-reported issue that needs triage (i.e. is not a concrete-issue) labels Aug 11, 2021
@michaelmera michaelmera linked a pull request Aug 11, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-triage A fresh user-reported issue that needs triage (i.e. is not a concrete-issue)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants