These files are currently implicitly included from other headers, but we
shouldn't rely on this and include them explicitly as we use std::map<>
and std::auto_ptr<> in this header.
No real changes.
It was only used as part of WXTEST_WITH_GZIP_CONDITION which was
necessary only to support running the tests on systems using zlib < 1.2
which is not a concern since many years any more, so simplify the code
by using the simple non-conditional CPPUNIT_TEST instead and drop the
helper macros which were required only for this.
This is useful when not using libFuzzer (e.g. because the compiler is
gcc or MSVC and not clang) as it allows to debug the problems found by
libFuzzer with the reproducers generated by it.
Including this header as the first wxWidgets header in a translation
unit resulted in compilation errors due to including the internal
wx/wxcrtbase.h header before including wx/defs.h, which must be included
before it (at least to define DLL import/export macros and sized char
types used in wx/wxcrtbase.h).
Fix this by simply including wx/defs.h from wx/buffer.h.
Check for the record size before subtracting it from the end position:
the former must be smaller than the latter for all valid ZIP files and
not performing this check could result in an integer overflow error from
the undefined behaviour sanitizer for bad input.
Credit to OSS-Fuzz: this solves its issue 3828.
Mention that this method is supposed to be used only as an optimization
and also mention that it hadn't been universally available until 3.1.1.
See https://github.com/wxWidgets/wxWidgets/pull/570
Zip filenames containing non ASCII characters will be marked with
bit 11 in the general purpose flags and will use UTF-8 encoding.
By only setting the flag when non ASCII characters are used the
created archives should be binary identical to previous versions.
The old behavior can be achieved by explicitly using wxConvLocal
with the constructor. This should also ensure that
existing code using a custom wxMBConv should work as before.
This shouldn't be needed any more, after the previous commit which
replaces the raw pointer to the focused child in wxTopLevelWindowMSW
with a safe weak reference.
If the window stored as m_winLastFocused in one TLW was reparented to
another one and then destroyed, this pointer to it wasn't updated and
became dangling.
Fix this by using a safe weak reference instead of raw pointer for
m_winLastFocused. This ensures that it can never be used when it becomes
invalid.
Closes#17980.
Skip memcpy() call if its source and destination would overlap: this is
not allowed and is correctly flagged as an error by address sanitizer
and is unnecessary anyhow as we're certainly not going to find the magic
value in fewer than 3 remaining bytes.
Credit to OSS-Fuzz: this solves its issue 3794.
Don't shift by m_SystemMadeBy value which can potentially be an
arbitrary (8 bit) integer and not necessarily one of the known (and
small) wxZIP_SYSTEM_XXX values, this results in undefined behaviour
whenever this value is greater than 32 or 64 (depending on int size) and
is flagged as such by clang undefined behaviour sanitizer.
To fix the problem, just use a more clear switch statement instead of
using a bit pattern for the lookup, this function is not nearly
performance-sensitive enough to worry about the overhead of the switch
here (assuming it's even slower, in the first place...) and the new
version is much more clear and maintainable.
Credit to OSS-Fuzz: this solves its issue 3792.
The new source file needs to be compiled with a recent clang using
libfuzzer using a command line similar to the following:
$ clang++ -g -fsanitize=address -fsanitize-coverage=trace-pc-guard tests/fuzz/readzip.cpp `wx-config --cxxflags --libs base` -lFuzzer
and then executed passing it the corpus directory as parameter:
$ ./a.out tests/fuzz/corpus/zip
This will be useful for finding more bugs like #17947 (and, indeed,
running it locally already found another assert failure, which will be
fixed soon).
Use "col" for the "wxColour" variable to avoid clash with "c" one used
for the corner index.
Also just construct the colour directly from the RGB values instead of
default-initializing it and then using Set(), which also allows to make
it "const".
The speed advantage from using them is very variable, rarely big and
sometimes even negative, while the space penalty is consistently huge,
so it doesn't seem like a good trade-off to enable them by default.
Provide native implementation of this function instead of using the ad hoc one
in common code, which didn't really work -- so remove it completely now.
Closes#17189.
Fix comparing items with checkboxes in wxTreeListCtrl and make it
simpler to correctly implement item comparison in other
wxDataViewCtrl-derived classes.
See https://github.com/wxWidgets/wxWidgets/pull/558
Don't even check for options such as --with-macosx-xxx or
--enable-universal_binaries when not targeting macOS, as they only make
sense for this platform.
Configure options such as --enable-universal_binary or
--with-macosx-version-min should be taken into account for any port
being built under macOS, not just wxOSX itself.
In particular, this ensures that PCH and dependencies tracking is
correctly disabled automatically when building universal wxGTK
libraries.
Closes#15454.
This allows to hide the long (and possibly not fitting on the screen)
call stack by default to avoid intimidating people not used to it and
provides a much more clear way to ignore the subsequent asserts, by
clicking a dedicated checkbox instead of having to choose the "Cancel"
button which didn't make much sense.
See #15430.
This makes more sense than the default default (sic) "Yes" button,
pressing which accidentally could kill the program if not running under
the debugger.
This should have been part of 55fd62c1e3
which only updated the default assert handler, but not the one used by
default in all GUI applications, for some reason, see there for more
explanations.
Do this now to ensure that after pressing "Yes" in the assert failure
dialog, the debugger opens at the assert location and not deep inside
wxWidgets code.
See #11184.
When extra style bits are set with the call to
wxPropertyGridManager::SetExtraStyle(), only those which are relevant
to wxPropertyGrid should be passed to the underlying property grid object.
Because it can happen that not all extra style bits of the underlying
wxPropertyGrid have been effectively changed by call to SetExtraStyle()
(e.g. wxPG_EX_NATIVE_DOUBLE_BUFFERING), we have to get the actual style
bits prior to storing them.
WM_CONTEXTMENU message is generated directly by the system when the user presses and releases the VK_APPS key so there is no need to do this by emulating right mouse button click.
Closes#17969.