Skip to content

Return values from external library calls are not always checked. #4553

@tarek-y-ismail

Description

@tarek-y-ismail

In our codebase, return values from external libraries are not always checked. For return codes, this can manifest as issues later during execution that require careful debugging to track down the cause of. For return values as pointers, this can manifest itself as segfaults.

The following calls have been identified, though this isn't an exhaustive list:

  • xkb_state_key_get_utf8
  • xkb_compose_table_new_from_locale
  • eglBindAPI, eglDestroyImageKHR, eglDebugMessageControlKHR, eglDestroyContext, eglDestroySurface and friends
  • pixman_image_create_bits, pixman_transform_scale, pixman_image_set_transform, pixman_image_set_filter
  • udev_enumerate_scan_devices, udev_monitor_enable_receiving, udev_monitor_filter_add_match_subsystem_devtype, udev_device_get_action
  • drmGetCap

For most of these, printing something should be enough. Though for others more work may be needed.

In addition to plugging the holes we currently have, it would be nice to have some code analysis tool (TICS?) to give us a list of all calls where we don't use/check the return value.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions