Changeset 220860 in webkit


Ignore:
Timestamp:
Aug 17, 2017 9:17:19 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[WPE][GTK] Ensure proper casting of data in gvariants
https://bugs.webkit.org/show_bug.cgi?id=175667

Patch by Jacobo Aragunde Pérez <jaragunde@igalia.com> on 2017-08-17
Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

g_variant_new requires data to have the correct width for their types, using
casting if necessary. Some data of type unsigned were being saved to guint64
types without explicit casting, leading to undefined behavior in some platforms.

  • inspector/remote/glib/RemoteInspectorGlib.cpp:

(Inspector::RemoteInspector::listingForInspectionTarget const):
(Inspector::RemoteInspector::listingForAutomationTarget const):
(Inspector::RemoteInspector::sendMessageToRemote):

Source/WebKit:

g_variant_builder_add requires data to have the correct width for their types, using
casting if necessary. Corrected a call where a single precision float was being put
into a double precision parameter without a cast.

  • UIProcess/API/glib/WebKitWebViewSessionState.cpp:

(encodeFrameState):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r220852 r220860  
     12017-08-17  Jacobo Aragunde Pérez  <jaragunde@igalia.com>
     2
     3        [WPE][GTK] Ensure proper casting of data in gvariants
     4        https://bugs.webkit.org/show_bug.cgi?id=175667
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        g_variant_new requires data to have the correct width for their types, using
     9        casting if necessary. Some data of type `unsigned` were being saved to `guint64`
     10        types without explicit casting, leading to undefined behavior in some platforms.
     11
     12        * inspector/remote/glib/RemoteInspectorGlib.cpp:
     13        (Inspector::RemoteInspector::listingForInspectionTarget const):
     14        (Inspector::RemoteInspector::listingForAutomationTarget const):
     15        (Inspector::RemoteInspector::sendMessageToRemote):
     16
    1172017-08-17  Yusuke Suzuki  <utatane.tea@gmail.com>
    218
  • trunk/Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp

    r220425 r220860  
    188188
    189189    ASSERT(target.type() == RemoteInspectionTarget::Type::Web || target.type() == RemoteInspectionTarget::Type::JavaScript);
    190     return g_variant_new("(tsssb)", target.targetIdentifier(), target.type() == RemoteInspectionTarget::Type::Web ? "Web" : "JavaScript",
     190    return g_variant_new("(tsssb)", static_cast<guint64>(target.targetIdentifier()),
     191        target.type() == RemoteInspectionTarget::Type::Web ? "Web" : "JavaScript",
    191192        target.name().utf8().data(), target.type() == RemoteInspectionTarget::Type::Web ? target.url().utf8().data() : "null",
    192193        target.hasLocalDebugger());
     
    195196TargetListing RemoteInspector::listingForAutomationTarget(const RemoteAutomationTarget& target) const
    196197{
    197     return g_variant_new("(tsssb)", target.targetIdentifier(), "Automation", target.name().utf8().data(), "null", target.isPaired());
     198    return g_variant_new("(tsssb)", static_cast<guint64>(target.targetIdentifier()),
     199        "Automation", target.name().utf8().data(), "null", target.isPaired());
    198200}
    199201
     
    275277    g_dbus_connection_call(m_dbusConnection.get(), nullptr,
    276278        INSPECTOR_DBUS_OBJECT_PATH, INSPECTOR_DBUS_INTERFACE, "SendMessageToFrontend",
    277         g_variant_new("(ts)", targetIdentifier, message.utf8().data()),
     279        g_variant_new("(ts)", static_cast<guint64>(targetIdentifier), message.utf8().data()),
    278280        nullptr, G_DBUS_CALL_FLAGS_NO_AUTO_START,
    279281        -1, m_cancellable.get(), dbusConnectionCallAsyncReadyCallback, nullptr);
  • trunk/Source/WebKit/ChangeLog

    r220857 r220860  
     12017-08-17  Jacobo Aragunde Pérez  <jaragunde@igalia.com>
     2
     3        [WPE][GTK] Ensure proper casting of data in gvariants
     4        https://bugs.webkit.org/show_bug.cgi?id=175667
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        g_variant_builder_add requires data to have the correct width for their types, using
     9        casting if necessary. Corrected a call where a single precision float was being put
     10        into a double precision parameter without a cast.
     11
     12        * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
     13        (encodeFrameState):
     14
    1152017-08-17  Don Olmstead  <don.olmstead@sony.com>
    216
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp

    r218487 r220860  
    172172    g_variant_builder_add(sessionBuilder, "x", frameState.itemSequenceNumber);
    173173    g_variant_builder_add(sessionBuilder, "(ii)", frameState.scrollPosition.x(), frameState.scrollPosition.y());
    174     g_variant_builder_add(sessionBuilder, "d", frameState.pageScaleFactor);
     174    g_variant_builder_add(sessionBuilder, "d", static_cast<gdouble>(frameState.pageScaleFactor));
    175175    if (!frameState.httpBody)
    176176        g_variant_builder_add(sessionBuilder, HTTP_BODY_TYPE_STRING_V1, FALSE);
Note: See TracChangeset for help on using the changeset viewer.