[PATCH] asmutils-0.18 (basename.asm): bugfixes

Cojocaru Alexandru <[email protected]> Sun, 9 Dec 2012 13:46:54 +0100
Newsgroups gmane.linux.assembly
Message-ID <[email protected]>
Bugfixes for asmutils-0.18 (basename.asm):
$ basename ''  # causes segfault.
$ basename '/' # causes segfault.

Best regards,
Cojocaru Alexandru
basename-bugfixes.patch (application/octet-stream, 1.1 KB)
17a18
> ;0.05; 09-Dec-2012      bugfixes
26,27c27,28
< 	pop	eax
< 	mov	edi,eax		;edi holds argument count
---
> 	pop	ecx
> 	mov	edi,ecx		;edi holds argument count
33,35c34,36
< 	pop	eax		;skip our name
< 	pop	eax		;the path
< 	mov	ebx,eax		;mark the beginning of path
---
> 	pop	ecx		;skip our name
> 	pop	ecx		;the path
> 	mov	ebx,ecx		;mark the beginning of path
37c38
< 	cmp	byte [eax],EOL
---
> 	cmp	byte [ecx],EOL
40,41c41,42
< 	inc	eax
< 	cmp	byte [eax],EOL
---
> 	inc	ecx
> 	cmp	byte [ecx],EOL
43c44
< 	mov	edx,eax		;mark the end
---
> 	mov	edx,ecx		;mark the end
45,47c46,48
< 	dec	eax
< 	cmp	eax,ebx
< 	jnl	.empty
---
> 	dec	ecx
> 	cmp	ecx,ebx
> 	jg	.empty
51c52
< 	cmp	byte [eax],'/'
---
> 	cmp	byte [ecx],'/'
53,54c54,55
< 	inc	eax
< 	mov	edx,eax
---
> 	mov	edx,ecx
> 	inc	edx
56,59c57,60
< 	dec	eax
< 	cmp	byte [eax],'/'
< 	je	.endlooptwoinceax
< 	cmp	eax,ebx
---
> 	dec	ecx
> 	cmp	byte [ecx],'/'
> 	je	.endlooptwoincecx
> 	cmp	ecx,ebx
79,80c80,81
< .endlooptwoinceax:
< 	inc	eax
---
> .endlooptwoincecx:
> 	inc	ecx
83,84c84
< 	mov	ecx,eax
< 	sub	edx,eax
---
> 	sub	edx,ecx
91c91
<   
---
>