#1631 closed defect (fixed)

srfi-13 string-pad segfaults when arguments are not of the right type

Reported by: Kooda Owned by:
Priority: major Milestone: 5.2
Component: extensions Version:
Keywords: srfi-13 Cc:
Estimated difficulty:

Description

This little piece of code causes a segfault (easy mistake to make, arguments order is reversed).

(import srfi-13)
(string-pad "coucou" #\space 10)

Change History (5)

comment:1 Changed 11 months ago by sjamaan

Milestone: someday5.2

comment:2 Changed 11 months ago by sjamaan

This is a bug in ##sys#check-exact. It will fail anywhere it's used. In core there's currently two places remaining that use it: pointer-vector-ref and pointer-vector-set!

(import (chicken memory))
(pointer-vector-ref (make-pointer-vector 2) #\space) ; segfault

Actually, I think all these uses are bogus: an exact complex number is not a valid index into a vector or string. So probably it's better to get rid of ##sys#check-exact altogether.

comment:3 Changed 11 months ago by sjamaan

I've fixed srfi-13 to use ##sys#check-fixnum but there are other eggs still using it:

  • sequences
  • object-evict
  • srfi-1
  • srfi-14
  • srfi-18
  • srfi-69
  • vector-lib

comment:4 Changed 11 months ago by sjamaan

I've updated the eggs now too. This ticket can be closed when core is patched to mark it as obsolete and remove uses in pointer-vector-ref/set!

comment:5 Changed 10 months ago by sjamaan

Resolution: fixed
Status: newclosed

Fixed with 29b3d6113985e2f110698d8ab7f398f51a88a819

Note: See TracTickets for help on using tickets.