[Dev-luatex] segfault on example in manual

luigi scarso luigi.scarso at gmail.com
Tue Apr 2 08:50:23 CEST 2019


On Tue, Apr 2, 2019 at 7:18 AM luigi scarso <luigi.scarso at gmail.com> wrote:

>
>
> On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha <reinhard.kotucha at web.de>
> wrote:
>
>> Hi,
>> when I run the example on page 261/262 of the LuaTeX Manual and the
>> input file ("foo.pdf" in the example) doesn't exist, I get
>>
>>   Segmentation fault (core dumped)
>>
>> on x86_64-linux.
>>
>

This is ok
$ luatex --fmt=luatex-plain  "test-plain.tex"

\directlua{
local operatortable = { }

operatortable.Do = function(scanner,info)
    local resources = info.resources
    if resources then
            local val     = scanner:pop()
            local name    = val[2]
            local xobject = resources.XObject
            print(info.space .. "Uses XObject " .. name)
            local resources = xobject.Resources
            if resources then
                local newinfo = {
                    space     = info.space .. " ",
                    resources = resources,
                }
                pdfscanner.scan(entry, operatortable, newinfo)
            end
      end
end


local function Analyze(filename)
    local doc = pdfe.open(filename)
    if doc then
        local pages = doc.Pages
        for i=1,#pages do
            local page = pages[i]
            local info = {
              space     = " " ,
              resources = page.Resources,
            }
            print("Page " .. i)
         --[==[ pdfscanner.scan(page.Contents,operatortable,info)]==]
            pdfscanner.scan(page.Contents(),operatortable,info)
        end
    end
end

Analyze("foo.pdf")

}
\end

-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20190402/37bb2e6d/attachment.html>


More information about the dev-luatex mailing list