Greetings!

I took a look at this bug today.
I found that the regress testsuite make use of some negative offsets, which
seem to perplex the reader on 32 bit systems.

Please see the attached patch, which has allowed this to build for Ubuntu.

-Dan
Author:      Dan Bungert <daniel.bung...@canonical.com>
Description: Fix reads of signed values into unsigned variables
Bug-Ubuntu:  https://bugs.launchpad.net/bugs/2057735
Bug-Debian:  https://bugs.debian.org/1065725
Forwarded:   yes
Last-Update: 2024-03-14

The regress testsuite makes use of time offsets to mock the passage of time,
and some of the usec values are expressed as negative numbers.  Update the
reader to be able to handle that.
--- a/regress/hplayback.c.m4
+++ b/regress/hplayback.c.m4
@@ -108,7 +108,8 @@
 void Tensuresetup(void) {
   int fd;
   int chars;
-  unsigned long sec, usec;
+  time_t sec;
+  suseconds_t usec;
 
   Tensure_reportfile();
   Tensure_fuzzrawfile();
@@ -124,7 +125,7 @@
   if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
   fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
   chars= -1;
-  sscanf(vb2.buf," start %lu.%lu%n",&sec,&usec,&chars);
+  sscanf(vb2.buf," start %lld.%ld%n",&sec,&usec,&chars);
   if (chars==-1) Psyntax("start time invalid");
   currenttime.tv_sec= sec;
   currenttime.tv_usec= usec;
@@ -170,12 +171,13 @@
 
 static void P_updatetime(void) {
   int chars;
-  unsigned long sec, usec;
+  time_t sec;
+  suseconds_t usec;
 
   if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
   fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
   chars= -1;
-  sscanf(vb2.buf," +%lu.%lu%n",&sec,&usec,&chars);
+  sscanf(vb2.buf," +%lld.%ld%n",&sec,&usec,&chars);
   if (chars==-1) Psyntax("update time invalid");
   currenttime.tv_sec+= sec;
   currenttime.tv_usec+= usec;

Reply via email to