Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62245

Linux: ioctl VIDIOC_S_INPUT used wrongly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.3
    • 5.9.1
    • Multimedia
    • None

    Description

      qgstutils.cpp:645 uses Linux ioctl VIDIOC_S_INPUT wrongly: instead of passing a pointer to the integer, it passes the integer itself. This will likely lead to a segfault, once that input number is interpreted as a pointer and dereferenced.

      The ioctl description clearly says "To select a video input applications store the number of the desired input in an integer and call the VIDIOC_S_INPUT ioctl with a pointer to this integer.", and that's also how everyone else seems to use it.

      The ioctl use is also wrong for a different reason: If the call fails, the input is considered a usable camera. Now, the question is, why did this never cause problems? Presumably, because this ioctl isn't implemented in many drivers, so the return value is then the non-zero return value for not implemented ioctls.

      The (guaranteed untested) patch might fix both problems: A camera is valid if the ioctl/VIDIOC_S_INPUT call either succeeded (i.e. returned zero) or indicated, that the function isn't implemented (ENOTTY, for historic reasons I've been told).

      Attachments

        For Gerrit Dashboard: QTBUG-62245
        # Subject Branch Project Status CR V

        Activity

          People

            valentyn.doroshchuk Valentyn Doroshchuk
            mfranz Melchior FRANZ
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes