Skip to content

Fix UBSan errors

This MR fixes the following errors reported by UBSan:

app-manager.c:177:25: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/stdlib.h:962:6: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior app-manager.c:177:25 in 

task-manager-linux.c:156:6: runtime error: index -1 out of bounds for type 'gchar[1024]' (aka 'char[1024]')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior task-manager-linux.c:156:6 in 

task-manager.c:338:28: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/stdlib.h:962:6: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior task-manager.c:338:28 in 

Steps to reproduce

  • Compile with UBSan enabled
    • CC=clang CFLAGS="-ggdb3 -O1 -fsanitize=undefined -fsanitize=unsigned-integer-overflow -fsanitize=implicit-conversion -fsanitize=local-bounds -fsanitize=nullability -fno-omit-frame-pointer" ./autogen.sh --prefix=/usr/local
    • make clean && make -j3 && sudo make install
  • Run /usr/local/bin/xfce4-taskmanager

Testing

  • I verified that UBSan no longer reports errors when running the task manager
  • I verified that task-manager data looks similar before and after the patches

Merge request reports

Loading