[PATCH 01/32] WUtil: changed order for null pointer check in array functions (Coverity #72806, #72807, #72819)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, there were some null pointer checks that had been misplaced, due to a pointer dereference present in a preceding check. This had been fixed by adding another null check in the check, making a duplicate check. This patch moves the null pointer check

[PATCH 00/32] A few bug fixes pointed by Coverity

2014-11-15 Thread Christophe
From: Christophe CURIS Hello, This series of patch is mostly just bug fixes reported by Coverity, a few of them being side effects from looking at the code while analysing the issues reported. Regards, Christophe. WINGs/array.c | 12 +-- WINGs/findfile.c | 128

[PATCH 02/32] WUtil: rewrote wcopy_file for better error handling and to fix Coverity #50234

2014-11-15 Thread Christophe
From: Christophe CURIS The original code used the libc "fopen" kind of operation, which are handy when manipulating text files, but: - bring an overhead for binary files that we don't need here; - does not provide the mechanisms for safe error handling and special cases As Coverity reported a

[PATCH 07/32] wmaker: replaced dangerous function type conversion by argument conversion

2014-11-15 Thread Christophe
From: Christophe CURIS A type conversion applied to a function when used as a pointer is dangerous because the compiler may not be able to make sure arguments will be compatible across architectures, so it can crash the application. This is replaced by a function prototype matching exactly what

[PATCH 09/32] WMaker: Fixed crash if the RContext creation fail on a Screen (Coverity #50066)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, it is possible that RCreateContext fails for more reasons that were handled by wScreenInit, so we provide an error message for the other cases along with cleaner return from function. Signed-off-by: Christophe CURIS --- src/screen.c | 6 ++ 1

[PATCH 06/32] WINGs: fix possible null pointer dereference in W_RealizeView (Coverity #50060)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the function makes use of a pointer which may be null, so we have to properly check that to ensure application will not crash. Signed-off-by: Christophe CURIS --- WINGs/wview.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/WINGs/wview.

[PATCH 08/32] wmaker: avoid allocating temporary memory in GetShortcutKey (Coverity #50115)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the function GetShortcutKey was allocating memory for temporary operation, and did not free it in the end. Because it participates in memory fragmentation and it is not really efficient, this patch removes the allocation and uses a local storage on

[PATCH 05/32] WINGs: removed unnecessary size checks in WMGetBrowserPaths

2014-11-15 Thread Christophe
From: Christophe CURIS The function is building strings from the directory names into an allocated buffer, but the function took time first to calculate the exact size needed for the resulting string, so the check on wstrlcat's result will never fail. As we still use wstrlcat it is not possible

[PATCH 03/32] WUtil: fix default rights for file created when saving PropList

2014-11-15 Thread Christophe
From: Christophe CURIS When creating the temporary file that will become the final file if no problem occurs, there is a chmod done which does not give write access to the group and to the others, but this is the task of the user-set umask. This patch makes the rights to everything (except execu

[PATCH 10/32] wmaker: removed unnecessary check when painting application icon (Coverity #50052)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, there was a check for null pointer on scr->dock_dots, but this check was not made in the 2nd use of it, done if the HIDDENDOT feature was enabled. Investigation show that it is not possible that this pointer could be created NULL, so let's remove th

[PATCH 04/32] WINGs: inverted the direction for mouse wheel on WMSliders

2014-11-15 Thread Christophe
From: Christophe CURIS The original choice may have looked mathematically correct, but it was actually counter-intuitive and opposite to what every other application do with sliders. Signed-off-by: Christophe CURIS --- WINGs/wslider.c | 8 1 file changed, 4 insertions(+), 4 deletions(

[PATCH 12/32] wmaker: minor fixes for the size of an aperçu

2014-11-15 Thread Christophe
From: Christophe CURIS There was a probable bug when reading settings, because the function used was 'getInt' which would try to store the result in a 'char'. As it would be probably easier for user to have the value directly in pixels, the storage is now done in an int so there won't be problem

[PATCH 11/32] wmaker: removed unnecessary assignation (Coverity #50257)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the return value is saved into a variable, but this value is never used. As the variable is re-used afterwards, this assignation could mislead on what is done, so for code maintainability the value is just ignored. Signed-off-by: Christophe CURIS -

[PATCH 15/32] wmaker: improve error messages when trying to start the helper

2014-11-15 Thread Christophe
From: Christophe CURIS Try to provide better messages to understand what went wrong, including more information, and made them translatable; Changed the call to 'dup' into 'dup2' which has a safer behaviour because we can specify the target descriptor we want; Removed a few check for the 'close

[PATCH 17/32] wmaker: removed unnecessary variable 'done' in panelBtnCallback

2014-11-15 Thread Christophe
From: Christophe CURIS The variable is assigned a value that never change, so it adds extra complexity which is not good for code maintainability. It is probable that this was meant for cases that are handled in current code with early function return, which are better for code readability. Sign

[PATCH 14/32] wmaker: close unneeded file handles when running the bg helper (Coverity #50137)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the file descriptor used in 'dup' to become the child process's STDIN is leaked, because it will not be used anymore, so we close it after the dup. Similarly, the file descriptors that represent the other ends of the pipe for each process are useles

[PATCH 20/32] wmaker: make parsing on display name less prone to crash in SetupEnvironment (Coverity #50096)

2014-11-15 Thread Christophe
From: Christophe CURIS When creating the environment variable for the sub-process that wmaker can create, Coverity pointed that if was possible to crash if the name of the display did not contain the ':', which is probably ok in most case, but we can't be sure about what it could contain in speci

[PATCH 19/32] wmaker: fix incomplete null pointer check in wFrameWindowChangeTitle (Coverity #50058)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, despite the numerous null pointer checks there is still a case where one can pass trough and make wmaker crash. This patch simplifies it all but making only one check at the beginning so the code is safe and the remaining is simpler. Signed-off-by:

[PATCH 18/32] wmaker: remove unnecessary null check (Coverity #50196)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, text cannot be null in this part of code. The analysis shows that if it were, the function wIconChangeImageFile would have directed execution to the 'else' branch. (and if it hadn't, the code would have crashed beforehand because 'strlen' does not li

[PATCH 13/32] wmaker: moved the code for the bg helper to a dedicated function

2014-11-15 Thread Christophe
From: Christophe CURIS In order to make code easier to maintain, the code related to creating the Helper process (which helps by setting the background of the workspace) is moved to a dedicated function, which have been moved to the same location as the function for communicating with the helper.

[PATCH 16/32] wmaker: removed unnecessary null pointer check (Coverity #50041)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the 'cmd' is checked for null at the beginning of the function, so the second case to handle the null pointer is not needed. This also means that 'command' cannot be null (wstrdup never returns null) so the code can also be simplified. Signed-off-by

[PATCH 22/32] wmaker: fix memory leak in get_icon_filename (Coverity #50132)

2014-11-15 Thread Christophe
From: Christophe CURIS Coverity pointed that in the typical code path the function FindImage would be called twice, leading in leakage of the allocated result from the first call. This patch updates the condition so that the case won't arise. Signed-off-by: Christophe CURIS --- src/wdefaults.

[PATCH 21/32] wmaker: remove unnecessary null check in readMenuDirectory (Coverity #50190)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the pointer cannot be null, otherwise the code would have crashed earlier. As the code seems to always set a valid pointer, there's no need to make a check there. Signed-off-by: Christophe CURIS --- src/rootmenu.c | 6 ++ 1 file changed, 2 ins

[PATCH 25/32] wmaker: update error message to have only one string to be translated

2014-11-15 Thread Christophe
From: Christophe CURIS As a previous patch modified some instances of the error message to include more information to the user, it is a good idea to update also the other uses of the message, so that: - people helping on translation will have less messages to translate - this mean we provide m

[PATCH 24/32] wmaker: fix possible buffer overrun in readMenuPipe (Coverity #50211, #50212)

2014-11-15 Thread Christophe
From: Christophe CURIS As Coverity pointed, when building the command line to execute the current code just assumed that it would fit in the large buffer. If user were to provide a line too long, this would crash. Factually this is probably not possible at current time because the command given

[PATCH 26/32] wmaker: do not duplicate a string that does not need to be (Coverity #72814)

2014-11-15 Thread Christophe
From: Christophe CURIS As coverity pointed, the duplicated string was never freed. Considering what is done with it, is not necessary to allocate a duplicate for it, it is a waste of time and participates in memory fragmentation. Signed-off-by: Christophe CURIS --- src/misc.c | 12 +++-

[PATCH 23/32] wmaker: fixes in function 'UnescapeWM_CLASS' (Coverity #50101, #50186, #50187)

2014-11-15 Thread Christophe
From: Christophe CURIS As coverity found a number of problem in the code, a few changes are made to the function: - allocate better sizes for the strings (the original code allocated too much room in many cases and missed the room for the final '\0' in a case) - do not free strings if empty any

[PATCH 28/32] wmaker: removed case from switch that is unreachable (Coverity #50043)

2014-11-15 Thread Christophe
From: Christophe CURIS There is a check a few line above that already return from the function because there is nothing to do for that case, so the case statement cannot be reached. As not all case are covered in that switch anyway that won't make a difference, and because an 'int' is used instea

[PATCH 31/32] WPrefs: fix possible buffer overrun (Coverity #50216)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, if the Keysym name is very long and many modifiers are used, the function 'capture_shortcut' could overflow its internal buffer. As the case is very unlikely to appear, do not increase the size of the internal buffer (it seems to be already well siz

[PATCH 27/32] wmaker: change message to have only one string to translate and to have more information

2014-11-15 Thread Christophe
From: Christophe CURIS The warning message was duplicated many times for each possible case, but it could have used the same message everywhere, which ease the work of translators. Took opportunity to include the complete command being processed so that the user will know more about the problem a

[PATCH 30/32] WPrefs: remove fuzzy translation that are likely to puzzle user

2014-11-15 Thread Christophe
From: Christophe CURIS Unfortunately this will lower the translation score for German, but the translation guessed by fuzzy matching in gettext is not acceptable in the current case: the translated string is already used for another entry in the list, meaning that user would not see the differenc

[PATCH 32/32] WPrefs: add check for image validity in 'loadRImage' (Coverity #50221, #50081)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the function blindly trust the data read from the file, but in case of problem (corrupted file, not enough memory) it could behave badly. This patch adds a check for the depth, counts on RCreateImage to check the width and height, and in any case it

[PATCH 29/32] wmaker: fix size of element given to the 'qsort' function (Coverity #50210)

2014-11-15 Thread Christophe
From: Christophe CURIS As pointed by Coverity, the sizeof used was not done on the right type. This worked because the element was a pointer all pointers types have the same size in most platforms. For code maintainability, the code will now take the size from the first element of the array to b

[repo.or.cz] wmaker-crm.git branch next updated: wmaker-0.95.6-102-g6265af16

2014-11-15 Thread crmafra
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project wmaker-crm.git. The branch, next has been updated via 6265af16951565faccb9ee91712d3e10340a045a (commit) via 41f5460e29078a60e