Bug 1161039

Summary: Unchecked return value of libvirt_uintUnwrap in libvirt_virDomainSendKey
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Denemark <jdenemar>
Component: libvirt-pythonAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: dyuan, honzhang, jmiao, lhuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-python-1.2.8-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:57:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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