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

int64 issues #153

Open
kstreitova opened this issue Sep 23, 2019 · 5 comments
Open

int64 issues #153

kstreitova opened this issue Sep 23, 2019 · 5 comments

Comments

@kstreitova
Copy link

Hello,

2 years back one of the SUSE engineers found that libconfig has a series of issues when supporting and parsing 64-bit integer values. It was supposedly reported to upstream by him but as he is no longer in SUSE, we can't evaluate if there is any progress in this matter. So I'm reporting it again so we are sure that it reached the upstream.

See https://gitlab.com/mcgrof/libconfig-int64-issues for more information.

Can you please evaluate?

Thank you!

@hyperrealm hyperrealm added the bug label Dec 15, 2019
@hyperrealm
Copy link
Owner

Not supporting unsigned integer types was a conscious decision, so as to improve compatibility with programming languages that do not have unsigned types (e.g, Java). Adding support for unsigned types would just shift the problem to such non-C/C++ format-compatible implementations.

The issue with the theoretical limit of 2^31 child settings per parent setting is noted, but I really do not anticipate anyone will be creating configuration files with billions of settings; that's just not practical, and not the intended use case for this library.

Checking for enormous file sizes before initiating parsing is outside the scope of this library, in my opinion. This library is intended to be small and focused, and such edge-case validations should be done by the calling application.

The int<->int64 casting issues and value rollovers are legitimate bugs to be addressed in libconfig. I'll look into these as soon as time permits.

@danyspin97
Copy link

Any news on this issue?

@acipm
Copy link

acipm commented Aug 15, 2022

Hi, are there any updates on this? I could not find a commit that addresses these issues and the patch from the gitlab repo that @kstreitova linked seems to be not applied as well. Will this still be addressed? Thank you very much for your work!

@haydaralaidrus
Copy link

The int<->int64 casting issues and value rollovers are legitimate bugs to be addressed in libconfig. I'll look into these as soon as time permits.

Is this issue has been raised before? How do I find a way to reproduce it?

@hyperrealm
Copy link
Owner

I am downgrading this to a feature request to add unsigned integer types.

I have tested with the inputs provided with this issue and I do not see an actual bug in libconfig. In no case does it return a clipped or wrapped or otherwise incorrect value. Values outside the supported range for a signed 64-bit integer result in a syntax error when reading a config file. A 'lookup' call to read a value into an int that is actually a 64-bit int which has a value outside the range of an int, result in an error return status from that call.

The 'L' suffix, and the handling of integers in general, is well documented in the libconfig manual. The library by design does not support unsigned integers or a 'U' suffix. Programs that expect setting values to be within a specific range (for example, non-negative), have to range-check those values themselves.

It's possible that some of the issues mentioned here were an issue at one point and have since been fixed.

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

No branches or pull requests

5 participants