Skip to content

Null byte as LCD text causes error #472

Description

@debagos

Issue

A player on my server is using a null byte to flush a Digilines LCD screen, which results in the mapserver shutting down with the following error: panic: pq: invalid byte sequence for encoding "UTF8": 0x00

Related issue: #113

Mapserver log

time="2026-05-07T14:38:05+02:00" level=error msg="AddMapData()" mbpos="&{688 0 -1345}" obj="&{0xe88a8805c20 11013 15 -21511 digilinelcd 1778157485 map[channel:lcd text:\x00]}" prefix=mapobject type="digilines:lcd" x=5 y=15 z=9
panic: pq: invalid byte sequence for encoding "UTF8": 0x00
goroutine 99 [running]:
mapserver/mapobject.(*Listener).OnEvent.func2(...)
        /home/juri/github/mapserver/mapobject/listener.go:129
mapserver/coords.IterateMapblock(...)
        /home/juri/github/mapserver/coords/iterate_mapblock.go:9
mapserver/mapobject.(*Listener).OnEvent(0xe889cc32060, {0xe2892d?, 0x10?}, {0xd0bb40, 0xe88a0900c60})
        /home/juri/github/mapserver/mapobject/listener.go:100 +0xa6e
mapserver/eventbus.(*Eventbus).Emit(0xe88aaf59000?, {0xe2892d, 0x11}, {0xd0bb40, 0xe88a0900c60})
        /home/juri/github/mapserver/eventbus/eventbus.go:35 +0xc8
mapserver/mapblockaccessor.(*MapBlockAccessor).FindMapBlocksByMtime(0xe889cc0d860, 0x19e0271e6bc, 0x61a8, {0xe889cc101d0, 0x1, 0x1bb4680?})
        /home/juri/github/mapserver/mapblockaccessor/mtime.go:79 +0xa75
mapserver/tilerendererjob.incrementalRender(0xe889cd10000)
        /home/juri/github/mapserver/tilerendererjob/incremental.go:27 +0x1b7
mapserver/tilerendererjob.Job(0xe889cd10000)
        /home/juri/github/mapserver/tilerendererjob/job.go:27 +0x4c
created by main.main in goroutine 1
        /home/juri/github/mapserver/main.go:77 +0x35a

Software

Mapserver version: dev e76755d
OS: linux
Architecture: amd64

To reproduce this issue

  • Install and activate the following mods:
    • mesecons
    • digilines
  • Place a digilines:lcd node and set the channel to lcd
  • Place a mesecons_microcontroller:microcontroller0000 and connect it to the LCD with digilines
  • Put in the following code in the Lua controller:
if event.type == "program" then
	digiline_send("lcd", string.char(0))
end
  • Now watch the mapserver shutting down with the above error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions