Open Bug 552214 Opened 14 years ago Updated 2 years ago

Allow access into undefined length arrays

Categories

(Core :: js-ctypes, defect, P3)

x86
macOS
defect

Tracking

()

People

(Reporter: Mardak, Unassigned)

References

(Blocks 2 open bugs)

Details

When using "libc.hostent" to get an array of ip addresses, you need to declare h_addr_list as ctypes.uint8_t.array(4).ptr.array().ptr because we don't know how many addresses will be in the result.

The length is provided in h_length in the struct. But trying to access a valid entry (according to the length) results in:

Error: cannot get contents of undefined size

To get around this, you need to cast the list pointer to the actual size:

ctypes.cast(google.contents.h_addr_list,
            ctypes.uint8_t.array(4).ptr.array(google.contents.h_length).ptr);

However, allowing access into undefined length arrays would prevent us from doing some kind of bounds check.
Blocks: 552215
P2, very nice to have for 1.9.3.
Priority: -- → P2
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.