lgi-devs / lgi-devs/lgi

Methods in cairo segfaults without self argument

Open
#73 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
491
Forks
81
PR merge metrics
No merged PRs in 30d

Description

If I try to use a method on an ImageSurface or a Context, which expects a self argument, but does not pass it, lua segfaults.

That is, I run e.g. surface.get_width() instead of surface:get_width().

Of course this is an error, but it shouldn't cause lua to segfault.

I haven't tested this on other things than ImageSurface and Context, so I'm not sure if it is limited to those or not.

I'm running version 5.2.3 of lua and version 0.7.2 of lgi.

Example:
$ lua -e 'require("lgi").cairo.ImageSurface("ARGB32", 1, 1).get_width()'
Segmentation fault (core dumped)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the Lua command in the report, then trace how ImageSurface and Context methods handle a call without the self argument. Add regression coverage for the omitted-self case and verify that it reports an error rather than segfaulting.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.