Неинициализированное значение было создано выделением кучи в RE2 :: PartialMatch

Код в парсере (const char * body, bool * parseFailure, bool * malformed):

303     string action;
312
313     re2::StringPiece end;
314     bool match = RE2::PartialMatch(body,*m_alertRegex,
315                             &action,
326                             &end);

Вывод valgrind:

>     ==3826== 919 errors in context 11 of 11:
>     ==3826== Conditional jump or move depends on uninitialised value(s)
>     ==3826==    at 0x4E5826E: ??? (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E59466: ??? (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E5AF43: ??? (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E77976: re2::RE2::Match(re2::StringPiece const&, int, int, re2::RE2::Anchor, re2::StringPiece*, int) const (in
> /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E7A33E: re2::RE2::DoMatch(re2::StringPiece const&, re2::RE2::Anchor, int*, re2::RE2::Arg const* const*, int)
> const (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x436AB9: re2::VariadicFunction2<bool, re2::StringPiece const&, re2::RE2 const&, re2::RE2::Arg,
> &re2::RE2::PartialMatchN>::operator()(re2::StringPiece const&,
> re2::RE2 const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&) const (variadic_function.h:96)
>     ==3826==    by 0x4352AE: parser(char const*, bool*, bool*) (xxx.cpp:326)
>     ==3826==    by 0x4172FC: newThread(void*) (xxx.cpp:54)
>     ==3826==    by 0x5B4C181: start_thread (pthread_create.c:312)
>     ==3826==    by 0x637647C: clone (clone.S:111)
>     ==3826==  Uninitialised value was created by a heap allocation
>     ==3826==    at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==3826==    by 0x4E5B67F: ??? (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E5ADCF: ??? (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E5AEFF: ??? (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E77976: re2::RE2::Match(re2::StringPiece const&, int, int, re2::RE2::Anchor, re2::StringPiece*, int) const (in
> /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x4E7A33E: re2::RE2::DoMatch(re2::StringPiece const&, re2::RE2::Anchor, int*, re2::RE2::Arg const* const*, int)
> const (in /opt/pkgs/libre2-e/lib/libre2.so.1.0.0)
>     ==3826==    by 0x436AB9: re2::VariadicFunction2<bool, re2::StringPiece const&, re2::RE2 const&, re2::RE2::Arg,
> &re2::RE2::PartialMatchN>::operator()(re2::StringPiece const&,
> re2::RE2 const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&, re2::RE2::Arg const&, re2::RE2::Arg const&,
> re2::RE2::Arg const&) const (variadic_function.h:96)
>     ==3826==    by 0x4352AE: parser(char const*, bool*, bool*) (xxx.cpp:326)
>     ==3826==    by 0x4172FC: newThread(void*) (xxx.cpp:54)
>     ==3826==    by 0x5B4C181: start_thread (pthread_create.c:312)
>     ==3826==    by 0x637647C: clone (clone.S:111)

Уже дважды проверил пример здесь (https://gist.github.com/chezou/1395527) и исходный код StringPiece здесь https://github.com/google/re2/blob/master/re2/stringpiece.h. Но до сих пор не знаю, что неинициализировано. Есть идеи? Спасибо

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]