inline function short_time returns an unintialised string when fed a negative number #1518

Open
opened 2026-04-05 18:11:10 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @SittingDuc on 11/25/2025

855870e256/src/libslic3r/Utils.hpp (L488)

declares a fixed size buffer

855870e256/src/libslic3r/Utils.hpp (L517)

And then populates it with sprintf() calls. But it has no trailing else, such that if the input string is interpreted as a negative number (for example, -2^31 seconds of estimated print time), the buffer is returned uninitialised.

Which I am seeing as random characters in the filename when using the {print_time} macro.

And how am I getting -2 billion seconds of estimated time? Aah, that is a question for another issue .. https://github.com/OrcaSlicer/OrcaSlicer/issues/11464

*Originally created by @SittingDuc on 11/25/2025* https://github.com/OrcaSlicer/OrcaSlicer/blob/855870e2562f687e086d7bfa0fdc7f80a5241800/src/libslic3r/Utils.hpp#L488 declares a fixed size buffer https://github.com/OrcaSlicer/OrcaSlicer/blob/855870e2562f687e086d7bfa0fdc7f80a5241800/src/libslic3r/Utils.hpp#L517 And then populates it with sprintf() calls. But it has no trailing `else`, such that if the input string is interpreted as a negative number (for example, -2^31 seconds of estimated print time), the buffer is returned uninitialised. Which I am seeing as random characters in the filename when using the `{print_time}` macro. And how am I getting -2 billion seconds of estimated time? Aah, that is a question for another issue .. https://github.com/OrcaSlicer/OrcaSlicer/issues/11464
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#1518