Skip to content

Poco::format receives empty Vector<Any> #3683

@KevDi

Description

@KevDi

Describe the bug
I have the strange behaviour that when i call Poco::format(std::string& result, const std::string& fmt, const std::vector<Any>& values) the function always receives an empty vector. This will then crash the Program because it tries to dereference an iterator to that vector.

To Reproduce
This is the Example which leads to the crash on my side:

#include <iostream>
#include <Poco/Any.h>
#include <vector>
#include <Poco/Format.h>


void dummy_func(const std::vector<Poco::Any>& para) {
  std::cout << para.size() << '\n';
}

int main()
{
  std::vector<Poco::Any> values;
  std::string dummy{ "3.3.2" };
  std::string result;
  std::string fmt{ "Dummy: %s" };
  values.emplace_back(dummy);
  dummy_func(values);
  Poco::format(result, fmt, values);
}

If i call a function which accepts a Reference to an std:vector<Poco::Any> the function receives the correct vector.
I'm not sure why it is not working in the Poco::format function.

Here you can see that the vector contains elements before calling Poco::format:

Image

and inside Poco::format:

Image2

Please add relevant environment information:

  • Windows 10
  • 1.12.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions