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

scanner: no longer dump debug messages to stderr #57

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

evverx
Copy link
Contributor

@evverx evverx commented Nov 28, 2022

When varlink_object_new_from_json is fuzzed it receives a lot of bogus json strings and clutters stderr with messages like "2 != 4" instead of just returning errors. Given that it's the only place where fprintf is used like that it seems it was left there accidentally and can probably be safely removed to make the API more consistent in general.

It should make it easier to fuzz the library and other than that it should also make it possible to compile libvarlink on some architectures without compiler warnings like

../lib/scanner.c:628:49: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                fprintf(stderr, "%ld != %ld\n", utf8_len, size);
                                 ~~~            ^~~~~~~~
                                 %zu
../lib/scanner.c:628:59: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                fprintf(stderr, "%ld != %ld\n", utf8_len, size);
                                        ~~~               ^~~~
                                        %zu

When varlink_object_new_from_json is fuzzed it receives a lot of bogus
json strings and clutters stderr with messages like "2 != 4" instead of
just returning errors. Given that it's the only place where fprintf is
used like that it seems it was left there accidentally and can
probably be safely removed to make the API more consistent in general.

It should make it easier to fuzz the library and other than that it
should also make it possible to compile libvarlink on some architectures
without compiler warnings like
```
../lib/scanner.c:628:49: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                fprintf(stderr, "%ld != %ld\n", utf8_len, size);
                                 ~~~            ^~~~~~~~
                                 %zu
../lib/scanner.c:628:59: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                fprintf(stderr, "%ld != %ld\n", utf8_len, size);
                                        ~~~               ^~~~
                                        %zu
```
@evverx evverx mentioned this pull request Nov 28, 2022
@haraldh haraldh merged commit b0a5530 into varlink:master Dec 12, 2022
@haraldh
Copy link
Contributor

haraldh commented Dec 12, 2022

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants