bp_create_unique_id modified to return positive id 37/78737/2 accepted/tizen/common/20161006.154127 accepted/tizen/mobile/20161006.233348 accepted/tizen/tv/20161006.233709 submit/tizen_common/20161006.062531 submit/tizen_mobile/20161006.062524 submit/tizen_tv/20161006.062537
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Wed, 6 Jul 2016 14:37:11 +0000 (16:37 +0200)
committerMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Wed, 28 Sep 2016 08:43:06 +0000 (01:43 -0700)
[Issue]    http://suprem.sec.samsung.net/jira/browse/TWF-1521
[Problem]  bp_create_unique_id sometimes returned negative
           integer because int value overflowed and became negative
[Solution] added mask for generating high number to prevent it from
           becoming too large
[Verify]   Run browser, run command
           "dlogutil TAB_ADAPTOR BROWSER_PROVIDER" in shell
           check if there is any DISK_BUSY message while adding tabs,
           you should add at least 30 tabs.

Change-Id: I1c224a45932517763bfead627e7cd12ae06b94eb
Signed-off-by: Maciej Skrzypkowski <m.skrzypkows@samsung.com>
provider/browser-provider-slots.c

index 53780a637b298a6b39560c0a04d8feb0296b6ecb..bf095709badff8f81f01d3e6d325c3a0d8800d26 100755 (executable)
@@ -52,7 +52,7 @@ int bp_create_unique_id(void)
                for (c = 0; c < cipher - 3; c++)
                        disit_unit = disit_unit * 10;
                uniquetime = tval.tv_sec + ((tval.tv_usec << 2) * 100) +
-                               ((tval.tv_usec >> (cipher - 1)) * disit_unit) +
+                               (((tval.tv_usec >> (cipher - 1)) * disit_unit) & 0x0fff) +
                                ((tval.tv_usec + (tval.tv_usec % 10)) & 0x0fff);
        } while (last_uniquetime == uniquetime);
        last_uniquetime = uniquetime;