* Fix detection of some non-UTF-8 files with a encoding stanza in them (e.g. `coding: iso-8859-2`) * Fix out-of-bounds reads loading an empty UTF-16 buffer with BOM (yeah, really) * Fix **silently** truncating at the first NUL in some case (part of #3700) * Fix handling of non-UTF-8 data that start with a UTF-8 BOM
Note: this still doesn't load data after the first NUL byte, but at least now it will always properly warn as we supposedly were already doing. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3716
-- Commit Summary --
* Add some basic tests for encoding detection and conversion * encodings: Fix detection of non-UTF-8 inline encodings * Remove unused code * Add basic tests for UTF-16* and UTF-32* * Add some basic UTF-7 tests * Add some tests for empty data with BOM * Fix silently truncating files with NULs * Refactor to remove duplication, lower assumptions and improve safety
-- File Changes --
M src/encodings.c (151) M src/encodingsprivate.h (3) M src/libmain.c (2) M tests/Makefile.am (3) A tests/test_encodings.c (283)
-- Patch Links --
https://github.com/geany/geany/pull/3716.patch https://github.com/geany/geany/pull/3716.diff