Code: void InputConnectionImpl::CommitText(const base::string16& text,
                                     int new_cursor_pos) {
  StartStateUpdateTimer();

  std::string error;
  if (!ime_engine_->ClearComposition(input_context_id_, &error))
    LOG(ERROR) << "ClearComposition failed: error=\"" << error << "\"";

  if (IsControlChar(text)) {
    SendControlKeyEvent(text);
    return;
  }

   if (!ime_engine_->CommitText(input_context_id_,
                                base::UTF16ToUTF8(text).c_str(), &error))
     LOG(ERROR) << "CommitText failed: error=\"" << error << "\"";
 }

Vulnerability Type: DoS Overflow 
CWE ID: CWE-119
Summary: The CPDF_DIBSource::CreateDecoder function in core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp in PDFium, as used in Google Chrome before 51.0.2704.63, mishandles decoder-initialization failure, which allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted PDF document.
Commit Message: Clear |composing_text_| after CommitText() is called.

|composing_text_| of InputConnectionImpl should be cleared after
CommitText() is called. Otherwise, FinishComposingText() will commit the
same text twice.

Bug: 899736
Test: unit_tests
Change-Id: Idb22d968ffe95d946789fbe62454e8e79cb0b384
Reviewed-on: https://chromium-review.googlesource.com/c/1304773
Commit-Queue: Yusuke Sato <yusukes@chromium.org>
Reviewed-by: Yusuke Sato <yusukes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603518}