Skip to content

panic: inf is outside the range of representable values of type 'int' #201

@Southporter

Description

@Southporter

In v0.6.0

Minimal Repro:

const std = @import("std");
const zlua = @import("zlua");

const Lua = zlua.Lua;

pub fn main() anyerror!void {
    var gpa: std.heap.DebugAllocator(.{}) = .init;
    const allocator = gpa.allocator();
    defer _ = gpa.deinit();

    var lua = try Lua.init(allocator);
    defer lua.deinit();
    lua.openLibs();

    try lua.doString(
        \\local test = {}
        \\ test[math.huge] = "To infinity"
        \\ print(test[math.huge])
        \\ return test
    );
}

I put this in the examples folder, created a separate example for it in build.zig and used the following:

zig build -Dlang=lua51 run-example-ubsan

It seems to only happen for lua51. Did not get the same error for > 5.1
It does NOT fail with luajit because that has sanitize-c set to off

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions