Re: [Freedos-devel] FreeCOM 0.84-pre6 prerelease

2018-10-24 Thread Bart Oldeman
Hi Tom,

interestingly picoc is still buggy after I disable XMSinit() and
XMSexec() in the xms-swap build. This makes debugging a bit easier now
that that code is eliminated.
On Tue, 23 Oct 2018 at 19:12, Bart Oldeman  wrote:
>
> Hi Tom,
>
> the big one is built with xms-swap, yours without. I get 82758 also
> without xms-swap.
> So it looks like something in the swap code is still buggy then ...
>
> Bart


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] FreeCOM 0.84-pre6 prerelease

2018-10-24 Thread Tom Ehlert
Hi Bart,


at least one bug located in freecom-watcom:

run

TESTS KE2041

will stop after a short while (this IS helpful)
with an error.

now

   a:
   COPY COMMAND.COM TEST
-->
   unable to open file 'command'


after some liberal sprinkling of printf()'s,


  static int addSource(char *p)
  { struct CopySource *h;
char *q;

printf("copy %u: addsource %s\n", __LINE__, p);

assert(p);
q = strtok(p, "+");
assert(q && *q);

printf("copy %u: addsource %s\n", __LINE__, p);


this results in output


copy 500: addsource command.com
copy 506: addsource command

for some reason strtok("command.com", "+"); found a "+"

I verified that "command.com" is still "command.com", and "+" is still
"+".

where can I find the watcom clib source?

strtok() is used in many places; and might be the source of more
trouble.

Tom




___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] FreeCOM 0.84-pre6 prerelease

2018-10-24 Thread Bart Oldeman
Hi Tom,

the issue is that OW strtok() detects characters in the set using a
bitmask and uses an 8 char lookup table called _Bits (__Bits in the
mapfile) which normally has this
01 02 04 08 10 20 40 80
(in hex) A printf confirms that this table is overwritten, so there is
a buffer overflow somewhere. I'll dig further...

Bart


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] FreeCOM 0.84-pre6 prerelease

2018-10-24 Thread Bart Oldeman
Hi Tom,

strtok's source can be browsed here:
http://perforce.openwatcom.org:4000/@md=d=//depot/openwatcom/bld/clib/string/c/=//depot/openwatcom/bld/clib/string/c/strtok.c=33595=sgp@//depot/openwatcom/bld/clib/string/c/strtok.c

Bart


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] FreeCOM 0.84-pre6 prerelease

2018-10-24 Thread Bart Oldeman
Hi Tom,

so in the end the issue is a stack overflow: filenames on the stack
overflow into a const buffer used by strtok. I had raised it from 2K
to 4K back in January but that is not enough.
Since Blair Campbell's LFN work in 2006 cmd_rename() which calls
fillFnam() together use at least 13 ~256-sized fixed sized filename
buffers, which is already 3.3K right there.

You can raise the stack for OW in shell/wlinker.bat to at least 6K,
maybe 8K is better to be more on the safe side. Or alternatively
redesign that code a bit to use less stack space.
Or also just compile without -s to enable stack checking and see what
that gives. I'll do some more tests tomorrow.

Bart


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel