Mageia Bugzilla – Attachment 10488 Details for
Bug 23695
yaml-cpp new security issue CVE-2017-5950
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
YAML parser for PoC test file
parse.cpp (text/x-csrc), 1.39 KB, created by
Len Lawrence
on 2018-11-20 16:31:18 CET
(
hide
)
Description:
YAML parser for PoC test file
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2018-11-20 16:31:18 CET
Size:
1.39 KB
patch
obsolete
>#include <fstream> >#include <iostream> >#include <vector> > >#include "yaml-cpp/eventhandler.h" >#include "yaml-cpp/yaml.h" // IWYU pragma: keep > >struct Params { > bool hasFile; > std::string fileName; >}; > >Params ParseArgs(int argc, char** argv) { > Params p; > > std::vector<std::string> args(argv + 1, argv + argc); > > return p; >} > >class NullEventHandler : public YAML::EventHandler { > public: > virtual void OnDocumentStart(const YAML::Mark&) {} > virtual void OnDocumentEnd() {} > > virtual void OnNull(const YAML::Mark&, YAML::anchor_t) {} > virtual void OnAlias(const YAML::Mark&, YAML::anchor_t) {} > virtual void OnScalar(const YAML::Mark&, const std::string&, YAML::anchor_t, > const std::string&) {} > > virtual void OnSequenceStart(const YAML::Mark&, const std::string&, > YAML::anchor_t) {} > virtual void OnSequenceEnd() {} > > virtual void OnMapStart(const YAML::Mark&, const std::string&, > YAML::anchor_t) {} > virtual void OnMapEnd() {} >}; > >void parse(std::istream& input) { > try { > YAML::Node doc = YAML::Load(input); > std::cout << doc << "\n"; > } catch (const YAML::Exception& e) { > std::cerr << e.what() << "\n"; > } >} > >int main(int argc, char** argv) { > Params p = ParseArgs(argc, argv); > > if (argc > 1) { > std::ifstream fin; > fin.open(argv[1]); > parse(fin); > } else { > parse(std::cin); > } > > return 0; >}
#include <fstream> #include <iostream> #include <vector> #include "yaml-cpp/eventhandler.h" #include "yaml-cpp/yaml.h" // IWYU pragma: keep struct Params { bool hasFile; std::string fileName; }; Params ParseArgs(int argc, char** argv) { Params p; std::vector<std::string> args(argv + 1, argv + argc); return p; } class NullEventHandler : public YAML::EventHandler { public: virtual void OnDocumentStart(const YAML::Mark&) {} virtual void OnDocumentEnd() {} virtual void OnNull(const YAML::Mark&, YAML::anchor_t) {} virtual void OnAlias(const YAML::Mark&, YAML::anchor_t) {} virtual void OnScalar(const YAML::Mark&, const std::string&, YAML::anchor_t, const std::string&) {} virtual void OnSequenceStart(const YAML::Mark&, const std::string&, YAML::anchor_t) {} virtual void OnSequenceEnd() {} virtual void OnMapStart(const YAML::Mark&, const std::string&, YAML::anchor_t) {} virtual void OnMapEnd() {} }; void parse(std::istream& input) { try { YAML::Node doc = YAML::Load(input); std::cout << doc << "\n"; } catch (const YAML::Exception& e) { std::cerr << e.what() << "\n"; } } int main(int argc, char** argv) { Params p = ParseArgs(argc, argv); if (argc > 1) { std::ifstream fin; fin.open(argv[1]); parse(fin); } else { parse(std::cin); } return 0; }
View Attachment As Raw
Actions:
View
Attachments on
bug 23695
: 10488 |
10489
|
10491