René's URL Explorer Experiment


Title: serialize19::ReadArchive: how to catch memory read access violation · Issue #6 · basicpp/co-cpp19 · GitHub

Open Graph Title: serialize19::ReadArchive: how to catch memory read access violation · Issue #6 · basicpp/co-cpp19

X Title: serialize19::ReadArchive: how to catch memory read access violation · Issue #6 · basicpp/co-cpp19

Description: I'm using serialize19 to create and load binary files of structured data. But if the file format changes, e.g. because data members have been added / removed, or if the file gets corrupted in some way, the archive reader might cause a re...

Open Graph Description: I'm using serialize19 to create and load binary files of structured data. But if the file format changes, e.g. because data members have been added / removed, or if the file gets corrupted in some ...

X Description: I'm using serialize19 to create and load binary files of structured data. But if the file format changes, e.g. because data members have been added / removed, or if the file gets corrupted in s...

Opengraph URL: https://github.com/basicpp/co-cpp19/issues/6

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"serialize19::ReadArchive: how to catch memory read access violation","articleBody":"I'm using serialize19 to create and load binary files of structured data.\r\n\r\nBut if the file format changes, e.g. because data members have been added / removed, or if the file gets corrupted in some way, the archive reader might cause a read access exception which can't be caught without messing with signal handlers.\r\n\r\n=> is there a clean and reliable way to detect and handle this condition without application crash?\r\n\r\n```\r\n#include \"serialize19/ReadArchive.h\"\r\n#include \"serialize19/dynamicWrite.h\"\r\n#include \"serialize19/serialize.std_string.h\"\r\n\r\nstruct OldFileFormat\r\n{\r\n    int a{};\r\n    int b{};\r\n    std::string s{};\r\n};\r\n\r\nstruct NewFileFormat\r\n{\r\n    int a{};\r\n    int b{};\r\n    int c{};\r\n    std::string s{};\r\n};\r\n\r\ntemplate\u003cclass A>\r\nvoid serialize(A& a, OldFileFormat& x)\r\n{\r\n    serialize(a, x.a);\r\n    serialize(a, x.b);\r\n    serialize(a, x.s);\r\n}\r\n\r\ntemplate\u003cclass A>\r\nvoid serialize(A& a, NewFileFormat& x)\r\n{\r\n    serialize(a, x.a);\r\n    serialize(a, x.b);\r\n    serialize(a, x.c);\r\n    serialize(a, x.s);\r\n}\r\n\r\nvoid main()\r\n{\r\n    OldFileFormat old_data{1, 2, \"test\"};\r\n\r\n    const auto buffer_old = serialize19::dynamicWrite(old_data); \r\n\r\n    // the buffer contents usually get saved into a binary file:\r\n    // std::ofstream fout{filename, std::ios::binary};\r\n    // fout.write(reinterpret_cast\u003cconst char*>(slice.begin()), slice.count());\r\n    //\r\n    // ... and later on we read the file back into a buffer slice via\r\n    // std::ifstream fin{filename, std::ios::binary};\r\n    // const auto file_buffer = std::vector\u003cuint8_t>{std::istreambuf_iterator(fin), {}}\r\n    // const auto file_buffer_slize = serialize19::BufferSlice{file_buffer.data(), file_buffer.size()});\r\n    //\r\n    // here we just skip this step and hand over the already existing buffer slice \r\n\r\n    auto reader = serialize19::ReadArchive{buffer_old.slice()};\r\n    NewFileFormat new_data;\r\n\r\n    try\r\n    {\r\n        serialize(reader, new_data);\r\n    }\r\n    catch (const std::exception& ex)\r\n    {\r\n        // We want to catch all file read exceptions in a clean way but there is only a hardware exception being thrown which requires dirty signal handler\r\n    }\r\n}\r\n```","author":{"url":"https://github.com/fred777","@type":"Person","name":"fred777"},"datePublished":"2023-05-24T16:17:35Z","url":"https://github.com/basicpp/co-cpp19/issues/6"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:591a9d48-cb40-01c5-507e-14acb721a6d0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDA00:29A20E:2CEB40B:3D5D6D8:6B005BB2
html-safe-nonceaac23e57f473ca6a5e20ee9bdad3c4810ad499d24fa9a4af531cda289f476fe6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTAwOjI5QTIwRToyQ0VCNDBCOjNENUQ2RDg6NkIwMDVCQjIiLCJ2aXNpdG9yX2lkIjoiMjgzMzg3MjU1MjQ0MTQzNzEwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4a89d16e3f81bbf403e10219a7069ef37f062bbb399269353ea864326f5e8d10
hovercard-subject-tagissue:1724352391
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/basicpp/co-cpp19/6/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2880fcd52ca57cf1cb6b00d8da9265d818c935798a66e5a8d5535fde93271b3d/basicpp/co-cpp19/issues/6
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2880fcd52ca57cf1cb6b00d8da9265d818c935798a66e5a8d5535fde93271b3d/basicpp/co-cpp19/issues/6
og:image:altI'm using serialize19 to create and load binary files of structured data. But if the file format changes, e.g. because data members have been added / removed, or if the file gets corrupted in some ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefred777
hostnamegithub.com
expected-hostnamegithub.com
None29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73
turbo-cache-controlno-preview
go-importgithub.com/basicpp/co-cpp19 git https://github.com/basicpp/co-cpp19.git
octolytics-dimension-user_id46325550
octolytics-dimension-user_loginbasicpp
octolytics-dimension-repository_id267431850
octolytics-dimension-repository_nwobasicpp/co-cpp19
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id267431850
octolytics-dimension-repository_network_root_nwobasicpp/co-cpp19
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseeacd927ba6112e3b01ba99c762bd699a4a4f5df7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/basicpp/co-cpp19/issues/6#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbasicpp%2Fco-cpp19%2Fissues%2F6
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbasicpp%2Fco-cpp19%2Fissues%2F6
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=basicpp%2Fco-cpp19
Reloadhttps://github.com/basicpp/co-cpp19/issues/6
Reloadhttps://github.com/basicpp/co-cpp19/issues/6
Reloadhttps://github.com/basicpp/co-cpp19/issues/6
basicpphttps://github.com/basicpp
co-cpp19https://github.com/basicpp/co-cpp19
Codehttps://github.com/basicpp/co-cpp19
Issues1 (1)https://github.com/basicpp/co-cpp19/issues
Pull requestshttps://github.com/basicpp/co-cpp19/pulls
Actionshttps://github.com/basicpp/co-cpp19/actions
Projectshttps://github.com/basicpp/co-cpp19/projects
Security and qualityhttps://github.com/basicpp/co-cpp19/security
Insightshttps://github.com/basicpp/co-cpp19/insights
https://github.com/basicpp/co-cpp19
New issuehttps://github.com/login?return_to=https://github.com/basicpp/co-cpp19/issues/6
New issuehttps://github.com/login?return_to=https://github.com/basicpp/co-cpp19/issues/6
serialize19::ReadArchive: how to catch memory read access violationhttps://github.com/basicpp/co-cpp19/issues/6#top
enhancementNew feature or requesthttps://github.com/basicpp/co-cpp19/issues?q=state%3Aopen%20label%3A%22enhancement%22
help wantedExtra attention is neededhttps://github.com/basicpp/co-cpp19/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/fred777
fred777https://github.com/fred777
on May 24, 2023https://github.com/basicpp/co-cpp19/issues/6#issue-1724352391
https://github.com/arBmind
arBmindhttps://github.com/arBmind
on May 24, 2023https://github.com/basicpp/co-cpp19/issues/6#issuecomment-1562005269
@fred777https://github.com/fred777
arBmindhttps://github.com/arBmind
help wantedExtra attention is neededhttps://github.com/basicpp/co-cpp19/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
on May 24, 2023https://github.com/basicpp/co-cpp19/issues/6#event-9333281711
https://github.com/arBmind
arBmindhttps://github.com/arBmind
on May 24, 2023https://github.com/basicpp/co-cpp19/issues/6#issuecomment-1562012784
https://github.com/arBmind
arBmindhttps://github.com/arBmind
on May 24, 2023https://github.com/basicpp/co-cpp19/issues/6#issuecomment-1562013879
https://github.com/fred777
fred777https://github.com/fred777
on May 25, 2023https://github.com/basicpp/co-cpp19/issues/6#issuecomment-1562459425
@arBmindhttps://github.com/arBmind
https://github.com/arBmind
arBmindhttps://github.com/arBmind
on May 25, 2023https://github.com/basicpp/co-cpp19/issues/6#issuecomment-1562504492
@fred777https://github.com/fred777
https://github.com/fred777
fred777https://github.com/fred777
on May 25, 2023https://github.com/basicpp/co-cpp19/issues/6#issuecomment-1562815337
arBmindhttps://github.com/arBmind
enhancementNew feature or requesthttps://github.com/basicpp/co-cpp19/issues?q=state%3Aopen%20label%3A%22enhancement%22
on Jun 28, 2025https://github.com/basicpp/co-cpp19/issues/6#event-18368888936
Sign up for freehttps://github.com/signup?return_to=https://github.com/basicpp/co-cpp19/issues/6
Sign in to commenthttps://github.com/login?return_to=https://github.com/basicpp/co-cpp19/issues/6
enhancementNew feature or requesthttps://github.com/basicpp/co-cpp19/issues?q=state%3Aopen%20label%3A%22enhancement%22
help wantedExtra attention is neededhttps://github.com/basicpp/co-cpp19/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.