mirror of
https://github.com/status-im/QR-Code-generator.git
synced 2026-08-31 01:31:10 +00:00
Added integer overflow checks to toSvgString() in Java, C++, Rust code; added checks to toImage() in Java code.
This commit is contained in:
@@ -157,6 +157,9 @@ bool QrCode::getModule(int x, int y) const {
|
||||
std::string QrCode::toSvgString(int border) const {
|
||||
if (border < 0)
|
||||
throw "Border must be non-negative";
|
||||
if (border > INT_MAX / 2 || border * 2 > INT_MAX - size)
|
||||
throw "Border too large";
|
||||
|
||||
std::ostringstream sb;
|
||||
sb << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
sb << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
||||
|
||||
Reference in New Issue
Block a user