New issue
Advanced search Search tips

Issue 766335 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 1
Type: Bug



Sign in to add a comment

Getting debug break on some touch events on CRD iOS

Project Member Reported by nicho...@chromium.org, Sep 18 2017

Issue description

TL;DR:  I think the issue is just that height CAN be zero. The DCHECK needs to be updated to allow for >= vs > for height.



[0918/142620.461846:FATAL:gl_render_layer.cc(59)] Check failed: width > 0 && height > 0. 

Stack:

native_disp (15)#0	0x0000000100381ed4 in base::debug::BreakDebugger() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/debug/debugger_posix.cc:258
#1	0x00000001003dd23c in logging::LogMessage::~LogMessage() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/logging.cc:791
#2	0x00000001003da408 in logging::LogMessage::~LogMessage() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/logging.cc:554
#3	0x000000010029bf9c in remoting::GlRenderLayer::SetTexture(unsigned char const*, int, int, int) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../remoting/client/display/gl_render_layer.cc:59
#4	0x0000000100294a74 in remoting::GlCursor::SetCurrentCursorShape(bool) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../remoting/client/display/gl_cursor.cc:100
#5	0x000000010029491c in remoting::GlCursor::SetCursorShape(remoting::protocol::CursorShapeInfo const&) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../remoting/client/display/gl_cursor.cc:49
#6	0x000000010029e400 in remoting::GlRenderer::OnCursorShapeChanged(remoting::protocol::CursorShapeInfo const&) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../remoting/client/display/gl_renderer.cc:102
#7	0x00000001002f4944 in remoting::GlDisplayHandler::Core::SetCursorShape(remoting::protocol::CursorShapeInfo const&) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../remoting/ios/display/gl_display_handler.mm:152
#8	0x00000001016ab568 in void base::internal::FunctorTraits<void (remoting::protocol::CursorShapeStub::*)(remoting::protocol::CursorShapeInfo const&), void>::Invoke<base::WeakPtr<remoting::protocol::CursorShapeStub> const&, remoting::protocol::CursorShapeInfo const&>(void (remoting::protocol::CursorShapeStub::*)(remoting::protocol::CursorShapeInfo const&), base::WeakPtr<remoting::protocol::CursorShapeStub> const&&&, remoting::protocol::CursorShapeInfo const&&&) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/bind_internal.h:194
#9	0x00000001016ab438 in void base::internal::InvokeHelper<true, void>::MakeItSo<void (remoting::protocol::CursorShapeStub::* const&)(remoting::protocol::CursorShapeInfo const&), base::WeakPtr<remoting::protocol::CursorShapeStub> const&, remoting::protocol::CursorShapeInfo const&>(void (remoting::protocol::CursorShapeStub::* const&&&)(remoting::protocol::CursorShapeInfo const&), base::WeakPtr<remoting::protocol::CursorShapeStub> const&&&, remoting::protocol::CursorShapeInfo const&&&) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/bind_internal.h:297
#10	0x00000001016ab3b4 in void base::internal::Invoker<base::internal::BindState<void (remoting::protocol::CursorShapeStub::*)(remoting::protocol::CursorShapeInfo const&), base::WeakPtr<remoting::protocol::CursorShapeStub>, remoting::protocol::CursorShapeInfo>, void ()>::RunImpl<void (remoting::protocol::CursorShapeStub::* const&)(remoting::protocol::CursorShapeInfo const&), std::__1::tuple<base::WeakPtr<remoting::protocol::CursorShapeStub>, remoting::protocol::CursorShapeInfo> const&, 0ul, 1ul>(void (remoting::protocol::CursorShapeStub::* const&&&)(remoting::protocol::CursorShapeInfo const&), std::__1::tuple<base::WeakPtr<remoting::protocol::CursorShapeStub>, remoting::protocol::CursorShapeInfo> const&&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/bind_internal.h:349
#11	0x00000001016ab2b0 in base::internal::Invoker<base::internal::BindState<void (remoting::protocol::CursorShapeStub::*)(remoting::protocol::CursorShapeInfo const&), base::WeakPtr<remoting::protocol::CursorShapeStub>, remoting::protocol::CursorShapeInfo>, void ()>::Run(base::internal::BindStateBase*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/bind_internal.h:331
#12	0x000000010064da20 in base::OnceCallback<void ()>::Run() && at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/callback.h:64
#13	0x00000001003853bc in base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/debug/task_annotator.cc:61
#14	0x00000001003fc048 in base::internal::IncomingTaskQueue::RunTask(base::PendingTask*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/incoming_task_queue.cc:143
#15	0x0000000100401f90 in base::MessageLoop::RunTask(base::PendingTask*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_loop.cc:406
#16	0x0000000100402440 in base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_loop.cc:417
#17	0x0000000100402e18 in base::MessageLoop::DoWork() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_loop.cc:524
#18	0x0000000100648a5c in base::MessagePumpCFRunLoopBase::RunWork() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_pump_mac.mm:421
#19	0x00000001006489f4 in ::___ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv_block_invoke() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_pump_mac.mm:398
#20	0x000000010063b68c in base::mac::CallWithEHFrame(void () block_pointer) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/mac/call_with_eh_frame.cc:18
#21	0x00000001006482ac in base::MessagePumpCFRunLoopBase::RunWorkSource(void*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_pump_mac.mm:397
#22	0x000000019063142c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#23	0x0000000190630d9c in __CFRunLoopDoSources0 ()
#24	0x000000019062e9a8 in __CFRunLoopRun ()
#25	0x000000019055eda4 in CFRunLoopRunSpecific ()
#26	0x00000001006490c4 in base::MessagePumpCFRunLoop::DoRun(base::MessagePump::Delegate*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_pump_mac.mm:639
#27	0x0000000100647bfc in base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_pump_mac.mm:141
#28	0x0000000100401878 in base::MessageLoop::Run() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/message_loop/message_loop.cc:346
#29	0x0000000100492974 in base::RunLoop::Run() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/run_loop.cc:123
#30	0x00000001001b74b8 in remoting::AutoThread::ThreadMain() at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../remoting/base/auto_thread.cc:227
#31	0x00000001005247c0 in base::(anonymous namespace)::ThreadFunc(void*) at /Users/nicholss/chromoting/crd-ios/src/out/Default/../../base/threading/platform_thread_posix.cc:75
#32	0x000000018f74568c in _pthread_body ()
#33	0x000000018f74559c in _pthread_start ()
#34	0x000000018f742cb4 in thread_start ()


