Null Pointer Deference in HeadlessExample

31 views
Skip to first unread message

Jesse Hertz

unread,
Aug 25, 2022, 9:53:00 PM8/25/22
to headless-dev
Hi All:

It appears (at least for me), that HeadlessExample is broken. When I try to run it, I get a null pointer dereference, see the following backtrace in lldb:

```
(lldb) run google.com
Process 62986 launched: '/Users/jhertz/a/chromium/src/out/a/headless_example' (arm64)
2022-08-25 21:47:08.701640-0400 headless_example[62986:25455662] [] [0x133030620] CVCGDisplayLink::setCurrentDisplay: 1
2022-08-25 21:47:08.701897-0400 headless_example[62986:25455662] [] [0x133030600] CVDisplayLinkCreateWithCGDisplays count: 1 [displayID[0]: 0x1] [CVCGDisplayLink: 0x133030620]
2022-08-25 21:47:08.701907-0400 headless_example[62986:25455662] [] [0x133030620] CVCGDisplayLink::finalize
2022-08-25 21:47:08.701910-0400 headless_example[62986:25455662] [] [0x133030620] CVDisplayLink::finalize
headless_example was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 62986 stopped
* thread #1, name = 'CrBrowserMain', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100004b44 headless_example`OnHeadlessBrowserStarted(headless::HeadlessBrowser*) [inlined] HeadlessExample::HeadlessExample(this=0x000060000172a200, browser=0x0000000129e05260, web_contents=0x0000000000000000) at headless_example.cc:72:18 [opt]
   69          : browser_(browser),
   70            web_contents_(web_contents),
   71            devtools_client_(headless::HeadlessDevToolsClient::Create()) {
-> 72        web_contents_->AddObserver(this);
   73      }
   74      
   75      HeadlessExample::~HeadlessExample() {
Target 0: (headless_example) stopped.
```

I am on the newest version of chromium (fbc0ddb4f4289d7a27676496c68780e1aa5d6607) at this time, and while I am writing a new headless module, I have not made any modifications to headless_example other than inserting a single line:

`  builder.SetDisableSandbox(true);`

to stop it from complaining about not having a valid Seatbelt profile.

OS: MacOS (ARM) 12.3

Thanks!
-jh

Zoe Clifford

unread,
Aug 26, 2022, 3:29:06 PM8/26/22
to Jesse Hertz, headless-dev
Hello,

I believe you may be running into this code path. If the URL is invalid, then the web contents will be null, and you'll get a null pointer deference.
Does it work if you instead write run https://www.google.com/?

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/fac3f03b-16c9-40dd-aaf9-2f79606c5f80n%40chromium.org.

Jesse Hertz

unread,
Aug 26, 2022, 6:01:17 PM8/26/22
to Zoe Clifford, headless-dev
Ah! What a dumb mistake. Thank you :)

I am having an actual issue with headless chrome in an app I'm working on, but I suppose I'll start another thread. 

Thanks again!

Jerry Lee Daniel

unread,
Nov 19, 2023, 4:57:58 PM11/19/23
to headless-dev, hecto...@gmail.com, headless-dev, zoecl...@chromium.org

Loans, Project and Digital Investment financing available up to $500m.
Have a Business Plan, Fundable Project and Redeemable Collateral.

Whatsapp: +44 7405 896213
Reply all
Reply to author
Forward
0 new messages