diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-08-29 14:33:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-08-29 14:33:05 +0200 |
commit | 66e3194e6a5cca0400fa9628446246b2668ef2b5 (patch) | |
tree | 4814aceffd88c4a466e9cc09af6bdb7d4a1a4824 /external/libodfgen | |
parent | Updated core (diff) | |
download | core-66e3194e6a5cca0400fa9628446246b2668ef2b5.tar.gz core-66e3194e6a5cca0400fa9628446246b2668ef2b5.zip |
external/libodfgen: Avoid undefined-behavior casts...
...from (potentially negative) double to unsigned
Change-Id: I2f922beec7201a8d769133e879208d2e951e6429
Diffstat (limited to 'external/libodfgen')
-rw-r--r-- | external/libodfgen/UnpackedTarball_libodfgen.mk | 6 | ||||
-rw-r--r-- | external/libodfgen/ubsan.patch | 60 |
2 files changed, 65 insertions, 1 deletions
diff --git a/external/libodfgen/UnpackedTarball_libodfgen.mk b/external/libodfgen/UnpackedTarball_libodfgen.mk index 60258a3a2e3f..66707ddc4c92 100644 --- a/external/libodfgen/UnpackedTarball_libodfgen.mk +++ b/external/libodfgen/UnpackedTarball_libodfgen.mk @@ -11,6 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libodfgen)) $(eval $(call gb_UnpackedTarball_set_tarball,libodfgen,$(ODFGEN_TARBALL))) -$(eval $(call gb_UnpackedTarball_set_patchlevel,libodfgen,1)) +$(eval $(call gb_UnpackedTarball_set_patchlevel,libodfgen,0)) + +$(eval $(call gb_UnpackedTarball_add_patches,libodfgen, \ + external/libodfgen/ubsan.patch \ +)) # vim: set noet sw=4 ts=4: diff --git a/external/libodfgen/ubsan.patch b/external/libodfgen/ubsan.patch new file mode 100644 index 000000000000..0b807dded872 --- /dev/null +++ b/external/libodfgen/ubsan.patch @@ -0,0 +1,60 @@ +See <https://sourceforge.net/p/libwpd/tickets/2/attachment/0001-Avoid-undefined-behavior-casts-from-potentially-nega.patch>: +--- src/GraphicFunctions.cxx ++++ src/GraphicFunctions.cxx +@@ -448,42 +448,42 @@ + // 2540 is 2.54*1000, 2.54 in = 1 inch + if (path[i]["svg:x"] && action[0] == 'H') + { +- sElement.sprintf("H%i", (unsigned)((getInchValue(path[i]["svg:x"])-px)*2540)); ++ sElement.sprintf("H%i", (int)((getInchValue(path[i]["svg:x"])-px)*2540)); + sValue.append(sElement); + } + else if (path[i]["svg:y"] && action[0] == 'V') + { +- sElement.sprintf("V%i", (unsigned)((getInchValue(path[i]["svg:y"])-py)*2540)); ++ sElement.sprintf("V%i", (int)((getInchValue(path[i]["svg:y"])-py)*2540)); + sValue.append(sElement); + } + else if (coordOk && (action[0] == 'M' || action[0] == 'L' || action[0] == 'T')) + { +- sElement.sprintf("%c%i %i", action[0], (unsigned)((getInchValue(path[i]["svg:x"])-px)*2540), +- (unsigned)((getInchValue(path[i]["svg:y"])-py)*2540)); ++ sElement.sprintf("%c%i %i", action[0], (int)((getInchValue(path[i]["svg:x"])-px)*2540), ++ (int)((getInchValue(path[i]["svg:y"])-py)*2540)); + sValue.append(sElement); + } + else if (coord1Ok && (action[0] == 'Q' || action[0] == 'S')) + { +- sElement.sprintf("%c%i %i %i %i", action[0], (unsigned)((getInchValue(path[i]["svg:x1"])-px)*2540), +- (unsigned)((getInchValue(path[i]["svg:y1"])-py)*2540), (unsigned)((getInchValue(path[i]["svg:x"])-px)*2540), +- (unsigned)((getInchValue(path[i]["svg:y"])-py)*2540)); ++ sElement.sprintf("%c%i %i %i %i", action[0], (int)((getInchValue(path[i]["svg:x1"])-px)*2540), ++ (int)((getInchValue(path[i]["svg:y1"])-py)*2540), (int)((getInchValue(path[i]["svg:x"])-px)*2540), ++ (int)((getInchValue(path[i]["svg:y"])-py)*2540)); + sValue.append(sElement); + } + else if (coord2Ok && action[0] == 'C') + { +- sElement.sprintf("C%i %i %i %i %i %i", (unsigned)((getInchValue(path[i]["svg:x1"])-px)*2540), +- (unsigned)((getInchValue(path[i]["svg:y1"])-py)*2540), (unsigned)((getInchValue(path[i]["svg:x2"])-px)*2540), +- (unsigned)((getInchValue(path[i]["svg:y2"])-py)*2540), (unsigned)((getInchValue(path[i]["svg:x"])-px)*2540), +- (unsigned)((getInchValue(path[i]["svg:y"])-py)*2540)); ++ sElement.sprintf("C%i %i %i %i %i %i", (int)((getInchValue(path[i]["svg:x1"])-px)*2540), ++ (int)((getInchValue(path[i]["svg:y1"])-py)*2540), (int)((getInchValue(path[i]["svg:x2"])-px)*2540), ++ (int)((getInchValue(path[i]["svg:y2"])-py)*2540), (int)((getInchValue(path[i]["svg:x"])-px)*2540), ++ (int)((getInchValue(path[i]["svg:y"])-py)*2540)); + sValue.append(sElement); + } + else if (coordOk && path[i]["svg:rx"] && path[i]["svg:ry"] && action[0] == 'A') + { +- sElement.sprintf("A%i %i %i %i %i %i %i", (unsigned)((getInchValue(path[i]["svg:rx"]))*2540), +- (unsigned)((getInchValue(path[i]["svg:ry"]))*2540), (path[i]["librevenge:rotate"] ? path[i]["librevenge:rotate"]->getInt() : 0), ++ sElement.sprintf("A%i %i %i %i %i %i %i", (int)((getInchValue(path[i]["svg:rx"]))*2540), ++ (int)((getInchValue(path[i]["svg:ry"]))*2540), (path[i]["librevenge:rotate"] ? path[i]["librevenge:rotate"]->getInt() : 0), + (path[i]["librevenge:large-arc"] ? path[i]["librevenge:large-arc"]->getInt() : 1), + (path[i]["librevenge:sweep"] ? path[i]["librevenge:sweep"]->getInt() : 1), +- (unsigned)((getInchValue(path[i]["svg:x"])-px)*2540), (unsigned)((getInchValue(path[i]["svg:y"])-py)*2540)); ++ (int)((getInchValue(path[i]["svg:x"])-px)*2540), (int)((getInchValue(path[i]["svg:y"])-py)*2540)); + sValue.append(sElement); + } + else if (action[0] == 'Z') |