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

Mismatching sizeof() for date inner values #264

Open
michaelwright235 opened this issue Aug 30, 2024 · 0 comments
Open

Mismatching sizeof() for date inner values #264

michaelwright235 opened this issue Aug 30, 2024 · 0 comments

Comments

@michaelwright235
Copy link

I've encountered a bug when I tried using the plist_set_date_val function:

Assertion failed: (length == sizeof(double)), function plist_get_date_val, file plist.c, line 1420.

When I was expecting the code, I found out that arguments of sizeof for date related functions are mismatching.

plist_new_date(...) (uses double):

data->length = sizeof(double);

plist_set_date_val(...) (uses timeval):

plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval));

plist_get_date_val(...) (uses double):

assert(length == sizeof(double));
michaelwright235 added a commit to michaelwright235/plist_plus that referenced this issue Aug 30, 2024
When creating a date the original library expects one to pass the
number of seconds since 01/01/2001 (Mac Epoch). Since it's not
obvious and we're quite used to standart Unix Timestamps instead,
these methods automatically convert dates to Mac Epoch format
(just like the `plist` rust library does).
Both `set_date_val` method and `set_random_date` test
currently panics with an assertion failure due to a
[`libplist` bug](libimobiledevice/libplist#264).
michaelwright235 added a commit to michaelwright235/plist_plus that referenced this issue Aug 30, 2024
When creating a date the original library expects one to pass the
number of seconds since 01/01/2001 (Mac Epoch). Since it's not
obvious and we're quite used to standart Unix Timestamps instead,
these methods automatically convert dates to Mac Epoch format
(just like the `plist` rust library does).
Both `set_date_val` method and `set_random_date` test
currently panics with an assertion failure due to a
[`libplist` bug](libimobiledevice/libplist#264).
jkcoxson pushed a commit to jkcoxson/plist_plus that referenced this issue Aug 30, 2024
* date: Implement date methods
When creating a date the original library expects one to pass the
number of seconds since 01/01/2001 (Mac Epoch). Since it's not
obvious and we're quite used to standart Unix Timestamps instead,
these methods automatically convert dates to Mac Epoch format
(just like the `plist` rust library does).
Both `set_date_val` method and `set_random_date` test
currently panics with an assertion failure due to a
[`libplist` bug](libimobiledevice/libplist#264).

* date: implement From<SystemTime>
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

1 participant