From this check:


void GlRenderLayer::SetTexture(const uint8_t* texture,
                               int width,
                               int height,
                               int stride) {
  DCHECK(thread_checker_.CalledOnValidThread());
  CHECK(width > 0 && height > 0);                 <--- HERE
  texture_set_ = true;
  glActiveTexture(GL_TEXTURE0 + texture_id_);
  glBindTexture(GL_TEXTURE_2D, texture_handle_);

  bool should_reset_row_length;
  const void* buffer_to_update = PrepareTextureBuffer(
      texture, width, height, stride, &should_reset_row_length);

  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
               GL_UNSIGNED_BYTE, buffer_to_update);

  if (should_reset_row_length) {
    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
  }
 

Comment 1 by yuweih@chromium.org, Sep 19 2017

Looks like the host is sending zero height cursor shape to the client for some reason. I wonder in what situation this will happen. If the zero size shape is sent because the cursor is invisible, then we should clear the texture. If it is sent while the cursor has not been changed, then we should probably just ignore it.

According to the spec (https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml), glTexImage2D does seem to accept zero width or height. A vendor implementation might miss that edge case though.

If you are loosening the CHECK, you probably also want to use >= for width just to be safe. You may also want to fix UpdateTexture so that it returns immediately if either width or height is 0.

Comment 2 by yuweih@chromium.org, Sep 19 2017

Also what OS your host is running?
Linux

Comment 4 by yuweih@chromium.org, Sep 19 2017

Owner: yuweih@chromium.org
Status: Assigned (was: Untriaged)
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ae0bb1adcf2aad0b4b2b1a466e4d5125af58b1b0

commit ae0bb1adcf2aad0b4b2b1a466e4d5125af58b1b0
Author: Yuwei Huang <yuweih@chromium.org>
Date: Wed Sep 20 18:20:59 2017

[CRD iOS] Fix the size CHECK in GlRenderLayer

Looks like the host might send cursor shape with empty size to the
client, which will fail the check for width > 0 && height > 0.
Technically speaking glTexImage2D should allow zero size texture so
lets loosen the check to width >= 0 && height >= 0 and simply return
in UpdateTexture when either width == 0 or height == 0.

Bug:  766335 
Change-Id: I68e9d9e22bb5995f5b0c1f5079db774c72407ef6
Reviewed-on: https://chromium-review.googlesource.com/674029
Reviewed-by: Scott Nichols <nicholss@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503203}
[modify] https://crrev.com/ae0bb1adcf2aad0b4b2b1a466e4d5125af58b1b0/remoting/client/display/gl_render_layer.cc

Comment 6 by yuweih@chromium.org, Sep 20 2017

Status: Fixed (was: Assigned)

Sign in to add a comment