office-gobmx/external/expat/ubsan.patch.0
Stephan Bergmann ad53c152cc external/expat: Avoid -fsanitizenullptr-with-offset
...(new with Clang 10 trunk), where adding even an offset of 0 to a null pointer
is UB in C.  Seen when building CustomTarget_writerfilter/source:

> [PY ] CustomTarget/writerfilter/source/ooxml/resourceids.hxx
> workdir/UnpackedTarball/expat/lib/xmlparse.c:6488:23: runtime error: applying zero offset to null pointer
>  #0 in hashTableIterInit at workdir/UnpackedTarball/expat/lib/xmlparse.c:6488:23
>  #1 in dtdDestroy at workdir/UnpackedTarball/expat/lib/xmlparse.c:6130:3
>  #2 in XML_ParserFree at workdir/UnpackedTarball/expat/lib/xmlparse.c:1368:5
>  #3 in xmlparse_dealloc at workdir/UnpackedTarball/python3/Modules/pyexpat.c:1222:9
>  #4 in insertdict at workdir/UnpackedTarball/python3/Objects/dictobject.c:807:9
>  #5 in _PyObjectDict_SetItem at workdir/UnpackedTarball/python3/Objects/dictobject.c:3927:19
>  #6 in _PyObject_GenericSetAttrWithDict at workdir/UnpackedTarball/python3/Objects/object.c:1159:19
>  #7 in PyObject_SetAttr at workdir/UnpackedTarball/python3/Objects/object.c:930:15
>  #8 in PyEval_EvalFrameEx at workdir/UnpackedTarball/python3/Python/ceval.c:2310:19
[...]

Change-Id: I152ddb20c726dbeb638c5fab4403423f5c6da7b5
Reviewed-on: https://gerrit.libreoffice.org/81284
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-22 07:19:30 +02:00

11 lines
308 B
Text

--- lib/xmlparse.c
+++ lib/xmlparse.c
@@ -6485,7 +6485,7 @@
static void FASTCALL
hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) {
iter->p = table->v;
- iter->end = iter->p + table->size;
+ iter->end = table->size == 0 ? iter->p : iter->p + table->size;
}
static NAMED *FASTCALL