Closed Bug 1530493 Opened 5 years ago Closed 5 years ago

mingw builds missing templated C++ overloads for secure string functions

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: bugzilla, Unassigned)

Details

Attachments

(1 file)

The Microsoft CRT provides template magic for its secure string functions (the ones named with the "_s" suffix) that allow the compiler to infer the size of the output buffer.

MinGW also provides these, but only when the _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES is defined. But that appears to be gated on MINGW_HAS_SECURE_API == 1, which appears to be dependent on mingw's configure settings?

I'm not 100% sure, but I'm leaning toward this being a configure issue on our build machines as opposed to something that we can fix in the build system.

ni? Jacek for information. I'll move components if we can't do anything about this in our build system.

Flags: needinfo?(jacek)

Those overloaded functions should be enabled in our builds:
https://hg.mozilla.org/mozilla-central/file/tip/taskcluster/scripts/misc/build-clang-trunk-mingw.sh#l114

It's possible that something is missing or they are not used for some functions that should use them. What's the exact problem that you noticed?

Flags: needinfo?(jacek)

(In reply to Jacek Caban from comment #1)

It's possible that something is missing or they are not used for some functions that should use them. What's the exact problem that you noticed?

https://bugzilla.mozilla.org/show_bug.cgi?id=1460433#c33

Flags: needinfo?(jacek)

It's missing for _wcslwr_s, I sent a patch upstream.

Flags: needinfo?(jacek)

I just pushed it to upstream repo. We just need to update used mingw-w64 now.

Aaron's push also used _wmakepath_s, does that need an update too?

_wmakepath_s has overloads defined in wchar.h, but it's not duplicated in stdlib.h (and it probably should), so results may vary depending how it's used. We should probably get rid of this duplication like it's done in UCRT.

I pushed a patch to ensure that overloads are always defined. I also removed --enable-secure-api configure option and use of MINGW_HAS_SECURE_API macro to avoid future confusion. It's always enabled in mingw-w64 and we can remove it from our build script now.

This is needed to bring dispatherqueue.h in, which is needed for
an ANGLE upgrade.

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: