Bug 1161039 - Unchecked return value of libvirt_uintUnwrap in libvirt_virDomainSendKey
Summary: Unchecked return value of libvirt_uintUnwrap in libvirt_virDomainSendKey
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-python
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-06 08:58 UTC by Jiri Denemark
Modified: 2015-03-05 07:57 UTC (History)
4 users (show)

Fixed In Version: libvirt-python-1.2.8-5.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:57:26 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0334 normal SHIPPED_LIVE new packages: libvirt-python 2015-03-05 12:23:16 UTC

Description Jiri Denemark 2014-11-06 08:58:54 UTC
Description of problem:

Coverity correctly complains that the return value of libvirt_uintUnwrap() called from libvirt_virDomainSendKey is not checked:

http://cov01.lab.eng.brq.redhat.com/covscanhub/waiving/7015/21728/#defects

Version-Release number of selected component (if applicable):

libvirt-python-1.2.8-4.el7

How reproducible:

100%

Steps to Reproduce:
1. look at the code or coverity output

Actual results:

Return value is not checked.

Expected results:

All return values of libvirt_uintUnwrap() are checked.

Additional info:

Comment 1 Jiri Denemark 2014-11-06 11:13:58 UTC
Pushed upstream as v1.2.10-2-g8dcdc7f:

commit 8dcdc7f2b4d8ebe7c892a2f92c23f77c59106189
Author: Jiri Denemark <jdenemar@redhat.com>
Date:   Thu Nov 6 10:20:40 2014 +0100

    Check return value of libvirt_uintUnwrap
    
    libvirt_virDomainSendKey didn't check whether libvirt_uintUnwrap
    succeeded or not.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1161039
    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

Comment 4 Luyao Huang 2014-11-12 02:33:59 UTC
I can reproduce this bug with libvrt-python-1.2.8-4.el7 :

# cat sendkey.py

import libvirt

conn = libvirt.open()
domain = conn.lookupByName('test3')
print domain.sendKey(0, 0, [12], 1)
print domain.sendKey(0, 0, ['12'], 1)


# python sendkey.py 
0
0

And verify this bug with libvirt-python-1.2.8-5.el7:

# python sendkey.py 
0
Traceback (most recent call last):
  File "sendkey.py", line 8, in <module>
    print domain.sendKey(0, 0, ['12'], 1)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2048, in sendKey
    ret = libvirtmod.virDomainSendKey(self._o, codeset, holdtime, keycodes, nkeycodes, flags)
TypeError: an integer is required


Output TypeError so verify this bug.

Comment 6 errata-xmlrpc 2015-03-05 07:57:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0334.html


Note You need to log in before you can comment on or make changes to this bug.