[Libreoffice-commits] core.git: sax/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 15:39:30 UTC 2021


 sax/source/tools/converter.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit e2c9ac71cec0f205b1d4864538e8158c22558296
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 24 11:37:05 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 24 16:38:38 2021 +0100

    ofz#30767 Build-Failure
    
    afl++ build crashes for some obscure reason with attached bt. Tweaking
    the code like so gets it to squeak by and continue the build.
    
     clang-12: /usr/local/include/llvm/IR/Constants.h:661: llvm::StringRef llvm::ConstantDataSequential::getAsString() const: Assertion `isString() && "Not a string"' failed.
     Stack dump:
     0.     Program arguments: /usr/local/bin/clang-12 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name converter.cxx -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -fdata-sections -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D DISABLE_DYNLOADING -D LINUX -D NDEBUG -D OSL_DEBUG_LEVEL=0 -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SAX_DLLIMPLEMENTATION -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -D __AFL_HAVE_MANUAL_CONTROL=1 -D __AFL_COMPILER=1 -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -D "__AFL_FUZZ_INIT()=int __afl_sharedmem_fuzzing = 1;extern unsign
 ed int *__afl_fuzz_len;extern unsigned char *__afl_fuzz_ptr;unsigned char __afl_fuzz_alt[1048576];unsigned char *__afl_fuzz_alt_ptr = __afl_fuzz_alt;" -D "__AFL_COVERAGE()=int __afl_selective_coverage = 1;extern \"C\" void __afl_coverage_discard();extern \"C\" void __afl_coverage_skip();extern \"C\" void __afl_coverage_on();extern \"C\" void __afl_coverage_off();" -D "__AFL_COVERAGE_START_OFF()=int __afl_selective_coverage_start_off = 1;" -D __AFL_COVERAGE_ON()=__afl_coverage_on() -D __AFL_COVERAGE_OFF()=__afl_coverage_off() -D __AFL_COVERAGE_DISCARD()=__afl_coverage_discard() -D __AFL_COVERAGE_SKIP()=__afl_coverage_skip() -D "__AFL_FUZZ_TESTCASE_BUF=(__afl_fuzz_ptr ? __afl_fuzz_ptr : __afl_fuzz_alt_ptr)" -D "__AFL_FUZZ_TESTCASE_LEN=(__afl_fuzz_ptr ? *__afl_fuzz_len : (*__afl_fuzz_len = read(0, __afl_fuzz_alt_ptr, 1048576)) == 0xffffffff ? 0 : *__afl_fuzz_len)" -D "__AFL_LOOP(_A)=({ static volatile char *_B __attribute__((used));  _B = (char*)\"##SIG_AFL_PERSISTENT##\"; __attribute_
 _((visibility(\"default\"))) int _L(unsigned int) __asm__(\"__afl_persistent_loop\"); _L(_A); })" -D "__AFL_INIT()=do { static volatile char *_A __attribute__((used));  _A = (char*)\"##SIG_AFL_DEFER_FORKSRV##\"; __attribute__((visibility(\"default\"))) void _I(void) __asm__(\"__afl_manual_init\"); _I(); } while (0)" -O1 -Wno-unused-command-line-argument -Wall -Wno-missing-braces -Wnon-virtual-dtor -Wendif-labels -Wextra -Wundef -Wunreachable-code -Wunused-macros -Wembedded-directive -Wdeprecated-copy-dtor -Wimplicit-fallthrough -Wunused-exception-parameter -Wrange-loop-analysis -Wshadow -Woverloaded-virtual -Wno-unused-command-line-argument -std=c++17 -fdeprecated-macro -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -fsanitize=address -fsanitize-blacklist=/src/libreoffice/bin/sanitize-excludelist.txt -fsanitize-system-blacklist=/usr/local/lib/clang/12.0.0/share/asan_blacklist.txt -fsanitize-address-use-after-scope -fno-assume-sane-operator-new -funroll-loops -pthre
 ad -stack-protector 2 -fgnuc-version=4.2.1 -fno-inline -fcxx-exceptions -fexceptions -fcolor-diagnostics -load /src/aflplusplus/afl-llvm-dict2file.so -load /src/aflplusplus/cmplog-routines-pass.so -load /src/aflplusplus/cmplog-instructions-pass.so -load /src/aflplusplus/split-switches-pass.so -load /src/aflplusplus/SanitizerCoveragePCGUARD.so -faddrsig -x c++ converter-773998.cpp
     1.     <eof> parser at end of file
     2.     Per-module optimization passes
     3.     Running pass 'afl++ dict2file instrumentation pass' on module 'converter-773998.cpp'.
      #0 0x0000000001719ae3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/clang-12+0x1719ae3)
      #1 0x0000000001717a4e llvm::sys::RunSignalHandlers() (/usr/local/bin/clang-12+0x1717a4e)
      #2 0x0000000001719f8f SignalHandler(int) (/usr/local/bin/clang-12+0x1719f8f)
      #3 0x00007f3e317b2980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
      #4 0x00007f3e306abfb7 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3efb7)
      #5 0x00007f3e306ad921 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40921)
      #6 0x00007f3e3069d48a (/lib/x86_64-linux-gnu/libc.so.6+0x3048a)
      #7 0x00007f3e3069d502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
      #8 0x00007f3e30464810 (anonymous namespace)::AFLdict2filePass::runOnModule(llvm::Module&) /src/aflplusplus/instrumentation/afl-llvm-dict2file.so.cc:150:5
      #9 0x00000000011d139f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/bin/clang-12+0x11d139f)
     #10 0x00000000018ef775 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/usr/local/bin/clang-12+0x18ef775)
     #11 0x00000000023c074f clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/bin/clang-12+0x23c074f)
     #12 0x0000000002cbe554 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang-12+0x2cbe554)
     #13 0x0000000001e3ccc7 clang::FrontendAction::Execute() (/usr/local/bin/clang-12+0x1e3ccc7)
     #14 0x0000000001dc7311 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang-12+0x1dc7311)
     #15 0x0000000001ed2dfc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/bin/clang-12+0x1ed2dfc)
     #16 0x000000000092166e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/bin/clang-12+0x92166e)
     #17 0x000000000091ff77 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/usr/local/bin/clang-12+0x91ff77)
     #18 0x000000000091fdbb main (/usr/local/bin/clang-12+0x91fdbb)
     #19 0x00007f3e3068ebf7 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf7)
     #20 0x000000000091cd49 _start (/usr/local/bin/clang-12+0x91cd49)
    
    Change-Id: I4eab488ff09f9213489212e56ed636596be6ae89
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111477
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index f4f6dccb8ddc..4b476be934ee 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -728,6 +728,10 @@ void Converter::convertAngle(OUStringBuffer& rBuffer, sal_Int16 const nAngle,
 bool Converter::convertAngle(sal_Int16& rAngle, std::u16string_view rString,
         bool const isWrongOOo10thDegAngle)
 {
+    const std::u16string_view deg = u"deg";
+    const std::u16string_view grad = u"grad";
+    const std::u16string_view rad = u"rad";
+
     // ODF 1.1 leaves it undefined what the number means, but ODF 1.2 says it's
     // degrees, while OOo has historically used 10th of degrees :(
     // So import degrees when we see the "deg" suffix but continue with 10th of
@@ -737,15 +741,15 @@ bool Converter::convertAngle(sal_Int16& rAngle, std::u16string_view rString,
     sal_Int32 nValue(0);
     double fValue(0.0);
     bool bRet = ::sax::Converter::convertDouble(fValue, rString);
-    if (std::u16string_view::npos != rString.find(u"deg"))
+    if (std::u16string_view::npos != rString.find(deg))
     {
         nValue = fValue * 10.0;
     }
-    else if (std::u16string_view::npos != rString.find(u"grad"))
+    else if (std::u16string_view::npos != rString.find(grad))
     {
         nValue = (fValue * 9.0 / 10.0) * 10.0;
     }
-    else if (std::u16string_view::npos != rString.find(u"rad"))
+    else if (std::u16string_view::npos != rString.find(rad))
     {
         nValue = basegfx::rad2deg(fValue) * 10.0;
     }


More information about the Libreoffice-commits mailing list