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

Serialized and deserialized types must match #291

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

olologin
Copy link

In our project at work we use custom boost archive for serialization and deserialization, and unsigned integers are serialized in a non-trivial way, which does not match with serialization of signed integer. This causes some troubles.

I guess it is fine to change this serialization method in upstream project.

In our project at work we use custom boost archive for serialization and deserialization, and unsigned integers are serialized in a non-trivial way, which does not match with serialization of signed integer. This causes some troubles.

I guess it is fine to change this serialization method in upstream project.
@jeremy-murphy
Copy link
Contributor

Hi @olologin , thanks for your interest in improving Boost.Graph. I don't really understand the problem here with the return type of num_vertices and num_edges. Are you saying that the value overflows signed integer, and that's why it needs to be unsigned?
Can you possibly open an issue with instructions for how to reproduce the problem?

@olologin
Copy link
Author

olologin commented Apr 12, 2022

@jeremy-murphy
boost::serialization has requirement to always serialize and deserialize the same types in the same order.
In case with this particular serialization in adj_list_serialize this simple requirement is violated.

It is not easy to reproduce failure here, because in our company we override serialization of unsigned and signed types in boost archive, and we override it differently for signed and unsigned types, and this is why nobody else sees a problem in adj_list_serialize.

@jeremy-murphy
Copy link
Contributor

I want to help, but I'm not sure whether this is actually a problem in Boost.Graph, or a problem in Boost.Serialization, or a problem in your code. I can't change anything in Boost.Graph without convincing evidence that the problem is here, which usually means a minimal working example that demonstrates the issue combined with a patch that fixes it.
You've provided a patch here, but there is no evidence that there is a problem or that this patch fixes it.

@olologin
Copy link
Author

@jeremy-murphy
I understand you. But you can see two functions, one is "save" and the other one is "load", first one saves "int", second one loads "unsigned int". These types are different and this is why it is broken.

I will try to come up with a test to reproduce failure.

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