[mythtv-commits] Ticket #11690: Patch to handle out-of-memory conditions in mythsystemunix.cpp - fixes Coverity 1028695

MythTV noreply at mythtv.org
Mon Jul 15 22:07:24 UTC 2013


#11690: Patch to handle out-of-memory conditions in mythsystemunix.cpp - fixes
Coverity 1028695
-------------------------------------------------+-------------------------
 Reporter:  Gary Buhrmaster <gary.buhrmaster@…>  |           Type:  Patch -
   Status:  new                                  |  Bug Fix
Milestone:  unknown                              |       Priority:  minor
  Version:  Master Head                          |      Component:  MythTV
 Keywords:                                       |  - MythSystem
                                                 |       Severity:  medium
                                                 |  Ticket locked:  0
-------------------------------------------------+-------------------------
 Static analysis determined that a check for cmdargs being NULL at cleanup
 was out of place (because it was already used without such checks).
 Further examination of the code showed that the codes did not properly
 handle out-of-memory allocations in strdup and malloc.  While not likely,
 if they occured, a NULL pointer dereference could have occured in storing
 one of the command arg pointers, or the command could have been forked
 without the correct args.  This was a real potential bug.

 Fixes Coverity 1028695

 Note that this patch appears to be huge, and somewhat unusual.  This is an
 artifact of putting some of the code in a conditional (and the resulting
 indentation changes, and diff matching on random blank lines and braces).

 Note that this patch depends on the patch in ticket #11607 (since it
 indents that code).

 btw, the frees at clean up do not really need to be protected by checking
 for NULL since free does that internally, but since the existing code did
 that check, I followed the style, and made it consistent.

 If this patch is accepted (style wise), I will look to (speculatively)
 change the mythsystemwindows.cpp file (which also does not check strdup).

 github ref:
 https://github.com/garybuhrmaster/mythtv/commit/a70341e59962e43e85ef882c8b7d435b68500e0b
 github git-am ref:
 https://github.com/garybuhrmaster/mythtv/commit/a70341e59962e43e85ef882c8b7d435b68500e0b.patch

--
Ticket URL: <http://code.mythtv.org/trac/ticket/11690>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list